Forums > MaxMSP

Function object with line object

August 2, 2007 | 9:18 pm

Hi there,

I have a composition whose tempo I control using a metro object.

I’d now like to make changes to the tempo, by gradually increasing and decreasing the tempo during the composition. For example, for the first 10 seconds I might like to go from 100bpm to 105bpm, and then from 105 to 100 over the course of the next 10 seconds, and so on.

I was thinking that perhaps the function object, connected to a line object would do the trick. The problem though was that the line only outputted values for between the first two points plotted in the function window. So, if my first point was at 0ms, 100, my second at 100ms, 100 and my third at 200ms, the output from line only gave values from 0 to 100.

When I used line~ instead, the values were as expected – 0 to 200.

So, should function only be used with line~, and if so, how can feed values from line~ into metro – I can’t can i…

So, how might I do this?

Thanks,

Barry.

max v2;
#N vpatcher 0 44 1680 990;
#P window setfont "Sans Serif" 9.;
#P flonum 324 606 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 308 535 40 196617 line;
#P message 339 212 31 196617 clear;
#P button 440 410 15 0;
#P button 137 170 15 0;
#P user function 133 325 454 395 1 1 0 0;
#X frgb 153 102 153;
#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. 55.555557 0;
#X add 4466.019531 75.555557 0;
#X add 9514.563477 6.666667 0;
#X add 10000. 0. 0;
#X domain 10000.;
#X range 0. 100.;
#X done;
#P hidden connect 3 0 0 0;
#P connect 1 0 0 0;
#P connect 0 1 4 0;
#P connect 4 0 5 0;
#P connect 0 3 2 0;
#P pop;


August 2, 2007 | 9:27 pm


August 3, 2007 | 9:32 am

Thanks! I found the following patch, but I’m sure exactly how I’m supposed to use it with the function object. Any suggestions?

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 213 152 29 196617 gate;
#P newex 213 86 29 196617 == 2;
#P newex 99 266 29 196617 sel 1;
#P newex 99 243 29 196617 == 1;
#P newex 130 86 31 196617 > 2;
#P newex 130 152 40 196617 gate;
#P newex 130 64 31 196617 zl len;
#P newex 130 173 51 196617 zl reg;
#P newex 13 42 178 196617 t l 3;
#P outlet 181 297 15 0;
#P newex 181 266 33 196617 gate;
#P newex 181 243 26 196617 < = 2;
#P inlet 159 22 15 0;
#P inlet 86 22 15 0;
#P newex 130 195 85 196617 t l l b;
#P newex 130 266 47 196617 gate;
#P newex 130 243 32 196617 > 2;
#P newex 130 217 32 196617 zl len;
#P newex 13 106 168 196617 zl slice 2;
#P newex 13 128 157 196617 line $1;
#P outlet 13 296 15 0;
#P inlet 13 22 15 0;
#P window linecount 5;
#P comment 25 160 100 196617 this can replace the line object and will
do it like line~ with as many point time pairs as you want.;
#P connect 3 1 17 1;
#P fasten 3 1 22 1 165 149 237 149;
#P connect 21 0 22 0;
#P connect 16 0 18 0;
#P fasten 16 0 21 0 135 83 218 83;
#P connect 8 2 12 1;
#P connect 12 0 13 0;
#P fasten 20 0 13 0 104 293 186 293;
#P fasten 22 0 13 0 218 293 186 293;
#P connect 11 0 12 0;
#P fasten 14 1 6 0 186 239 135 239;
#P connect 14 1 11 0;
#P fasten 5 0 19 0 135 239 104 239;
#P connect 5 0 6 0;
#P fasten 5 0 11 0 135 239 186 239;
#P connect 4 1 15 1;
#P connect 8 1 7 1;
#P connect 10 0 3 2;
#P connect 6 0 7 0;
#P connect 8 0 5 0;
#P connect 15 0 8 0;
#P connect 17 0 15 0;
#P connect 18 0 17 0;
#P connect 14 0 4 0;
#P fasten 14 0 16 0 18 61 135 61;
#P connect 19 0 20 0;
#P connect 9 0 3 1;
#P connect 3 0 2 0;
#P connect 4 0 3 0;
#P fasten 7 0 4 0 135 289 8 289 8 102 18 102;
#P connect 1 0 14 0;
#P window clipboard copycount 23;


August 3, 2007 | 12:25 pm

Quote: Baz79 wrote on Fri, 03 August 2007 10:32
—————————————————-
> Thanks! I found the following patch, but I’m sure exactly how I’m supposed to use it with the function object. Any suggestions?

i’ve made a quick help file, see patches below.

hope it makes more sense,

j

