how to change envelope parameters live
I'm currently using adsr~ to define the filter cutoff of a synth. When I change the decay time while the envelope is in the decay stage, I get nasty errors as the output jumps abruptly.
So I assume adsr~ doesn't really "decay" at a certain rate, but just computes the output as a function of time elapsed since the decay segment starts. I tried using ramp smooth~ to smooth the errors, but it doesn't sound great.
Ideally I'd like the envelope to decay at a rate defined by the decay time, and changing that during the decay segment will change the rate of decay rather than just jumping value
Is there another way to do envelopes?
there are several ways, for example you can also use buffers to play an envelope.
but i would not know offhand a method which let you easily change the parameters while it runs.
you would have to 1.) constantly update the data or samples from where there envelope is read, in the case of buffer, at signal rate, and 2.) smooth the mouse input so that it make sa nice curve (e.g. pack 0. 20. --- line~ --- rampsmooth~ 40., i am guessing here)
most synthesizers do not allow to update the envelope parameters while it is still read from it, and in man ycases this makes sense. if want to create something fresh, there is usually some brain work involved.
I guess the idea would be not to read the envelope or define it as a function but to define a rate of decay, attack etc. that was constantly updated... +=~ maybe? Analogue synths seem to work like this, I guess the decay of some capacitor is being altered.
Slide @slide up 1 @ slide down 1 ( or slightly higher values ) ?
Can you give me a slide~ example?
I nearly got it to work with groove~ and an adsr buffer~ but it involves a feeback loop so there is a small error. I dont know gen but i have a feeling it can handle signal loops?
i believe what you see in analog synths is that the segments are running individually.
this should be fine to build it in max like that, too.
just use 4 pieces of 2-point envelope and let them trigger each other.
if you now add some interpolation in time to the controls of the gain and parameters, you are almost there.
for time parameters it seems to be more difficult...
This patch works with messages, a timer, a delay, and a curve~. I made it to control sustain modulation, so it should help. Right now the decay updates during the attack phase, but a new decay message wouldn't change the rate of decay. It shouldn't be too hard to fix that though; you'd just have to add extra control on the timer. It has retrigger and voice muting already there.
Edit* here is the patch I use for my filter envelope, just forgot to post it
If you're interested, I just posted this and it may do what you want. It's a pair of constant-rate ADSR envelopes.