Let me know how you like this one!
-
Recent Posts
Archives
- January 2023
- April 2022
- November 2021
- September 2021
- April 2021
- October 2020
- January 2020
- April 2019
- September 2018
- August 2017
- May 2017
- January 2017
- December 2016
- September 2016
- February 2016
- September 2015
- January 2015
- March 2014
- January 2014
- October 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- December 2012
- November 2012
- May 2012
- March 2012
- January 2011
- December 2010
- November 2010
- July 2007
- March 2003
- February 2003
- August 2002
- January 1997
- November 1996
- October 1996
- August 1996
- July 1996
Categories
- Digital Audio (67)
- Aliasing (9)
- Convolution (3)
- Dither (7)
- Filters (24)
- DC Blocker (1)
- FIR Filters (7)
- IIR Filters (18)
- Biquads (12)
- Fourier (3)
- FFT (3)
- Fun Facts (3)
- Impulse Response (5)
- Jitter (2)
- Oscillators (12)
- Phase (2)
- Reverb (2)
- Sample Rate Conversion (10)
- Sampling Theory (6)
- Effects (1)
- Envelope Generators (5)
- Math (5)
- MIDI (2)
- Source Code (10)
- Synthesizers (9)
- Uncategorized (4)
- Video (7)
- Widgets (14)
- Digital Audio (67)
Nice demonstration. Have you ever seen such curve shape controls on an analogue envelope generator? I was motivated by one of your previous posts to work out how the circuit for such a control might work, and it turns out to be surprisingly simple. I can post a schematic if you are interested.
I don’t know of any, Chris. It would be interesting to see. I suppose that the easiest part would be the attack, at least to the point that the supply voltage will allow, without doing something more sophisticated. BTW, something I didn’t mention in the video is that in hardware synths, even if the release is allowed to decay to a perfect exponential, it’s still going to be a truncated exponential, effectively, in practical synths, because the VCA will be biased off just a bit to ensure it’s not leaking.
See http://www.chris-j.co.uk/miscfiles/envelopeshape.png
This isn’t a complete envelope generator, just the current source (for attack) and sinks (for decay and release) that charge and discharge the timing capacitor. Just the attack source is connected to the capacitor in the schematic; in reality all three would need to be connected to the capacitor in sequence – perhaps with analogue switches, and a couple of flip-flops to control which phase the envelope was in.
The basic idea in the typical envelope circuit is that in (for example) the release stage of an envelope, a capacitor discharges through a (variable) resistor to ground. This resistor can be thought of as a voltage-controlled current sink. By using a standard voltage-controlled current sink (U6, Q5, R9) and with the pot (R7,R8) turned so that the non-inverting input of U6 is receiving the envelope output, we would get exactly the same behaviour, and an exponential release. However, with the pot (R7,R8) turned so that U6 receives the sustain level voltage, we get a constant current sink, and a linear release. Intermediate values give the initial segment of an exponential decay — one that tends to the voltage -V_sustain*R7/R8. (Note that this could well be below the negative rail). The decay phase works similarly.
The attack phase is slightly trickier. Because the curvature of the attack phase is of the opposite sign, we need to reference the current sink against the maximum envelope voltage and vary the low side of the timing pot (which requires the buffer U3). In addition, since we require a current source for the attack phase, a current mirror (the matched PNP pair Q2, Q3) is required to convert a voltage-controlled current sink (U1,Q1,R1) into a voltage-controlled current source.
I haven’t wired this up into a real circuit; it may be that getting the desired wide range of attack/decay times and glitch-free output is less easy with this schematic than traditional exponential-only circuits. Nonetheless, it seems striking how similar the analogue computations done here using op-amps are to their software equivalents.
Hi Nigel! Thanks for this great video. Is there any source code (javscript or java i guess) for the ADSR applet in the video?
I’m trying to figure out how to make variable curve slope for Decay and Release. For Attack i just did something like
0<=x<=AttackTime;
y = (x/AttackTime)^(2^(slope)).
This way when slope=0 the segment is linear.
But i can't figure out the math for Decay and Release.
thanks!
a.
Hi Alfonso,
Check out parts 1 and 2 for details, and the code article for a C++ version. The widget uses a javascript translation of the C++ code. You can probably get to the javascript (ADSR.js) with most browsers (Show page source, etc.):
http://www.earlevel.com/main/category/envelope-generators/?order=ASC
Nigel
Hey Nigel,
many many thanks for these articles and for sharing your knowledge, so helpful!
This and your code example was very helpful.. thanks.
Your website is a great reference.