Forums > MaxMSP

Less CPU heavy form of sample playback

January 16, 2008 | 9:15 pm

I apologise for my barrage of posts today but i’m having some really bad last minute problems now my patch is starting to come together. I’ve got 8 sample playback sections in my drum machine patch each using sfplay~, which is triggered by a step sequencer i made. Is there a less CPU heavy way of playing back samples with the following controls:

1. pitch control.
2. the ability to set sample start and end points using the waveform object.

play~ does the second but has no pitch control. groove~ does both but only allows you to set start and end points when in loop mode – something i dont want. sfplay~ appears to do both but at the cost of my CPU – when i have 6 of my 8 samples running Max is clocking up over 30% of my CPU and this causes some annoying timing issues.

Is there an object im overlooking??


January 16, 2008 | 10:57 pm

I think play~ can do what you wan’t with a line~ – have a look at the
help file. You’ll have to do some math yourself though. info~ will give
you the necessary information like the lenght of your buffer~ and such.
Hope this helps.

/Jakob

jr.abstractions for MaxMSP – new version (2008-01-15)

http://www.sonicescape.net/maxmsp/


January 16, 2008 | 11:35 pm

would i be able to get both the start and end point values AND pitch values into the one input of play~? ive attached what i have so far.


January 16, 2008 | 11:48 pm

Stefan Scheuregger schrieb:
> play~ does the second but has no pitch control.

This isn’t true, you can pitch control play~, by defining the speed to
go from start to end…

> groove~ does both but only allows you to set start and end points
> when in loop mode

This isn’t true, you can start with the startloop message and have some
detection for finding the end (==~ 1 -> edge~) to stop the playback
without being in loop mode…

Stefan


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


January 17, 2008 | 6:27 am

Stefan Scheuregger schrieb:
> would i be able to get both the start and end point values AND pitch
> values into the one input of play~? ive attached what i have so far.

I can’t read your attachment, please copy paste instead. Should be in
the FAQ…


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


January 17, 2008 | 9:43 am

Thank you for your advice. Using the edge~ object works fine until i adjust the end point of the loop, then it gets stuck in loop mode and i get no bang from edge~. Any ideas?

max v2;
#N vpatcher 255 120 855 520;
#P origin 0 34;
#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 326 206 27 196617 i;
#P newex 288 206 27 196617 i;
#P newex 317 152 30 196617 t b b;
#P newex 183 442 36 196617 edge~;
#P newex 183 404 40 196617 ==~ 0.;
#P button 88 373 15 0;
#P newex 136 154 48 196617 loadbang;
#P button 191 177 15 0;
#P message 160 259 29 196617 stop;
#P toggle 136 177 15 0;
#P message 136 202 41 196617 loop $1;
#P message 191 202 51 196617 startloop;
#P newex 183 380 46 196617 change~;
#P newex 388 279 29 196617 sig~;
#P message 43 23 43 196617 replace;
#P flonum 388 111 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 423 195 27 196617 + 0.;
#P flonum 457 111 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 388 257 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P inlet 457 84 15 0;
#P number 331 111 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 283 111 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N comlet set waveform;
#P outlet 43 135 15 0;
#P message 43 112 93 196617 set mysample01 1;
#N comlet loop max;
#P inlet 331 77 15 0;
#N comlet loop min;
#P inlet 283 77 15 0;
#N comlet replace;
#P inlet 43 1 15 0;
#N comlet pitch dial in;
#P inlet 388 85 15 0;
#P outlet 235 350 15 0;
#N comlet start in;
#P inlet 191 40 15 0;
#P newex 235 312 107 196617 groove~ mysample01;
#B color 5;
#P window linecount 2;
#P newex 43 56 64 196617 buffer~ mysample01;
#B color 15;
#P window linecount 1;
#P comment 208 40 42 196617 start in;
#P comment 405 85 40 196617 pitch in;
#P window linecount 2;
#P comment 21 150 100 196617 output here sets waveform;
#P connect 8 0 20 0;
#P connect 20 0 3 0;
#P connect 3 1 11 0;
#P connect 11 0 12 0;
#P fasten 31 0 29 0 188 469 132 469 132 356 93 356;
#P connect 28 0 25 0;
#P connect 25 0 24 0;
#P fasten 29 0 26 0 93 394 75 394 75 241 165 241;
#P connect 4 0 22 0;
#P connect 22 0 30 0;
#P connect 30 0 31 0;
#P connect 5 0 27 0;
#P connect 27 0 23 0;
#P connect 24 0 4 0;
#P fasten 21 0 4 0 393 300 240 300;
#P connect 23 0 4 0;
#P connect 26 0 4 0;
#P connect 4 0 6 0;
#P connect 9 0 13 0;
#P connect 33 0 4 1;
#P fasten 32 0 33 0 322 188 293 188;
#P connect 13 0 33 1;
#P connect 5 0 32 0;
#P connect 32 1 34 0;
#P connect 10 0 14 0;
#P connect 34 0 4 2;
#P connect 14 0 34 1;
#P connect 7 0 19 0;
#P connect 19 0 16 0;
#P fasten 18 0 16 0 428 230 393 230;
#P connect 16 0 21 0;
#P connect 17 0 18 0;
#P connect 19 0 18 1;
#P connect 15 0 17 0;
#P pop;


