Linear AD Envelope Generator

Apr 25, 2013 at 4:20pm

Linear AD Envelope Generator

Hi guys, I’m trying to hack together a simple 2 step Envelope Generator (AD) from the 7-step envelope generator example patch. I’m trying to make it react exactly like the ADSR~ object with Sustain and Release set to 0.

Unfortunately I can’t seem to make the envelope retrigger without first sending a zero value.
Also I can’t seem to make it retrigger until the envelope has finished.

Is there a way to do this simply? Possibly more simply than the 7-stage envelope generator method, I feel it’s maybe overkill for a 2 step envelope.

Anyway, here’s what I have so far.

– Pasted Max Patch, click to expand. –
#67947
Apr 25, 2013 at 5:43pm

without gen~:
you can use e.g. function with line~  or curve~…

– Pasted Max Patch, click to expand. –
#244228
Apr 25, 2013 at 9:21pm

Thanks for your reply. I know several ways I can do it in MSP and this is a good one, but the point was to achieve it in gen so I can make a sample accurate envelope generator.

#244229
Apr 27, 2013 at 10:48am

like this?

– Pasted Max Patch, click to expand. –
#244230
Apr 27, 2013 at 3:29pm

Aha, thanks, I guess I can use a pulse train to get it out of the max and into MSP too.
Now I guess my only problem is how to get the envelope to reset to zero quickly if it is retriggered while it’s still ramping.
Any ideas?
I’m gonna have a rummage.

#244231
May 20, 2013 at 12:07am

Here’s a way of doing it. This is not as flexible as the seven stage envelope in terms of number of stages, but (I think) it has the same retriggering behavior as adsr~. I’ve also added the legato mode, which I find more useful for monosynths.

Also, you can prematurely short-circuit the attack (i.e. if you release the envelope before it’s reached the decay phase, it will decay from there)

I highly recommend checking out some of the threads on envelopes on kvraudio. I’ve found them greatly helpful.

FWIW, envelopes can be surprisingly hard to write, especially with features such as those found in adsr~. I’m working on an analog style ADSR now that has a retriggering model similar to the Moog mini. (where rapid retriggering of notes would cause an increase in volume)

For no-frill two-stage envelopes you can look at models that are much simpler: a pulse-wave generator (I’d look at sig~ 1 into +=~ into <~ 441 (to generate a 1 ms attack) and rampsmooth~ / slide~ to create the interpolation.

HTH

<code>

– Pasted Max Patch, click to expand. –

</code>

#249889

You must be logged in to reply to this topic.