Forums > Gen

Linear AD Envelope Generator

Apr 25 2013 | 4:20 pm

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. --

Apr 25 2013 | 5:43 pm

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

-- Pasted Max Patch, click to expand. --

Apr 25 2013 | 9:21 pm

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.

Apr 27 2013 | 10:48 am

like this?

-- Pasted Max Patch, click to expand. --

Apr 27 2013 | 3:29 pm

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.

May 20 2013 | 12:07 am

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.


-- Pasted Max Patch, click to expand. --


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

Forums > Gen