January 17, 2008 | 9:42 pm

Here is a solution using play~, better control than with groove~ if you ask me…

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 268 315 53 196617 Loop / End;
#P comment 99 236 40 196617 Play;
#P hidden newex 311 230 60 196617 loadmess 1;
#P comment 252 236 53 196617 Loopmode;
#P button 253 314 15 0;
#P user gain~ 100 344 24 100 158 0 1.071519 7.94321 10.;
#P user ezdac~ 100 486 144 519 0;
#P newex 100 314 95 196617 play~ mysample01;
#B color 5;
#P number 252 247 44 9 0 2 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#N vpatcher 301 306 633 644;
#N comlet (float) , Speed;
#P inlet 191 25 15 0;
#P window setfont "Sans Serif" 9.;
#P message 225 84 64 196617 loopmode $1;
#N comlet (int) , Loopmode 0:no loop , 1:loop , 2:back & forth;
#P inlet 225 26 15 0;
#N comlet bang when loop/end;
#P outlet 80 235 15 0;
#P newex 38 181 53 196617 zigzag~;
#N comlet line~;
#P outlet 38 234 15 0;
#P newex 112 86 41 196617 !- 0.;
#P newex 38 131 36 196617 zl reg;
#P newex 64 109 60 196617 pack f 0 f f;
#N comlet (float) , EndPoint (ms);
#P inlet 96 23 15 0;
#N comlet (float) , StartPoint (ms);
#P inlet 64 23 15 0;
#N comlet bang = play;
#P inlet 38 23 15 0;
#P connect 0 0 4 0;
#P fasten 10 0 7 0 158 141;
#P connect 4 0 7 0;
#P connect 7 0 6 0;
#P connect 1 0 3 0;
#P connect 3 0 4 1;
#P connect 7 3 8 0;
#P fasten 11 0 7 1 125 159;
#P connect 2 0 3 2;
#P connect 1 0 5 0;
#P connect 5 0 3 3;
#P connect 2 0 5 1;
#P connect 9 0 10 0;
#P pop;
#P newobj 100 285 163 196617 p zigzag~;
#P flonum 214 247 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P button 100 247 15 0;
#P user waveform~ 62 118 200 74 3 9;
#W mode select;
#W mouseoutput continuous;
#W unit ms;
#W grid 1000.;
#W ticks 0;
#W labels 1;
#W vlabels 0;
#W vticks 1;
#W bpm 120. 4.;
#W frgb 33 0 0;
#W brgb 60 178 173;
#W rgb2 0 95 255;
#W rgb3 0 0 0;
#W rgb4 0 0 0;
#W rgb5 190 137 255;
#W rgb6 100 100 100;
#W rgb7 100 100 100;
#P message 10 30 43 196617 replace;
#P message 62 97 93 196617 set mysample01 1;
#P window linecount 3;
#P newex 10 51 62 196617 buffer~ mysample01 jongly.aif;
#B color 15;
#P window linecount 1;
#P comment 214 236 40 196617 Speed;
#P hidden connect 14 0 6 0;
#P hidden connect 14 0 8 0;
#P connect 11 0 10 0;
#P connect 11 0 10 1;
#P connect 1 1 2 0;
#P connect 3 0 1 0;
#P connect 2 0 4 0;
#P connect 8 0 7 4;
#P connect 6 0 7 3;
#P connect 7 0 9 0;
#P connect 7 1 12 0;
#P connect 9 0 11 0;
#P connect 4 3 7 2;
#P connect 4 2 7 1;
#P connect 5 0 7 0;
#P window clipboard copycount 17;


January 18, 2008 | 8:43 am

Stefan Scheuregger schrieb:
> Thank you for your advice. Using the edge~ object works fine until i
> adjust the end point of the loop, then it gets stuck in loop mode and
> i get no bang from edge~. Any ideas?

You have to connect the detection to the right outlet. Its called sync
outlet for a reason. Study the help files…

Stefan


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


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