once again: a simple sampler
hello folks,
i'm nearly afraid to ask but DSP in max is so new to me, that i don't even know where to begin searching:
i'm building a sequencer with 12 sequences / tracks – each sequence spits out notes (+duration, vel.. the usual). know how to to that – now i'd like for each sequence / track to play one individual sample. this sample should be pitched according to the note it receives. i'd love for every (one of these 12) samples to have an adjustable envelope. i'd love a very low CPU load (:
1) should i use play~ or groove~?
2) how can i get poly~ into the game?
i've started with the tutorial "sampling with adsr" and i've managed to replace the [groove~] with [play~] (wow!), how ever poly~ only allocated voices for my one sample in this example. would i simply put 12 poly-encapsulations into one big poly?
sorry for being to bold on this. any hint or link would be much appreciated.
when you say pitched : you mean vari-speed or pitchshift ? In max 7 both are possible with groove~, however the pitchshift will use significantly more cpu ; play~ may be more cpu efficient if you just want varispeed since you can input control data without needing signal. It seems less easy to loop with play~. I've always used groove~ more so i can't really compare accurately, groove~ seems globally more potent.
Then about poly : do you want one track to play possibly several samples at once ? If not then just what you are doing is fine : with 12 voices of poly, you can send to one voice (with target message) a "set anotherbuffer" the sample you want. You probably just need 1 poly with 12 voices ?
hello vichug,
thanks for your detailed help!
1) i do mean "pitched" – no vari-speed necessary.
2) i don't need any looping functionality
3) as for poly: i'd like each of the 12 tracks to play one individual sample. so track1 -> sample1, track2 -> sample2 etc.. how ever i would like each track to be polyphonic up to lets say 4 voices.. meaning, if track1 plays sample1 twice (or four times) in a very short period of time, i don't want the voices to "steal" one another. furthermore, in my microscopic knowledge i suppose that my wish for one ADSR envelope per sample / track may be difficult to achieve when only using one play~ object (and reassigning / setting new buffers to it). this is where i drop out – cause with the little clue i have of poly~ encapsulations, i suppose i'd need 12 poly~ encapsulations (one for each track, playing up to 4 voices of one sample) inside one "big" poly~ encapsulation. but that is not correct, is it?
thanks again!
hmmm theorically you just need one poly~ (so one patch) with 48 voices ! Because poly~ makes polyphony, and as long as you have your sampling playback patch it doenst' know if it is affected to a particular track or not. Moreover since there is thispoly~ to stop cpu when a voice is unused, it shouldn't be a problem to have 48 voices.
And to each of these 48 instances, you can send a "set [soundfile]" to change the soundfile played. Same goes for the adsr enveloppe i think ; if you use a adsr~ object you can send different values for each instance.
About the varispeed now : what i mean is that varispeed is eaiser on the computer than "pitched" - varispeed will change both the tone and speed of playback, and it's as simple for the groove~ object as slowing down manually a 33" vinyl on a platine - very simple for computer. Whereas changing ONLY the pitch will eat your cpu because theres a lot more computation required. But if you need that so be it ; and the groove~ object will really help you there.
"one ADSR envelope per sample / track may be difficult to achieve when only using one play~ object"
It is not possible that you use only one play~ - you'll need one play~ for each sound you hear played at a time, and from what i understand it's a maximum of 48 - you can have a different adsr enveloppe per voice if you so wish
hei vichug,
thanks again so much! really helping me out!
as for pitch: hehe.. i DO mean change tone AND time.. so no time-stretching or anything a like (meaning, i want to make the sample "shorter" if it get's higher in key).
now, as for [poly~]: .. does that mean, i basically make *one* single poly~ encapsulation with *one* play~ (or groove~) inside and also only *one* ADSR – and then i set my poly~ to allow 48 voices, correct? damn, i really have to understand poly~ better... i can grasp how to determine which sample is played by my 48-fold poly~ object (suppose i can simply do that by setting the buffer according to which of the 12 seqences is sending a note), how ever i don't have a clue about the logic behind setting individual ADSRs.
you're all correct !
the logic is quite easy for setitng individually values for adsr : -well, it depends if you do use the adsr~ object... cause with this object : it has 5 inlets, the first for triggering the enveloppe and overall amplitude, the second is attack, the third is decay, fourth sustain, fifth release... so from there : you input those values preceded by a "target" - it's up to you if you use individual inlet for each value, or one list that will be parsed by each instance. Some people say the target message doesn't always work, in my experience i didn't have so much trouble. Note that you can use target to any inlet of poly~.
If you use other object for enveloppe, a similar logic may apply.
thanks so much for your help! really got me started :)