Forums > MaxMSP

very basic question

August 22, 2006 | 7:02 am

i have looked through the max documentation and couldn’t find out how to do this…

i have a line~ object with a message box connected to control it. lets say the message box is "0, 500 500". how do i set each of those 3 numbers to be a variable with its own float number box.
i think that i should be using $1 $2 $3 as variables and have tried them in many different ways with no luck.

i know there has to be a ridiculously easy way to do this but i cant for the life of me figure it out.

thank you,
dave


August 22, 2006 | 7:47 am

>i have looked through the max documentation and couldn’t find out how to do this…
>
>i have a line~ object with a message box connected to control it. lets say the message box is "0, 500 500". how do i set each of those 3 numbers to be a variable with its own float number box.
>i think that i should be using $1 $2 $3 as variables and have tried them in many different ways with no luck.
>

You have to pack the three number boxes in a list

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 182 196 32 196617 line~;
#P message 182 169 56 196617 $1 , $2 $3;
#P flonum 255 103 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 210 103 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 163 102 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 182 141 66 196617 pack 0. 0. 0.;
#P connect 4 0 5 0;
#P connect 0 0 4 0;
#P connect 3 0 0 2;
#P connect 2 0 0 1;
#P connect 1 0 0 0;
#P window clipboard copycount 6;

Every time you change the first number box the new list is sent to the line~ object

m

HomePage: http://www.giri.it
Computer Music Italian Forum http://www.virtual-sound.com



MJ
August 22, 2006 | 7:58 am

the message "0, 500 500" is actually two messages one is "0" the
other is "500 500"the "," is eparating them you cannot make that in
one message like "$1 $2 $3" (this is like "0 500 500")

the line object wants two message after each other. If you want to
pack it in one take alook at the sprintf object

like "sprintf %f , %f %f "

-mj

>i have looked through the max documentation and couldn’t find out
>how to do this…
>
>i have a line~ object with a message box connected to control it.
>lets say the message box is "0, 500 500". how do i set each of those
>3 numbers to be a variable with its own float number box.
>i think that i should be using $1 $2 $3 as variables and have tried
>them in many different ways with no luck.
>
>i know there has to be a ridiculously easy way to do this but i cant
>for the life of me figure it out.
>
>thank you,
>dave
>


August 22, 2006 | 8:12 am

hmmm i didnt think to make a list
haha, kind of obvious now

thank you very much for the help
works like a charm now

peace,
dave


August 22, 2006 | 11:00 am

Alternatively, you could hook the [line~] up to a graphical breakpoint editor, which can output whatever envelope you specify in a line format.

max v2;
#N vpatcher 15 55 615 455;
#P button 217 36 15 0;
#P user ezdac~ 131 262 175 295 0;
#P user function 217 68 371 142 1 1 0 0;
#X frgb 82 82 82;
#X brgb 204 204 204;
#X rgb2 85 85 85;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 0. 0;
#X add 457.74646 0.836735 0;
#X add 1000. 0. 0;
#X domain 1000.;
#X range 0. 1.;
#X done;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 265 161 27 9109513 line~;
#P newex 130 201 27 9109513 *~;
#P newex 129 110 59 9109513 cycle~ 1000;
#P connect 0 0 1 0;
#P connect 1 0 4 0;
#P fasten 2 0 1 1 270 191 152 191;
#P fasten 1 0 4 1 135 244 170 244;
#P connect 5 0 3 0;
#P connect 3 1 2 0;


August 22, 2006 | 3:13 pm

Since we’re on the subject, I always wondered if there was difference in efficiency between using the message "$1, $2 $3" vs the "sprintf %f , %f %f" version that mj posted. I would assume that since sprintf expects floats to come in, it would perform slightly better. Any ideas?


Viewing 6 posts - 1 through 6 (of 6 total)