[sdiy] formula for exponential decay
Dana.Scott
danas at egosys.com
Thu Feb 15 21:48:44 CET 2001
To describe it mathematically is more difficult than just calculate it.
Just add one multiply to your code. Instead of subtracting a constant value
directly, first multiply it by how much of the envelope is left. For
example, at a 50% envelope level only subtract 50% of the constant.
-Dana
> Now, the program is designed to calculate the next envelope level by
> taking the current level and subtracting a constant which was computed
> from the user-selected decay setting and the fixed refresh time period
> (since the above formula produces a straight line graph, and the first
> derivative of that is a constant). If the decay setting changes, the
> periodic level change constant is recomputed and the envelope continues
> from its current point with the new decay rate. This method easily
> allows retrigger of the attack phase during decay, or the attack phase
> to be cut short and jump into the decay phase.
>
> It is at the point where I attempt to do the same thing for exponential
> decay that my atrophied math skills fail me...so...first, I'd like
> confirmation that the RC formula above does in fact describe the decay
> portion of hardware-generated exponential envelopes; or if not, what is
> the correct formula? Then, if someone would be so kind as to show a
> formula that could be applied to calculate the next envelope level given
> the current level & time & RC constant (decay rate), that would be most
> appreciated. A reasonable approximation would be fine (particularly one
> that's not terribly computation-intensive); I'm using floating-point
> math now, but of course an integer-based solution could also be used.
>
> Once I get this formula, I can also apply it for exponential portamento,
> etc. It's not holding up progress, but needs to be done at some point.
>
> Thanks
>
>
More information about the Synth-diy
mailing list