save this patch (abstraction) as "multi_line" in max searchpath -

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 242 169 29 196617 gate;
#P newex 242 103 29 196617 == 2;
#P newex 128 283 29 196617 sel 1;
#P newex 128 260 29 196617 == 1;
#P newex 159 103 31 196617 > 2;
#P newex 159 169 40 196617 gate;
#P newex 159 81 31 196617 zl len;
#P newex 159 190 51 196617 zl reg;
#P newex 42 59 178 196617 t l 3;
#N comlet end of line bang;
#P outlet 210 314 15 0;
#P newex 210 283 33 196617 gate;
#P newex 210 260 26 196617 < = 2;
#N comlet time grain in ms;
#P inlet 188 39 15 0;
#N comlet total ramp time in ms;
#P inlet 115 39 15 0;
#P newex 159 212 85 196617 t l l b;
#P newex 159 283 47 196617 gate;
#P newex 159 260 32 196617 > 2;
#P newex 159 234 32 196617 zl len;
#P newex 42 123 168 196617 zl slice 2;
#P newex 42 145 157 196617 line $1;
#N comlet line output;
#P outlet 42 313 15 0;
#N comlet multi_line msg;
#P inlet 42 39 15 0;
#P window linecount 5;
#P comment 54 177 100 196617 this can replace the line object and will do it like line~ with as many point time pairs as you want.;
#P connect 16 0 18 0;
#P fasten 16 0 21 0 164 100 247 100;
#P fasten 14 1 6 0 215 256 164 256;
#P connect 14 1 11 0;
#P connect 14 0 4 0;
#P fasten 14 0 16 0 47 78 164 78;
#P fasten 5 0 19 0 164 256 133 256;
#P connect 5 0 6 0;
#P fasten 5 0 11 0 164 256 215 256;
#P connect 3 1 17 1;
#P fasten 3 1 22 1 194 166 266 166;
#P connect 21 0 22 0;
#P connect 8 2 12 1;
#P connect 12 0 13 0;
#P fasten 20 0 13 0 133 310 215 310;
#P fasten 22 0 13 0 247 310 215 310;
#P connect 11 0 12 0;
#P connect 4 1 15 1;
#P connect 8 1 7 1;
#P connect 10 0 3 2;
#P connect 6 0 7 0;
#P connect 8 0 5 0;
#P connect 15 0 8 0;
#P connect 17 0 15 0;
#P connect 18 0 17 0;
#P connect 19 0 20 0;
#P connect 9 0 3 1;
#P connect 3 0 2 0;
#P connect 4 0 3 0;
#P fasten 7 0 4 0 164 306 37 306 37 119 47 119;
#P connect 1 0 14 0;
#P window clipboard copycount 23;

this is the help file, save as "multi_line.help" in max searchpath

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 157 264 197 196617 argument to set int or float , default is int;
#P newex 279 33 78 196617 loadmess 2000;
#P comment 350 68 195 196617 set duration in ms;
#P comment 385 295 150 196617 current value / visual display;
#P flonum 279 68 70 9 10. 0 1 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 279 85 70 196617 setdomain $1;
#P user multiSlider 377 333 100 100 0. 1. 1 3961 15 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P flonum 62 404 81 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 62 382 93 196617 timer;
#P newex 62 359 54 196617 onebang 1;
#P button 145 335 15 0;
#P button 62 332 15 0;
#P button 25 81 15 0;
#P flonum 377 310 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 88 264 67 196617 multi_line 0.;
#P user function 25 125 225 225 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.8 0;
#X add 265.957397 0.133333 0;
#X add 1148.936279 1. 0;
#X add 2000. 0. 0;
#X domain 2000.;
#X range 0. 1.;
#X done;
#P comment 41 81 195 196617 click some points into function , then bang;
#P window linecount 3;
#P comment 62 421 231 196617 time elapsed = setdomain value – time grain value (default is 20ms) see line help/line_timing_tricks for more info…;
#P connect 5 0 2 0;
#P fasten 12 0 2 0 284 101 30 101;
#P connect 3 0 6 0;
#P connect 6 0 8 0;
#P connect 8 0 9 0;
#P connect 9 0 10 0;
#P connect 2 1 3 0;
#P fasten 7 0 8 1 150 354 111 354;
#P connect 3 1 7 0;
#P connect 7 0 9 1;
#P connect 16 0 13 0;
#P connect 13 0 12 0;
#P fasten 3 0 4 0 93 296 382 296;
#P fasten 3 0 11 0 93 330 382 330;
#P window clipboard copycount 18;


August 3, 2007 | 1:27 pm

hi,
I think this "multi-line" abstraction come from the St.ools library by Stefan Tiedje and its real name is "lines".
Here is the help file :

max v2;
#N vpatcher 397 102 734 283;
#P window setfont "Sans Serif" 9.;
#P newex 197 129 105 9109513 Abhaxions.Copyright;
#P button 66 130 15 0;
#P number 26 130 35 9 0 0 0 139 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 26 101 50 9109513 lines;
#P message 26 75 156 9109513 0 , 100 2000 10 2000 500 2000;
#P newex 274 44 29 9109513 line~;
#P newex 83 44 23 9109513 line;
#P comment 26 46 56 9109513 lines is like;
#P comment 107 46 166 9109513 but it allows multisegment lists like;
#P connect 4 0 5 0;
#P connect 5 0 6 0;
#P connect 5 1 7 0;
#P pop;

peace

a


August 3, 2007 | 2:10 pm

How could you get curves instead of lines for some segments?


