Forums > MaxMSP

Quantizing Loop Start/End Changes in Sample Playback?

March 12, 2008 | 3:35 am

Hey everyone, I am new to both the Max program and forums, and was looking for a method to quantize start/end changes in sample playback. I have a sample that is 3600 seconds long (4/4 at 900ms per beat, 66bpm). I want to be able to change the start/end times, but in sync with the beat. I know, I could just count and make the changes accurately, but I figure that if it’s digital, there must be a way to make it perfect. Plus in the future, it would be handy to be able to make a tempo change a couple beats before you want the change to take place if you are controlling multiple patches in a live setting.

So, currently I am using either select 0 or 127 w/ midi buttons as ctlin to change the start/end time. I thought about using int to store the numbers and then a metro at 900 to send the info at a quantized time, but the problem is the bang from the metro sends ALL the int’s at once, so nothing actually changes. I am looking to send bangs only to ints that have changed. Any suggestions?

Thanks for any input.


March 12, 2008 | 12:21 pm

For those who might be interested, I was able to use switches in combination with select/metro 900 to make sure the start/end changes take place on a quarter note every time. However, you have to hit each end/start change twice, once to initiate the change, and once to turn off the change so that the other change can take place. Here’s the patch:

max v2;
#N vpatcher 760 45 1651 774;
#P window setfont "Sans Serif" 9.;
#P newex 303 145 46 196617 select 0;
#P newex 196 147 58 196617 select 127;
#P newex 456 193 58 196617 select 127;
#P newex 638 158 46 196617 select 0;
#P message 471 312 34 196617 3600;
#P button 526 262 15 0;
#P newex 581 145 58 196617 select 127;
#P user gswitch 567 212 41 32 0 0;
#P number 586 104 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 585 61 53 196617 ctlin a 18;
#P button 400 293 15 0;
#P user gswitch 400 243 41 32 1 0;
#P newex 394 183 46 196617 select 0;
#P number 446 142 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 445 99 53 196617 ctlin a 16;
#P message 370 318 34 196617 2700;
#P button 291 245 15 0;
#P user gswitch 291 195 41 32 0 0;
#P number 358 95 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 336 51 53 196617 ctlin a 19;
#P message 291 292 34 196617 1800;
#P button 140 248 15 0;
#P toggle 33 33 15 0;
#P newex 64 65 58 196617 metro 900;
#P button 75 114 15 0;
#P user gswitch 140 198 41 32 1 0;
#P message 205 305 19 196617 -1;
#P newex 34 399 48 196617 loadbang;
#P newex 140 148 46 196617 select 0;
#P message 233 285 14 196617 0;
#P number 207 98 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 185 54 53 196617 ctlin a 13;
#P newex 529 355 40 196617 / 127.;
#P flonum 557 327 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 561 295 56 196617 ctlin a 20;
#P window setfont "Fixedwidth Serif" 10.;
#N vpatcher 312 179 515 388;
#P window setfont Times 10.;
#P comment 15 153 47 1310730 Channel 1;
#P comment 63 153 47 1310730 Channel 2;
#P comment 114 27 47 1310730 Amplitude;
#P comment 61 27 47 1310730 Channel 2;
#N comlet (signal) Channel 2;
#P outlet 77 138 15 0;
#N comlet (signal) Channel 1;
#P outlet 29 138 15 0;
#P window setfont "Fixedwidth Serif" 10.;
#P message 157 63 26 1441802 100;
#P newex 129 82 38 1441802 line~;
#P newex 77 113 39 1441802 *~;
#P newex 29 113 39 1441802 *~;
#N comlet (float) Amplitude;
#P inlet 129 41 15 0;
#N comlet (signal) Channel 2;
#P inlet 77 41 15 0;
#N comlet (signal) Channel 1;
#P inlet 29 41 15 0;
#P window setfont Times 10.;
#P comment 14 27 47 1310730 Channel 1;
#P connect 1 0 4 0;
#P connect 4 0 8 0;
#P fasten 6 0 4 1 134 103 63 103;
#P connect 2 0 5 0;
#P connect 5 0 9 0;
#P fasten 6 0 5 1 134 108 111 108;
#P connect 3 0 6 0;
#P fasten 3 0 7 0 134 59 162 59;
#P connect 7 0 6 1;
#P pop;
#P newobj 261 469 92 1441802 p stereoamp~;
#P window setfont "Sans Serif" 9.;
#P message 102 434 93 196617 read VibesinC.wav;
#P user ezdac~ 258 523 302 556 0;
#P window setfont Times 10.;
#P comment 175 353 48 1310730 Start time;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 169 367 60 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont Times 10.;
#P comment 384 353 67 1310730 Loop end time;
#P comment 317 353 67 1310730 Loop start time;
#P comment 242 353 67 1310730 Playback speed;
#P window setfont "Fixedwidth Serif" 10.;
#P flonum 386 366 60 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 321 367 60 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 245 367 60 10 0 0 0 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 245 386 32 1441802 sig~;
#P window setfont Times 10.;
#P comment 109 353 41 1310730 Looping;
#P toggle 121 367 15 0;
#P window setfont "Fixedwidth Serif" 10.;
#P message 121 388 50 1441802 loop $1;
#P flonum 464 367 49 10 0. 1. 3 22 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 245 411 142 1441802 groove~ VibesinC.wav 2;
#B color 5;
#P window setfont Times 10.;
#P comment 464 353 49 1310730 Amplitude;
#P window setfont "Sans Serif" 9.;
#P newex 95 493 107 196617 buffer~ VibesinC.wav;
#P newex 353 144 58 196617 select 127;
#P connect 6 0 32 0;
#P connect 32 0 31 0;
#P connect 31 0 30 0;
#P connect 18 0 1 0;
#P connect 27 0 18 0;
#P connect 6 0 5 0;
#P connect 24 0 26 0;
#P connect 53 0 29 0;
#P connect 26 0 29 0;
#P connect 29 0 33 0;
#P connect 30 0 29 2;
#P connect 24 0 53 0;
#P connect 27 0 28 0;
#P connect 23 0 24 0;
#P connect 33 0 25 0;
#P connect 28 0 9 0;
#P connect 9 0 8 0;
#P fasten 15 0 3 0 174 407 250 407;
#P fasten 5 0 3 0 126 407 250 407;
#P connect 8 0 3 0;
#P connect 19 0 17 0;
#P connect 3 0 19 0;
#P connect 54 0 37 0;
#P connect 0 0 37 0;
#P connect 37 0 38 0;
#P connect 38 0 34 0;
#P connect 19 0 17 1;
#P connect 3 1 19 1;
#P connect 36 0 54 0;
#P fasten 10 0 3 1 326 385 316 385;
#P connect 30 0 37 2;
#P connect 34 0 10 0;
#P connect 25 0 10 0;
#P connect 4 0 19 2;
#P connect 36 0 0 0;
#P connect 35 0 36 0;
#P connect 44 0 39 0;
#P fasten 11 0 3 2 391 385 382 385;
#P connect 50 0 11 0;
#P connect 39 0 11 0;
#P connect 41 0 42 0;
#P connect 52 0 43 0;
#P connect 42 0 43 0;
#P connect 43 0 44 0;
#P connect 30 0 43 2;
#P connect 40 0 41 0;
#P connect 41 0 52 0;
#P connect 22 0 4 0;
#P connect 49 0 50 0;
#P connect 47 0 49 0;
#P connect 21 0 22 0;
#P connect 20 0 21 0;
#P connect 51 0 47 0;
#P connect 48 0 47 0;
#P connect 46 0 48 0;
#P connect 45 0 46 0;
#P connect 30 0 47 2;
#P connect 46 0 51 0;
#P pop;


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