[sdiy] software / firmware envelopes in C (or anything else)
Chris McDowell
declareupdate at gmail.com
Thu Nov 6 13:44:01 CET 2025
> Probably because you are neurotypical person. I feel sick if the envelope doesn't decay within 16-bit 1LSB of the destination I want it to go.
lol!
With floats, I set the attack target to 2.0 and the threshold at 1.0, then clamp because it will overshoot that mid point at short attack times.
When velocity is involved, I set the attack target to 2 * velocity, and the sustain level to sustain * velocity, instead of multiplying the envelope output by velocity. this has some side effects but feels a lot more natural to me
Cheers,
Chris
> On Nov 6, 2025, at 5:34 AM, Roman Sowa via Synth-diy <synth-diy at synth-diy.org> wrote:
>
>
>
> W dniu 2025-11-06 o 11:45, Gordonjcp pisze:
>>> Anyway, I do it exactly like in your equation. Target is changing between 0,
>>> full scale and sustain level, depending on ADSR phase.
>> Ah - you have to watch that!
>
> no, I don't, because it works :)
>
>> You've got to flip to the decay phase at somewhat less than full scale because the "RC network" charges asymptotically to the rail.
>
> and I do, I didn't say at which point though. Target is at full scale, attack trigger point is at half scale. TBH this is still not all I do there, but for the sake of discussion this is enough.
>
>
>>> All done in fixed point math, but 24 bits is a must, as 16-bit truncation
>>> errors spoil the ends of decaying phases.
>> Can't say I've noticed this.
>
> Probably because you are neurotypical person. I feel sick if the envelope doesn't decay within 16-bit 1LSB of the destination I want it to go.
>
>
>> The Juno 106 has roughly half its voice ROM full of such tables, just to make the controls work nicely ;-)
>
> and to avoid complex, repeating calculations, given that every instruction of processor time is precious.
>
>
>
> ________________________________________________________
> This is the Synth-diy mailing list
> Submit email to: Synth-diy at synth-diy.org
> View archive at: https://synth-diy.org/pipermail/synth-diy/
> Check your settings at: https://synth-diy.org/mailman/listinfo/synth-diy
> Selling or trading? Use marketplace at synth-diy.org
More information about the Synth-diy
mailing list