Appreciation Post

So, here I am converting a JavaScript envelope generator I wrote from linear-response to exponential response, with a pen and paper drawing some curves.

I have a pretty good idea how to do it from previously reading and using Émilie’s work. In the past I based the envelopes in Spectrum for iOS on the code from Peaks envelope generator. I remembered the basic idea, even easier for me this time because it’s a fixed ADSR. But I didn’t want to clone Peaks again, I wanted something where I’m comfortable tweaking the curves to get the feel I’m looking for.

So I end up on DSP stack exchange, and read a post. And the answer is amazingly in depth, with details about how analog envelopes target a value higher or lower than the target in order to actually reach the target value, not just asymptotically. Graphs are provided. The author goes further to suggest a better implementation based on lookup tables - wait a second this is starting to look really familiar - yep the author of the excellent stack exchange answer was none other than pichenettes :grin:.

So… just wanted to say thank you for the huge depth of knowledge and effort you have put into sharing what you know. Now I’m off to calculate a lookup table :slight_smile:

Hope you have a great day!

(Link to stack exchange: audio - Help with equations for exponential ADSR envelope - Signal Processing Stack Exchange )


I love a story with a happy twist in it.

1 Like

I can second this endorsement. If you’re interested in seeing working code (and working lookup tables), the Braids AD envelope is beautifully simple:
eurorack/envelope.h at master · pichenettes/eurorack · GitHub

I’ve extended it for use in Yarns, adding full ADSR and buffered rendering:
yarns-loom/envelope.h at loom-analog-osc · rcrogers/yarns-loom · GitHub

For performance reasons (Yarns is a busy system), my version has a much lower clock rate of 2kHz, and uses linear interpolation between those exponential sample points. It was trivial to modify Braids’ Python scripts for generating lookup tables to use this new sample rate.

1 Like