Oct 17, 2018

ASR Envelope

My first envelope was a traditional ADSR envelope, adapted from Yusynth's design which uses a (7)555 timer as the core logic element. That design works great, but I originally made it only on prototyping board. Recently, in need of more envelopes, I decided to make a proper PCB layout, and revisit the envelope design in the process.

I realized that in typical uses of an ADSR envelope, I tend to set the Decay and Release controls to roughly the same value. This gives the decay and release portion of the sound the same time constant, which often sounds natural to me. I decided that it would be handy to have some envelope generators where the Decay and Release time combined in a single knob, and the result is this module which I called ASR envelope.




Merging Decay and Release into a single control greatly simplifies the logic portion of the circuit. Where the 555 timer in Yusynths design was cleverly used to create three logic states, the core logic now only needs two states which can be easily implemented with, for example, a single opamp. The three controls of the ASR envelope also fit comfortably on a 4hp eurorack panel, leaving space for a loop switch and indicator LED. The simplified circuit fits on a single PCB using all through-hole components.

Circuit description

The envelope circuit (excluding power supply and LED driver circuitry) is as follows:


The gate input is conditioned by U2A, using positive feedback (R2) to create hysteresis and form a Schmitt trigger. This turns any input gate signal into a well-defined gate with around +/- 10V levels. The rising edge of the gate is turned into a short trigger pulse (C1, R6 and D1), which is fed to U1A.

U1A is the heart of the circuit, and also uses positive feedback (R3) to form a Schmitt trigger with threshold levels (on the positive input of U1A) around +8V and -8V. In envelope mode (that is, with the loop switch S1 as shown in the schematic), it is used as a "Set-Reset flip flop" logic element. In it's default state, which we will call Reset, the STATE output of the flip flop is low (around -10V). When a trigger pulse arrives, the flip flop is Set, STATE goes high and the timing capacitor C2 is charged through D2. The charging rate is set by the Attack potentiometer RV1. The voltage on C2 is buffered by U1B, which in turn feeds the output of the module.

The output is also fed back to the negative input of U1A. When the charging curve reaches +8V, the flip-flop is Reset and STATE goes low. Now starts the discharge phase. C2 can only discharge through the Release potentiometer RV3, which sets the discharge rate, and the "precision diode" formed by U2B and D4. The precision diode arrangement compensates the diode drop of D4, such that will discharge to exactly the voltage on the positive input (pin 5) of U2B. Note that R11 and C7 are needed to stabilize the opamp which otherwise has difficulty with the large capacitive load C2.

The discharge voltage (pin 5 of U2B) depends on several factors. If the gate input is still high, we are in the Decay/Sustain phase of the cycle, and C2 will discharge to a voltage set by the Sustain potentiometer RV2 through D3. R9 is chosen so the Sustain level is 100% when RV2 is fully clockwise. If the gate is low, we are in the Release phase, and C2 will discharge to 0V, set by R12. The combination of D3, D5 and R12 forms a diode-OR or maximum value circuit: the voltage presented to U2B is the highest of the sustain voltage (through D3) or STATE (through D5), minus one diode drop. When both are negative, it is clipped to 0V by R12. Note that STATE is only positive during the Attack phase, and it's role here is to prevent discharging of C2 during Attack.

This completes the normal four-phase envelope cycle, and the system is back to it's default state with STATE low and the output at 0V. The typical envelope shape at the output is as follows, with a peak voltage around 8V:

Typical envelope shape

When the gate length is shorter than the Attack phase or the Sustain control is fully CCW, the Decay and Sustain phases are skipped and we have an AR envelope shape. The shortest possible AR envelope has an attack of about 1.5 ms, limited by R4 (which is needed to avoid burning out the logarithmic pot at the shortest settings). The decay time is similarly limited by R10.

Shortest AR envelope

Switching the loop switch S1 disables the Sustain circuit and bypasses D5. Now, the STATE signal is connected directly to both the charging and discharging side, and the circuit becomes a standard relaxation oscillator. This generates a bipolar triangle-like LFO waveform, with adjustable rise and fall rates (by Attack and Release, respectively), with output levels of approximately +/- 8V.

Typical waveform in loop mode

The complete schematic and bill of materials are available in the build documentation below, which also contains some important notes on what components to use.

Build documentation

I offer the PCB for this module for sale. The build documentation below contains everything you need to know to complete a successful module. Please read it through carefully before starting, and especially check the notes in the Bill of Materials when ordering parts.

19 comments:

  1. Hi Kassu,

    What are the time ranges (min/max) for the attack and release phases please ?

    ReplyDelete
    Replies
    1. The minimum time is about 1.5ms attack and release, see the figure "Shortest AR envelope" above. The maximum time is about 1000 times slower, so about 1.5s attack and similar release time.

      Delete
    2. Thanks! Would it be possible to obtain longer attack/release times (e.g. around 15s) by suitable modifications ?

      Delete
    3. Yes, you can increase C2 to 10uF to achieve that. Note that C2 should be bipolar, since in loop mode the voltage goes both positive and negative. A film or bipolar electrolitic would be fine, if you can get it to fit (perhaps on the backside of the board).

      In theory using 10M potentiometers for attack and release would also work, but I doubt you can find those in the 9mm form factor.

      Delete
    4. That's great! Thanks so much for your help!

      Delete
    5. I tried to this mod. I soldered 10uF bipolar capacitor in parallel with C2. It didn't work properly. Attack got stuck high after around 12 o'clock and release got stuck in low state in loop mode. With gates things worked out slightly better. I then added 100pf capacitor between U1 pin 1 and 2 (this was just a random addition in the spirit of circuit bending. I really didn't understand what I was doing :) ). That resolved the getting stuck issue but with bigger C2 the minimum attack time was far too long for my taste.

      I then changed the 10uF capacitor to 2.2uF and removed the 100pF capacitor. Now the maximum attack and release times are about 3 times longer than before and there's no getting stuck happening. Though the minimum attack time is slightly longer than in the default setting, but it's not that bad.

      End of report. There's no questions involved just wanted to share this journey.

      Delete
    6. Thanks for sharing! Not quite sure why it locks up with 10uF, maybe there is a transient that pushes the opamp beyond it's normal input range.

      3.2uF total sounds like a good compromise. I will try this too, I have been wanting a bit slower envelopes recently.

      Delete
  2. Would the envelopes or lengths change a lot if I use linear pots instead of logarithmic?

    ReplyDelete
    Replies
    1. Hi! The shortest and longest time will be the same with linear pots, but the adjustment curve in between will be different. Probably it will be just fine in usage.

      Delete
    2. Thanks, I've just built one with proper potentiometers. Is it right that the decay envelope is a lot shorter in loop mode? It seems almost half of the original decay.

      Delete
  3. Hi Kassu,

    I don't understand the "OUT" at U1A. Where do I have to connect it to?

    ReplyDelete
  4. Hi! OUT is just an extra label there, no need to connect it anywhere. You can connect the point labeled "Output" to the output jack of the module

    ReplyDelete
    Replies
    1. Ok, thanks!. However, I thought that opamp inputs should not be left floating? Are you sure that it could not lead to unexpected behaviour at some point?

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. Ah, now I see, sorry for misreading my own schematic! There is another labe OUT at the output of U1B, and the two points labelled OUT should connect together

    ReplyDelete
    Replies
    1. Ok, now I understand. Thanks for your help!

      Delete
    2. And both STATE labels, should they also be connected? I am not planning to implement the 'loop' feature.

      Delete
    3. Yes, they connect too, also without the loop function

      Delete