Skip to main content
2 of 2
minor formatting: link + symbols
Gilles
  • 3.4k
  • 3
  • 23
  • 29

Help with equations for exponential ADSR envelope

With application code, I have implemented a linear ADSR envelope for shaping the amplitude of an oscillator's output. The parameters for attack, decay and release duration as well as sustain level can be set on the envelope and everything works as expected.

However, I would like to tweak the ramp shapes of the envelope to something that resembles what most synthesizers use for a more natural response: inverse exponential for the attack and exponential for the decay and release. I am having trouble getting my formulas right for calculating the envelope output values for these types of ramp shapes. To calculate the linear ramps, I am using the two-point form, plugging in the start/end $x$/$y$ values which are derived from the attack/decay/sustain/release input parameter values. I cannot seem to work out the correct formula for exponential (standard and inverse) ramps using the same start/end $x$/$y$ point values.

I have saved a Desmos Graphing Calculator session that demonstrates the approach for linear ramps that I described above.

If anyone can help point me in the right direction, it would be much appreciated.

Gary DeReese
  • 311
  • 1
  • 2
  • 5