It’s taken some time, but I think I’ve managed to get a little closer to the curves I was aiming for with my version of the Hordijk ADBDR envelope generator.
My approach has been to sample the value of the release or decay curve at the moment a new gate pulse arrives, and use that as the starting point for the next attack. (In trigger mode gate pulses arriving before the attack phase has completed are ignored.) In @stschoen’s original uLope modules this was efficiently achieved by using the addition node to add the attack to the release curve, with the disadvantage though of sudden jumps should a new attack arrive during one of the decay phases.
Sampling the value and crossfading between the first and last part of the envelope introduces some tricky timing issues (which I’ve solved by adding an extra timer for the sampled end/start values and introducing a very small delay before the attack phase timer kicks in*). One the other hand, having a sampled start value for the attack not only makes it possible to have it pick up on the value of a potential preceding decay phase, but also scale the amount of time allocated to the attack according to the height available, i.e. the higher the attack point starts (depending on the level of the previous decay or release) the shorter the attack time. This also keeps attacks in quick succession that ‘build’ the overall volume from overshooting the top value of 1. (As it stands the top value corresponds to the top value of the gate height if that happens to be another value, but that could potentially be decoupled.)
The result is an ADBDR envelope that can be re-triggered at any moment in gate mode, or any moment after the attack phase in trigger mode. In gate mode the release kicks in as the gate ends, while in trigger mode it’s independent.
Small glitches can still occur from time to time when pushing the envelopes to extremes and I’ve added a low pass filter in an attempt to smooth them out. Generally it seems to be usable though. The next step is to build it into the Dual Envelope module.
RH-RM ADBDR Envelope v.1.1.audulus (315.2 KB)
*If anyone has a more elegant solution than my double timers, I’d be curious to know. This has by far been the most tricky module I’ve worked on.