Packing data with comas (,) to control msp curve object

Mar 28, 2009 at 1:14am

Packing data with comas (,) to control msp curve object

Hi there Smile, I’m trying to pack AHDS(R) control data to use the curve object inside max msp.
it doesn’t pack correctly, because i try to insert comas “,” (do we say it like that in english?)
in order to have the start/end values of my curves.

the curve object only receive the number before the comas and the comas. but not the time of the curves in milliseconds and the curve values (from -1. to 1.)
i don’t know at all what to use instead of or with the pack object to do that.
here is a screenshot of a part of my “voice” subpatch

i’ve used “” to insert the “,”

#43067
Mar 28, 2009 at 1:27am

You can use sprintf, still using the backslash (,).

sprintf %f, %f (…)

#154336
Mar 28, 2009 at 2:00am

OK but unfortunately using sprintf %f, %f …
the first float value has no coma after it in the max windows when adding a print object to the out of the sprintf
and the curve object says “bad arguments”

#154337
Mar 28, 2009 at 2:30am

I added an inlet to the sprintf with the %s definition, associated to a message box containing “,” and it doesn’t work… is the coma strictly necessary?

#154338
Mar 28, 2009 at 2:55am

dont use [pack] at all when a comma is involved.

for “1., 0.1 0.2 0.3″ use [pack] for the last three values
and then [t l 1]

#154339
Mar 28, 2009 at 3:38am

This works for me…

#P window setfont “Sans Serif” 9.;
#P user number~ 139 320 178 335 9 3 3 2 0. 0. 0 0. 250 0. 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 128 80 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 172 80 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 91 119 20 196617 t b;
#P number 216 80 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 139 265 136 196617 1. , 22. 1683;
#P newex 111 209 20 196617 t b;
#P newex 210 211 62 196617 prepend set;
#P newex 139 294 42 196617 curve~;
#P newex 128 148 98 196617 sprintf %f\, %f %i;
#P connect 7 0 6 0;
#P connect 7 0 0 1;
#P connect 5 0 6 0;
#P connect 5 0 0 2;
#P fasten 0 0 3 0 133 186 116 186;
#P fasten 0 0 2 0 133 188 215 188;
#P connect 1 0 9 0;
#P connect 4 0 1 0;
#P connect 8 0 0 0;
#P connect 6 0 0 0;
#P connect 3 0 4 0;
#P connect 2 0 4 0;
#P window clipboard copycount 10;

#154340
Mar 29, 2009 at 4:19pm

If you learn what the comma does, you might realise that you don’t need a comma at all…
Commas don’t get sent out of a message box (unless you escape them). Connect a message box with comma to a print, click the box and watch the Max window. Mayby that will give you an idea how to compose your data (hint: use trigger…)

Stefan

#154341
Mar 29, 2009 at 4:57pm

i used to escape them, but the message is truncated (does anyone know why?) when received by the curve or line object.
After that i tried without comas and it “works” but no attack is heard at all, no matter the length of attack i entered…

I also have a problem of polyphony since I tried to incorporate an AHDSR to my voice patch. when i play notes polyphonically sometimes a note cuts another, sometimes the release function does not work at all.

I just put a counter with an if function to reinitialize the counter and a gate 64 to dispatch the messages to my 64 voice aliases. the print objects are showing my note off messages are sent on the same voice than the note on, but perhaps my note off sending protocol is not ok.
(Should I tell to max to remember the note on message and the channel where it is sent to send the note off message to the same channel?)
In attachment you’ll find my patch and subpatches on their current state.
I’m really a beginner so i hope you’ll excuse me for the lacks of the patch

#154342
Mar 29, 2009 at 5:27pm

Instead of having lots of intsances of your “voice” patch you might want to load it into the [poly~] object which will manage your midi note on/offs if you use the “midinote” message and [thispoly~] to control which instances are busy.

Have a look at Chris Muir’s Simple FM Synth to see how it can be done.

lh

http://www.xfade.com/max/SFM/

#154343
Mar 29, 2009 at 7:25pm

no, you did not send escaped comma symbols to your [line] object, thats impossible. nobody ever sends escaped commas to [line]!

#154344
Mar 29, 2009 at 7:51pm

wow, you even have a sprintf obejct between the number boxes and your [line], wtf.

unfortunatly a classic ADSR (or in your case, AHDSR) envelope is less straightforward than one might think and more experienced users also have their difficulties with envelopes, when not with the coding, then with making decisions on the machine model.

i would recommend you to play around more with the [line] helpfile because i think you misunderstood a few things about it.
the generic “input format” for a [line] used as audio envelope is always at least 2 messages: first it needs to be told from where to start, and then it exspects another message, which is a list of time/value pairs. (see helpfile…)
your sampler voice will probably start all envelopes at a level of “0.”, so you can use just a [0.] or [t 0.] to set the starting point.

try this: use [pak] instead of this silly [sprintf], and connect the outcoming list into the right inlet of a [zl reg].
[zl reg] can be thought of a [f] object but for lists of unknown lenght. when a voice (note on) will be played, it must now first trigger the “0.” and then the envelope stored in [zl reg] (or [pack] or [list]).

yeah guys, and once again the messagebox object has managed to trick somebody about how messages work. it is wicked with this {1., 2. 3. 4., hallo} stuff; on the one hand, without numberbox or messagebox it is very difficult to begin with max, but on the other hand, with them, it is difficult to learn how messages work.
it would not have been the first time that i had to explain somebod why a messagebox {1., 2. 3. 4., hallo} does not print “1., 2. 3. 4., hallo” to the console!

-110

#154345
Mar 30, 2009 at 5:11pm
fabienaurejac wrote on Sun, 29 March 2009 18:57
i used to escape them, but the message is truncated (does anyone know why?)

Because the line~ object doesn’t understand commas.

You really, seriously, need to run not walk to Max Basic Tutorial 1. Read the section titled “Commas change everything”.

#154346

You must be logged in to reply to this topic.