[sdiy] Dealing with velocity sensitivity / scaling on envelopes

Tim Ressel timr at circuitabbey.com
Thu Aug 31 20:34:44 CEST 2017

Think about how a string instrument would work: when you put you 
finger/pick on the string to play the new soft note, it quickly dampens 
the string to zero. You don't want to drop to zero instantly; that will 
pop. Perhaps thinking in terms of muting: decay the signal to zero in 
10-20mS, then start the attack on the next note.


On 8/31/2017 11:16 AM, Tom Wiltshire wrote:
> Hi all,
> I’m writing some code for a velocity-sensitive envelope generator. This throws up a few issues I haven’t had to deal with before.
> Usually, I’d store what level the envelope is outputting when the Gate goes high or low. This information can then be used to scale and offset the Attack stage so that it starts from the last output value rather than dropping abruptly to zero in order to start a new attack. This is how the CEM/SSM analog envelope generator chips worked, so I copied the existing behaviour. Same with the Release stage. Perhaps the Gate goes low during a long Decay, or even during a long Attack - we want the Release stage to be scaled so it drops to zero from there, not to always start at the Sustain level. It’s a simple question of making sure that the output is a nice continuous line with no abrupt jumps in it (unless you set up a 1msec attack!).
> However…this doesn’t work so nicely when you start including velocity scaling. Imagine the following scenario:
> I play a loud note with Sustain at maximum and a very long Release. Then I let go of the note (Gate goes low, long release starts) and play another very softly. The last output level is very close to maximum amplitude, since the Release time is long and it hasn’t dropped much yet. But the new note is very quiet and even the maximum Attack level could well be far less than the current output.
> So what should I do? Attacking downwards seems completely wrong. Jumping abruptly to zero and then attacking up to a much quieter note completely chops off the long release of the previous note. Are there other options?
> Has anyone else come up against this? What did you decide? How do modern monosynths that include velocity sensitivity deal with it? What does Moog do, for example?
> Thanks,
> Tom
> ==================
>         Electric Druid
> Synth & Stompbox DIY
> ==================
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy

--Tim Ressel
Circuit Abbey
timr at circuitabbey.com

More information about the Synth-diy mailing list