[sharing] Analog-style ADSR envelopes


    May 19 2015 | 5:11 pm
    Here's an example of analog-style ADSR envelopes created in gen~. These are RC style (so convex going up, concave going down) and are the sum of an AD envelope and an ASR envelope. If you are interested in analog-style envelopes or slew limiters, there is some useful code that demonstrates how to calculate the attack and decay coefficients for slide.
    They can respond to changes in parameters at signal rate and they (should) behave similar to analog envelopes in that they are constant rate rather than constant time. That means that the release time of the envelope may be different depending on where the envelope is when the release is triggered. There is also an attack lockout feature which prevents release/decay from occurring until the attack has finished; this is off by default.
    The first one behaves like the Moog Mini (no retriggering while sustaining) and the second one behaves like the Arp 2600 (retriggering on every new note). These are not optimized, but they are functional and commented for learning purposes. I haven't included a reset from 0. capability in order to keep the code simpler, but it is certainly possible to implement this feature. Like analog envelopes, these envelopes are not velocity sensitive, though it is possible to modify them so that they are.
    ================== UPDATED VERSION POSTED IN COMMENT BELOW =================

    • May 19 2015 | 6:39 pm
      Thats really great Peter, but I get an error for the gen~ for gate+trigger :
      compile errors clang: error line 2132 column 43: use of undeclared identifier 'decay' gen~: failed to compile patcher
      Would there be any way to vary the curves amount?
    • May 19 2015 | 7:04 pm
      Here's a fixed version. It isn't possible to vary the curves in this version as it is now.
      A way of doing that would be to construct a linear version of this then selectively apply the curves in the code via scale, though it will take some fancy footwork if you want to be able to change the curves rapidly without introducing discontinuities.
    • May 24 2015 | 8:24 pm
      hi peter.
      just wanna say thanks for this and congratulations on the work.
      it is not only typically mccullochian, but is also some of the most amazing dsp research and code i have seen done in max for a very long time.
      your contributions to the community are always fantastic and have been so for over a decade.
      that's enough bro-mance for now.
      i'll think of something more creatively useful to contribute to this at some stage.
    • May 25 2015 | 4:53 pm
      nice stuff! thanks!
    • May 25 2015 | 7:33 pm
      I'd like to join the chorus here. It's such a treat to be around you egg-heads these days. Amazing work. I've wanted to help out in the BEAP project and such, but I've simply been too swamped to participate. Watching from the sidelines is such great entertainment, though.
    • May 26 2015 | 3:39 pm
      Thanks for the feedback, everyone! Maybe with some tweaking these could work in BEAP...
    • May 26 2015 | 3:59 pm
      My biggest flaw is constantly ripping open BEAP modules and using them for my own non-standard purposes. Eh. I *love* BEAP, but I don't "use BEAP".
    • May 26 2015 | 5:47 pm
      I had been working on a modular synth library A couple of years ago but realized I wasn't going to have time to finish it and my dissertation, so I rolled some of it into BEAP. (For instance, Bp.AHD is the guts from MOD.AHD~ with 5V stuff added) The stuff from that project is different from BEAP in that it's much lower level (just objects and arguments; no nice GUI) and inputs are not normalized to 5V.
      Maybe when I can get some time I'll throw some of the modules up on GitHub. I learned a lot from working on that and BEAP, and found the Sound On Sound Synth Secrets articles to be really handy, since I don't have a ton of old synth hardware experience.
    • Feb 15 2016 | 11:05 pm
      First of all, these envelopes are amazing work. I realize this is an old thread. I'm a newbie with gen so I wonder how difficult it would be to modify the gen~ here to so that the envelopes could ramp logarithmically or exponentially??