Sampler With Infinite Sustain Loop Till Release

pajama's icon

Hey Fellow Cyclists,
I'm hoping someone out there can help me find a solution to this. I would like to start playback of a sample using MIDI NoteON, then loop a section of the sample for it's sustain phase as long as no NoteOFF has been sent, then cue it's release phase once a MIDI NoteOFF is sent.

Any advice would be appreciated. Thank you mucho!

-PJ

ShelLuser's icon

Your post is kinda confusing to me. You placed this in the MaxMSP forum which makes me assume that we're talking Max patches here. But in your header you're referring to 'Sampler' which is also an instrument in Ableton Live. Thus making me wonder if you posted this in MaxMSP yet have a question about Max for Live.

Alas; it heavily depends on how you're playing the sample. Better put; with what.

Catching note on / off shouldn't be that hard; using midiparse you can easily get a list with the pitch and velocity; a mere unpack object should be enough to split them. When the value is higher than 0 its a note-on and when 0 its a note-off signal. An if object should be able to get your patch to do different things based on value.

But the process of playing the selection heavily depends on how you're playing the sample. Using M4L and a Sampler is different then using a buffer~ and play~ to actually play your stuff.

pajama's icon

Thanks for responding despite being confused! Sorry for not being so clear. I've had my coffee now.

This is strictly a Max 'Sampler' Patch I'm working on. My goal is to 'fakely' sustain an audio sample by looping its middle section while my MIDI keyboard is being pressed. I can interpret MIDI data from my keyboard to start and stop a loop using the [groove~] object, but I cant figure out how to cue the attack phase of my audio sample before going into the loop, and then the release phase once the MIDI key has been released.

I've already recorded my samples and have gotten the 'looping sustain' to work inside Kontakt but I am not aloud to use any software other than Max for this project.

Does this make it more clear? Thank you very much again for your response.

Roman Thilenius's icon

it is called "windowing".

you will play 2 of these samples in parallel, so that you can fade that "loop" in an out with any curve you like.

-110

pajama's icon

Thanks for the response Roman.
I'm having a hard time understanding the logic behind that. It seems like I would need three samples triggered in succession for that to work. One for attack, then sustain, then release. Am I understanding correctly?

I was hoping it would be as simple as setting the sustain loop for a sample and hooking up my keyboard. :D

Beep's icon

Depending on the sample your using, your gonna get a decay in the middle section, the part your sustaining. To mitigate that you can have two samples running and continually xfade between them to smooth out the dynamic, I think thats what Roman is getting at. Have you looked at xgroove~? Its a beefed up groove~ with added xfading for looping, that should smooth the dynamics out for you a bit, might mean you only have to use the one sample too. Here's the link.

Beep's icon

Oh and in regard to cuing up the different sections, attack, sustain and release, your gonna have to do that by specifying the part of the sample you want to play in milliseconds. i.e Attack play 0ms - 900ms, sustain loop 900ms - 5000ms, release 5000ms - end. Try looking at [waveform~], by dragging on the waveform you can define a loop section (your sustain), and by doing this also define where the attack ends and the release begins.

pajama's icon

Thank you Barry. I am starting to see a light at the end.

I'm assuming this method uses three groove~ objects. This raises another question for me. How would I get each groove~ to cue sequentially (from the appropriate midi messages) without any delay between one another? I'm gonna play around with this method and I'll post my patch if I can figure it out.

Thanks again all of you!

pajama's icon

Ok. Here is my attempt at cueing up three different play objects sequentially. I got the sustain section to loop and I got all three to cue up after one another, on time (it seems), but I can't figure out how to get rid of the clicks. Would there be some sort of crossfade? How should I implement that? Am I even going in the right direction here?

Max Patch
Copy patch and select New From Clipboard in Max.

Thank you very much for you help.

pajama's icon

Some crossfade action! I got it working enough for what I need. I love Max/MSP!

Max Patch
Copy patch and select New From Clipboard in Max.

Thanks again for your help.