[sdiy] software / firmware envelopes in C (or anything else)
Gordonjcp
gordonjcp at gjcp.net
Thu Nov 6 01:04:01 CET 2025
On Wed, Nov 05, 2025 at 03:55:32PM -0600, Chris McDowell via Synth-diy wrote:
> Howdy list,
>
> I've been thinking about this for about a decade. I use what the web calls a "leaky integrator" all over my synth code. I first used it as the basis of an envelope some 15 years ago when mimicking the Moog Rogue's strategy of providing a target and a "rate" to a lowpass filter built around a 3080 OTA. On an MCU with an FPU, it works pretty much great. the basics:
>
> output += (target - output) * rate
>
I don't know that I'd call that a leaky integrator so much as an approximation of an RC circuit.
That is more or less how the Juno 106 calculates its envelopes though, albeit using a carefully-designed lookup table to give a smooth and progressive control law to the decay and release pots.
https://github.com/ErroneousBosh/j106roms/blob/master/ic29.txt#L827
During the attack phase it simply rises linearly, adding on a value every time around the mainloop.
https://github.com/ErroneousBosh/j106roms/blob/master/ic29.txt#L866
--
Gordonjcp
More information about the Synth-diy
mailing list