function ramps

Jan 16, 2006 at 4:47pm

function ramps

Hey chaps,

im trying to create number ramps using the function object so i can draw
pitch envelopes. i’ve been using line and function objects but can’t figure
out how to set the duration of the envelope.

any ideas?

cheers,
dave

#23939
Jan 16, 2006 at 4:59pm

Maybe the “domain” or “setdomain” sent to the [function] object?

p

_____________________________
Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl

http://users.skynet.be/crfmw/max

#68445
Jan 16, 2006 at 5:19pm

cheer patrick,

i’ve tried the set domain object however still having problems with hooking
it up to a pitch input. i think i might go down the dial route and set 3
dials into a line (initial pitch, final pitch, and time duration) however
after trying this before im stuggling to get this info into the line object
to produce a ramp. any ideas? maybe pack the three into the line?

cheers,
dave

#68446
Jan 16, 2006 at 5:28pm

I was working recently on something similar (to make big glissandos)
and ended up using a function. The function domain is the total
duration, driven by a metro hooked up to a counter object. Here’s a
quick and dirty patch below – I hope it helps.

steve
_________________________________
Stephen Taylor
Associate Professor of Composition-Theory
University of Illinois at Urbana-Champaign

http://www.stephenandrewtaylor.net

max v2;
#N vpatcher 603 352 1047 646;
#P window setfont “Sans Serif” 9.;
#P comment 317 138 72 196617 adjust volume;
#P flonum 282 137 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 234 171 58 196617 *~ 0.1;
#P message 382 189 27 196617 stop;
#P message 309 189 65 196617 startwindow;
#P newex 234 223 34 196617 dac~;
#P comment 309 175 71 196617 � start audio;
#P user panel 297 169 123 43;
#X brgb 255 255 255;
#X frgb 100 202 30;
#X border 2;
#X rounded 0;
#X shadow 0;
#X done;
#P newex 234 136 40 196617 tri~;
#P window linecount 3;
#P comment 49 214 157 196617 counter progresses through bpf ; metro
speed determines how fast the bpf goes;
#P window linecount 1;
#P comment 143 26 37 196617 slower;
#P window linecount 2;
#P comment 13 53 35 196617 start metro;
#P user hslider 90 40 17 71 100 1 5 5;
#P comment 148 78 42 196617 � reset counter;
#P button 133 87 13 5;
#P user hslider 49 192 12 137 5000 1 0 9;
#P number 102 64 35 9 5 120 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 49 57 17 0;
#P window linecount 1;
#P newex 49 82 51 196617 metro 30;
#N counter 2350;
#X flags 0 0;
#P newobj 49 105 124 196617 counter 2350;
#P user uslider 204 129 13 45 1401 1 0 9;
#P user function 49 129 202 190 1 1 0 0;
#X frgb 33 33 33;
#X brgb 173 211 255;
#X rgb2 17 17 17;
#X rgb3 255 255 255;
#X rgb4 0 0 0;
#X rgb5 0 0 0;
#X add 0. 700. 0;
#X add 673.75885 1166.666626 0;
#X add 2304.964355 894.444458 0;
#X add 4113.475098 272.222229 0;
#X domain 5000.;
#X range 0. 1400.;
#X done;
#P window linecount 3;
#P comment 185 25 33 196617 adjust metro speed;
#P window linecount 1;
#P comment 88 26 33 196617 faster;
#P connect 6 0 5 0;
#P connect 5 0 4 0;
#P hidden fasten 8 0 2 0 54 207 45 207 45 126 54 126;
#P hidden connect 4 0 8 0;
#P fasten 11 0 5 1 95 60 95 60;
#P fasten 11 0 7 0 95 60 107 60;
#P connect 9 0 4 3;
#P hidden connect 2 0 3 0;
#P fasten 3 0 15 0 209 194 224 194 224 129 239 129;
#P connect 15 0 21 0;
#P connect 21 0 18 0;
#P fasten 19 0 18 0 314 216 239 216;
#P fasten 20 0 18 0 387 216 239 216;
#P connect 21 0 18 1;
#P connect 22 0 21 1;
#P pop;

#68447
Jan 18, 2006 at 7:06am

Here are three different alternitives.

