Function with sustain in poly~

branton olfert's icon

Hello lovely Max folks,

I'm sure some of you have seen this before but after looking at what I assume is anything related to this topic i've still not found a single working version of how to implement sustain using function (not interested in adsr~) inside of poly~.

I've seen many suggestions about using adsr~ but the idea that function has well (more functionality) is what i'm after. I understand how to use sustain in a mono setting with things like note on/off in tandem with the "next" message but how to get that into a poly~ is beyond me.

Quick rundown: looking to create a simple FM synth with Fm env and Amp env that function in a standard adsr+ way (play midi note and it makes lovely sharp sounds), but also will be aiming to have a hold/sustain/latch setting that loops wherever function has set those points.

Would love some assistance on this one!

FM Poly~ voice

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

Main Patcher

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

Bradley Korth's icon

Well, I don't entirely know how your patch works by looking at it, but I did notice that voices aren't specified when it receives notes. I wonder if you might like just simply having control of which poly~ voice plays. [poly] without the ~ can also handle voice management separately. Perhaps with that, you can create sustains by filtering out voice off messages depending on voice number.

But I'm not sure this fixes it. Did I miss something?

branton olfert's icon

Yeah poly is definitely an option. I guess my only thing there is that i'm kind of limited in # of voices. Not the end of the world as I could manage all of the enveloping for each voice but was hoping to use poly~ specifically.

branton olfert's icon

Okay after about a week of tinkering I've sorted this out! For anyone interested i've included the patch below! I haven't put this thing through any extensive tests but after playing with it for a while it seems to be stable.

FM Voice with Function as Envelope including Sustain

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

Simple FM Synth

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

Happy patching!