August 3, 2007 | 7:15 pm

Quote: cebec wrote on Fri, 03 August 2007 15:10
—————————————————-
> How could you get curves instead of lines for some segments?
—————————————————-

by using non linear math functions (exp, pow, etc…)

j


August 4, 2007 | 12:30 am

try using line~ then connect to snapshot~ to convert to float values.
its a hack but it works.

On 02/08/07, Baz79 wrote:
>
> Hi there,
>
> I have a composition whose tempo I control using a metro object.
>
> I’d now like to make changes to the tempo, by gradually increasing and decreasing the tempo during the composition. For example, for the first 10 seconds I might like to go from 100bpm to 105bpm, and then from 105 to 100 over the course of the next 10 seconds, and so on.
>
> I was thinking that perhaps the function object, connected to a line object would do the trick. The problem though was that the line only outputted values for between the first two points plotted in the function window. So, if my first point was at 0ms, 100, my second at 100ms, 100 and my third at 200ms, the output from line only gave values from 0 to 100.
>
>
> When I used line~ instead, the values were as expected – 0 to 200.
>
> So, should function only be used with line~, and if so, how can feed values from line~ into metro – I can’t can i…
>
> So, how might I do this?
>
> Thanks,
>
> Barry.
>
>
>
>
> max v2;
> #N vpatcher 0 44 1680 990;
> #P window setfont "Sans Serif" 9.;
> #P flonum 324 606 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
> #P window linecount 1;
> #P newex 308 535 40 196617 line;
> #P message 339 212 31 196617 clear;
> #P button 440 410 15 0;
> #P button 137 170 15 0;
> #P user function 133 325 454 395 1 1 0 0;
> #X frgb 153 102 153;
> #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. 55.555557 0;
> #X add 4466.019531 75.555557 0;
> #X add 9514.563477 6.666667 0;
> #X add 10000. 0. 0;
> #X domain 10000.;
> #X range 0. 100.;
> #X done;
> #P hidden connect 3 0 0 0;
> #P connect 1 0 0 0;
> #P connect 0 1 4 0;
> #P connect 4 0 5 0;
> #P connect 0 3 2 0;
> #P pop;
>
>
>


http://www.centuryofnoise.com
http://www.perevillez.com


August 5, 2007 | 8:43 pm

>"multi-line" abstraction come from the St.ools library by >Stefan Tiedje

Here’s another way, simpler & faster, for a multi-point line abstraction :
arg 1 is target
arg 2 is grain

max v2;
#N vpatcher 1367 455 2020 942;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 464 98 70 196617 unpack 0. 20.;
#P newex 464 63 94 196617 patcherargs 0. 20.;
#P message 75 202 29 196617 stop;
#P message 301 342 14 196617 0;
#P message 246 336 14 196617 1;
#P newex 253 376 38 196617 gate 1;
#P outlet 253 402 15 0;
#P flonum 179 317 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 247 204 41 196617 zlclear;
#P newex 179 172 27 196617 t l b;
#P newex 209 288 30 196617 t b b;
#P newex 179 264 40 196617 line 0.;
#P newex 179 213 51 196617 zl slice 2;
#P newex 179 146 36 196617 zl reg;
#P newex 127 65 113 196617 route list float int stop;
#P outlet 179 357 15 0;
#P inlet 127 41 15 0;
#P connect 2 3 14 0;
#P connect 0 0 2 0;
#P fasten 6 1 3 0 307 336 386 60 274 44;
#P connect 2 0 3 0;
#P connect 8 0 3 0;
#P connect 3 0 7 0;
#P connect 7 0 4 0;
#P connect 16 0 5 0;
#P connect 14 0 5 0;
#P fasten 2 1 5 0 118 184;
#P fasten 2 2 5 0 120 180;
#P connect 4 0 5 0;
#P connect 5 0 9 0;
#P connect 9 0 1 0;
#P fasten 4 1 3 1 256 257 314 185 244 102;
#P connect 16 1 5 2;
#P connect 5 1 6 0;
#P connect 6 1 12 0;
#P connect 7 1 8 0;
#P connect 13 0 11 0;
#P connect 12 0 11 0;
#P connect 11 0 10 0;
#P connect 6 0 11 1;
#P connect 7 1 13 0;
#P connect 15 0 16 0;
#P pop;


August 6, 2007 | 10:56 am

Quote: derrickgiscloux wrote on Sun, 05 August 2007 21:43
—————————————————-
> Here’s another way, simpler & faster, for a multi-point line abstraction :
> arg 1 is target
> arg 2 is grain

cool patch, and indeed simpler and faster. only thing is the crazy way you use those patch cords, is it intentional or a browser thing? But hey, as long as it works i’m not complaining…

j


August 7, 2007 | 9:20 pm

dGarden schrieb:
> hi, I think this "multi-line" abstraction come from the St.ools
> library by Stefan Tiedje and its real name is "lines". Here is the
> help file :

Yes, its an older version of it. The newer version will compensate for
the duration errors the normal line is known for as well, that means it
will end correctly at the accumulated times…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


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