max v2;
#N vpatcher 97 44 1237 824;
#P window setfont “Sans Serif” 9.;
#P comment 671 135 119 196617 time of note modulation;
#P number 719 150 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 797 170 33 196617 clear;
#P message 719 169 70 196617 setdomain $1;
#P user function 715 197 870 279 1 1 0 0;
#X frgb 227 87 117;
#X brgb 91 91 91;
#X rgb2 255 255 255;
#X rgb3 103 187 243;
#X rgb4 25 25 25;
#X rgb5 0 0 0;
#X add 44.51049 70.175438 0;
#X domain 1273.;
#X range 0. 200.;
#X done;
#P comment 897 125 119 196617 time of envelope (ms);
#P button 820 91 15 0;
#P number 897 140 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 975 160 33 196617 clear;
#P message 897 159 70 196617 setdomain $1;
#P user function 896 192 1055 281 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 18.180855 1. 0;
#X add 590.877808 0. 0;
#X add 609.058533 0.986667 0;
#X add 872.680603 0. 0;
#X add 881.770935 1. 0;
#X add 1118.122437 0. 0;
#X add 1127.212036 0.96 0;
#X add 1709. 0. 0;
#X domain 1709.;
#X range 0. 1.;
#X done;
#P user meter~ 907 469 987 482 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P user gain~ 759 394 24 100 158 0 1.071519 7.94321 10.;
#P newex 759 287 32 196617 line~;
#P newex 897 291 32 196617 line~;
#P newex 759 358 27 196617 *~;
#P newex 759 313 40 196617 cycle~;
#P comment 451 235 119 196617 time of envelope (ms);
#P button 391 133 15 0;
#P number 451 250 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 529 270 33 196617 clear;
#P message 451 269 70 196617 setdomain $1;
#P user function 454 294 654 394 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 49.436165 0.893333 0;
#X add 362.53183 0. 0;
#X add 370.771271 1. 0;
#X add 444.925476 0.053333 0;
#X add 502.6 0.893333 0;
#X add 799.217957 0. 0;
#X add 799.217957 1. 0;
#X add 922.808655 0. 0;
#X add 931.047974 1. 0;
#X add 1549. 0. 0;
#X domain 1549.;
#X range 0. 1.;
#X done;
#P user meter~ 523 472 603 485 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P user gain~ 375 392 24 100 158 0 1.071519 7.94321 10.;
#P number 432 181 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 430 202 27 196617 f;
#P number 393 181 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 394 202 27 196617 f;
#P number 349 181 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 361 202 27 196617 f;
#P newex 370 234 66 196617 pack 0. 0. 0.;
#P message 375 260 56 196617 $1 , $2 $3;
#P newex 375 290 32 196617 line~;
#P newex 451 401 32 196617 line~;
#P newex 375 361 27 196617 *~;
#P newex 375 316 40 196617 cycle~;
#N vpreset 3;
#X append 1 2 8 256 126 number int 727 ; 14 180 16 number int 199 ; 16 180 60 number int 67 ; 18 180 99 number int 45 ; 19 391 37 gain~ list 112 10. ; 30 181 349 number;
#X append 1 2 int 127 ; 32 181 393 number int 98 ; 34 181 432 number int 1 ; 35 392 375 gain~ list 124 10. ; 37 294 454 function clear ; 37 294 454 function add 0. 0. 0 ;;
#X append 1 2 37 294 454 function add 18.234041 1. 0 ; 37 294 454 function add 592.606384 0. 0 ; 37 294 454 function add 610.840393 0.986667 0 ; 37 294 454 function add 875.234009 0. 0 ; 37 294 454 function;
#X append 1 2 add 884.351013 1. 0 ; 37 294 454 function add 1121.393555 0. 0 ; 37 294 454 function add 1130.51062 0.96 0 ; 37 294 454 function add 1714. 0. 0 ; 37 294 454 function domain 1714. ; 37 294 454;
#X append 1 2 function range 0. 1. ; 40 250 451 number int 1714 ; 47 394 759 gain~ list 113 10. ; 49 192 896 function clear ; 49 192 896 function add 0. 0. 0 ; 49 192 896 function add;
#X append 1 2 18.180855 1. 0 ; 49 192 896 function add 590.877808 0. 0 ; 49 192 896 function add 609.058533 0.986667 0 ; 49 192 896 function add 872.680603 0. 0 ; 49 192 896 function add 881.770935 1. 0 ;;
#X append 1 2 49 192 896 function add 1118.122437 0. 0 ; 49 192 896 function add 1127.212036 0.96 0 ; 49 192 896 function add 1709. 0. 0 ; 49 192 896 function domain 1709. ; 49 192 896 function range 0.;
#X append 1 2 1. ; 52 140 897 number int 1709 ; 55 197 715 function clear ; 55 197 715 function add 44.51049 70.175438 0 ; 55 197 715 function domain 1273. ; 55 197 715 function range 0. 200. ; 58 150 719;
#X append 1 2 number int 1273 ;;
#X append 2 2 8 256 126 number int 1407 ; 14 180 16 number int 184 ; 16 180 60 number int 210 ; 18 180 99 number int 56 ; 19 391 37 gain~ list 112 10. ; 30 181 349 number;
#X append 2 2 int 299 ; 32 181 393 number int 195 ; 34 181 432 number int 309 ; 35 392 375 gain~ list 124 10. ; 37 294 454 function clear ; 37 294 454 function add 63.819138 1. 2 ;;
#X append 2 2 37 294 454 function add 255.276535 0.026667 0 ; 37 294 454 function add 264.393646 0.906667 0 ; 37 294 454 function add 455.851044 0.013333 0 ; 37 294 454 function add 629.074463 1. 0 ; 37 294 454 function;
#X append 2 2 add 993.75531 1. 0 ; 37 294 454 function add 993.75531 0. 0 ; 37 294 454 function add 1148.744629 0.013333 0 ; 37 294 454 function add 1157.861694 1. 0 ; 37 294 454 function add 1358.436279 0.306667 0;
#X append 2 2 ; 37 294 454 function add 1714. 0. 0 ; 37 294 454 function domain 1714. ; 37 294 454 function range 0. 1. ; 40 250 451 number int 1714 ; 47 394 759 gain~ list 113 10. ;;
#X append 2 2 49 192 896 function clear ; 49 192 896 function add 0. 0. 0 ; 49 192 896 function add 18.180855 1. 0 ; 49 192 896 function add 590.877808 0. 0 ; 49 192 896 function add 609.058533 0.986667;
#X append 2 2 0 ; 49 192 896 function add 872.680603 0. 0 ; 49 192 896 function add 881.770935 1. 0 ; 49 192 896 function add 1118.122437 0. 0 ; 49 192 896 function add 1127.212036 0.96 0 ; 49 192 896;
#X append 2 2 function add 1709. 0. 0 ; 49 192 896 function domain 1709. ; 49 192 896 function range 0. 1. ; 52 140 897 number int 1709 ; 55 197 715 function clear ; 55 197 715 function add 35.608391;
#X append 2 2 175.438599 0 ; 55 197 715 function add 338.279724 7.017544 0 ; 55 197 715 function add 356.083923 126.315788 0 ; 55 197 715 function add 543.027954 80.701752 0 ; 55 197 715 function domain 1273. ; 55 197 715;
#X append 2 2 function range 0. 200. ; 58 150 719 number int 1273 ;;
#X append 3 2 8 256 126 number int 1980 ; 14 180 16 number int 17 ; 16 180 60 number int 440 ; 18 180 99 number int 1565 ; 19 391 37 gain~ list 112 10. ; 30 181 349 number;
#X append 3 2 int 127 ; 32 181 393 number int 98 ; 34 181 432 number int 1 ; 35 392 375 gain~ list 124 10. ; 37 294 454 function clear ; 37 294 454 function add 0. 0. 0 ;;
#X append 3 2 37 294 454 function add 18.234041 1. 0 ; 37 294 454 function add 592.606384 0. 0 ; 37 294 454 function add 610.840393 0.986667 0 ; 37 294 454 function add 875.234009 0. 0 ; 37 294 454 function;
#X append 3 2 add 884.351013 1. 0 ; 37 294 454 function add 1121.393555 0. 0 ; 37 294 454 function add 1130.51062 0.96 0 ; 37 294 454 function add 1714. 0. 0 ; 37 294 454 function domain 1714. ; 37 294 454;
#X append 3 2 function range 0. 1. ; 40 250 451 number int 1714 ; 47 394 759 gain~ list 113 10. ; 49 192 896 function clear ; 49 192 896 function add 0. 0. 0 ; 49 192 896 function add;
#X append 3 2 24.957453 1. 0 ; 49 192 896 function add 811.11731 0. 0 ; 49 192 896 function add 836.07489 0.986667 0 ; 49 192 896 function add 1197.957031 0. 0 ; 49 192 896 function add 1404.408081 0. 0 ;;
#X append 3 2 49 192 896 function add 1420.36731 0.953125 0 ; 49 192 896 function add 1771.46936 0. 0 ; 49 192 896 function add 1787.428589 0.984375 0 ; 49 192 896 function add 2346. 0. 0 ; 49 192 896 function;
#X append 3 2 domain 2346. ; 49 192 896 function range 0. 1. ; 52 140 897 number int 2346 ; 55 197 715 function clear ; 55 197 715 function add 24.027969 168.421051 0 ; 55 197 715 function add 432.503448 164.912277;
#X append 3 2 0 ; 55 197 715 function add 444.517395 84.210526 0 ; 55 197 715 function add 889.03479 84.210526 0 ; 55 197 715 function add 1009.1745 171.929825 0 ; 55 197 715 function add 1597.860229 157.894745 0 ; 55 197 715;
#X append 3 2 function add 1693.971924 119.298248 0 ; 55 197 715 function domain 1718. ; 55 197 715 function range 0. 200. ; 58 150 719 number int 1718 ;;
#P preset 273 44 47 27;
#P user meter~ 135 512 215 525 50 0 168 0 103 103 103 255 153 0 255 0 0 217 217 0 153 186 0 12 3 3 3 3;
#P message 139 652 33 196617 start;
#P user gain~ 37 391 24 100 158 0 1.071519 7.94321 10.;
#P number 99 180 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 97 201 27 196617 f;
#P number 60 180 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 61 201 27 196617 f;
#P number 16 180 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 28 201 27 196617 f;
#P newex 37 233 66 196617 pack 0. 0. 0.;
#P message 37 259 56 196617 $1 , $2 $3;
#P newex 37 289 32 196617 line~;
#P button 70 123 15 0;
#P number 126 256 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 118 285 27 196617 f;
#P message 118 311 44 196617 1 , 0 $1;
#P newex 118 335 32 196617 line~;
#P newex 37 360 27 196617 *~;
#P newex 37 315 40 196617 cycle~;
#P newex 183 663 31 196617 dac~;
#P comment 115 238 121 196617 time of envelope (ms);
#P comment 99 162 100 196617 time it takes to slide;
#P connect 9 0 13 0;
#P connect 13 0 12 0;
#P connect 12 0 11 0;
#P connect 11 0 10 0;
#P connect 10 0 3 0;
#P connect 3 0 4 0;
#P connect 4 0 19 0;
#P connect 14 0 13 1;
#P connect 5 0 4 1;
#P connect 9 0 15 0;
#P connect 15 0 12 1;
#P connect 16 0 15 1;
#P connect 17 0 12 2;
#P connect 9 0 17 0;
#P connect 18 0 17 1;
#P connect 9 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 5 0;
#P connect 8 0 7 1;
#P connect 19 0 21 0;
#P connect 47 0 2 0;
#P connect 35 0 2 0;
#P connect 19 0 2 0;
#P connect 20 0 2 0;
#P connect 47 0 2 1;
#P connect 35 0 2 1;
#P connect 19 0 2 1;
#P connect 41 0 29 0;
#P connect 29 0 28 0;
#P connect 28 0 27 0;
#P connect 27 0 26 0;
#P connect 26 0 23 0;
#P connect 23 0 24 0;
#P connect 24 0 35 0;
#P connect 30 0 29 1;
#P connect 25 0 24 1;
#P connect 41 0 31 0;
#P connect 31 0 28 1;
#P connect 32 0 31 1;
#P connect 33 0 28 2;
#P connect 41 0 33 0;
#P connect 34 0 33 1;
#P connect 40 0 38 0;
#P connect 37 1 25 0;
#P connect 41 0 37 0;
#P connect 38 0 37 0;
#P connect 39 0 37 0;
#P connect 35 0 36 0;
#P connect 53 0 55 0;
#P connect 56 0 55 0;
#P connect 57 0 55 0;
#P connect 58 0 56 0;
#P connect 55 1 46 0;
#P connect 46 0 43 0;
#P connect 43 0 44 0;
#P connect 44 0 47 0;
#P connect 45 0 44 1;
#P connect 53 0 49 0;
#P connect 51 0 49 0;
#P connect 50 0 49 0;
#P connect 52 0 50 0;
#P connect 49 1 45 0;
#P connect 47 0 48 0;
#P pop;

#68448

You must be logged in to reply to this topic.