Envelope Circuits: a simple AR design using op amps
A very simple Attack-Release envelope generator can be built with a dual op amp and just a handful of extra components. The input stage is basically the same as my op amp gate buffer, with only its output resistor changed; the rest is a simple low-pass resistor/capacitor setup with an output buffer. Here’s how it works:
The input acts as a comparator. When the gate input goes high, the comparator output goes high, and the capacitor is charged up via D2 and the Attack pot RV1; when the gate goes low, the comparator goes low, and the capacitor discharges through the Release pot RV2 and D3. The diodes directionalise this process, so the attack time is governed only by the Attack control, etc. The output is a very simple unity-gain follower.
With the values shown, attack and release times range from just a couple of milliseconds to around 5 seconds. Larger values for the pots and/or cap will extend the times proportionally, smaller ones reduce them. The 560 Ohm resistor sets the minimum time against a given capacitance.
With an op amp such as the LM358, the output will swing between 0V and approximately 1.5V below the positive rail. If a lower output level is desired, add a potential divider of resistors in the low-mid single Ks after the output buffer amplifier, taking the overall output from their junction.
Supply voltage is not critical, but as mentioned above, the LM358 op amp will swing to around 1.5V below supply at maximum. It does, however, swing to ground too, which when operated on a single supply is necessary in obtaining a correct ‘gate low’ output. If you cannot find a 358, use another op amp which will swing rail to rail, or ground to near-positive.
A circuit like this makes a nice addition to synths with only one envelope, such as the Moog Werkstatt and Mother 32, or Arturia Microbrute. It will run from a 9V battery and is small enough to build into the Werkstatt itself, or indeed any small external box of your choice. You could easily build one for a Eurorack modular system too, and it will run happily on +12V or +15V.
For details of how to modify the Werkstatt, take a look at my Werkstatt page.
Op Amp AR, parts list:
U1: LM358 or similar
D1-3: 1N4148 or equivalent
C1: 1µ poly non-polarized
R1,2: 100k 1/4W resistor (I use 1% Metal Film types, but 5% Carbon are also fine)
R3: 82k —”—
R4: 18k —”—
R5: 560Ω —”—
R6: 1k —”—
RV1,2: 1M linear pot
Input and output connectors as desired.
Hi there, I have used your proper gate input on my Werkstatt and it works perfectly! If I build the “Envelope Circuits: a simple AR design using op amps” how do I implement it in the Werkstatt? Do I just connect this circuit in series with the “Gate In”? If so what exactly does the AR then control? Help with implementing this would be appreciated! Thanks, Ewan
Hi Ewan. The AR is intended to be flexible, so there are different ways you could connect it. Its input should be driven by your chosen gate source; one way of doing this would be to simply connect the input of the AR to the tip connection of your DIY Gate Input jack socket. You could route the AR output to anything you like that takes a CV control: VCA, VCF, pitch, LFO speed… that’s your choice. If I were building this into the Werkstatt body itself, I’d simply route the AR output to a jack socket, and then plug it into whatever I wanted.
Another option would be to tie the AR gate input to the Gate Output on the Werkstatt’s header. I’d take the power from the 9V line if you’re building this internally.
Bear in mind that the output of this simple circuit is not attenuated, so you would benefit from running it into a potentiometer to act as a modulation level control.
Thanks! I will give it a go 🙂
When the attack stage is complete, does it stay at the sustain level if the gate is still high, or does it start to decay right away to the release stage (one shot)?
As long as the gate is high, the envelope will stay high too. 🙂
Hello! I’m using this env gen amp op for a project. It’s not completely a synthesizer. I’m generating tones with an Arduino and I want to modificate the square wave with this circuit. But I’m simulating and I’m getting a direct signal , a line. How can I fix this? Greetings
Hi. OK, if I understand you correctly, are you trying to change a square wave into a sloping wave? One way is indeed to slew the up and down edges. Some of the old stringers do this, for example. However, this circuit is intended for relatively slow inputs (a Gate input is much slower than an audio signal) so if you’re using this circuit just as it is shown here, you won’t get anything out of it from an audio rate input. The component that governs the overall ballpark response time is the capacitor. Try something much smaller. The exact value to try will depend on the speed of your square wave. The other problem is that audio signals range from 20Hz to 20kHz (although you won’t be using all that range for notes), and this circuit gives a fixed-time response, not something that varies along with the speed of the input. Those old stringers that use a simple slew limiter to shape squares into sawtooths, they had one circuit for each key and the parts were chosen to suit each one. If you want a circuit that will make a predictable ramped wave from a square of any frequency, you need a different circuit really.
Hope that helps.
It helps a lot! Thank for the response. I have used the circuit, it already works. I’m getting a triangular wave at the output, when I put a square wave at the input. It´s not the correct application, but it works.
Thanks for the response again
Another cuestion. What exactly is the gate? It´s a small signal? It´s a current ? A voltage? A switch?
Gate signals can vary between systems, but typically something like 0V for ‘off’ and 5 to 10V for ‘on’. Inputs are usually tolerant of a wide range. Some systems use “S-Trig” which shorts the connection to ground for ‘on’, and these two methods are not directly compatible.
Thanks a lot for answer… Sorry for making a lot of questions. 😀
I have a piano project made with an Arduino which generates square waves at the tones frequency. I have to module this square waves with this ar envelope generator to get an amplitude modulated square wave.
I have two questions:
– Can I generate the gate with a monostable 555, actioned by the switches of the Arduino?
– Is there any circuit which helps me modultes these two waves (the square wave and the envelope)?
Thanks for your time!! 😀 Hope you can answer soon 😀
The very short answers to your two questions are: 1) yes, 2) I don’t know what you mean 🙂
The longer answer(s)…: What signal does your Arduino output? How many gate signals can your Arduino generate at once? Do you need to multiplex these outputs? There are different ways in which you could amplitude modulate a square wave, and different ways in which you might want to trigger the envelope. So really all this depends on the exact implementation you’re looking at. All this is too complex to go into here. As for modulating the envelope, I don’t really know what you mean – if you mean control over the attack and release times, yes, but it gets much more complicated…
Great schematic. Question. When you say “or equivalent” on op amps, would 741 or 386 work? My guess is 741. Thanks!
I usually use one of the TL07x series, because they’re cheap, and common. However, I use a 358 in this particular circuit because the output will swing down to its -ve supply (here, 0v). This is necessary to give a zero-level output when the envelope is ‘off’. The TL07x and 741 don’t swing to either rail, so neither are suitable here. The 386 is not designed for this kind of application, so I would avoid that too.
Hi, thanks for the schematic. Will the release also work for short gates? I mean is the cap charged that fast?
And can I use 1n5817 or a 1n69p diodes instead of the 1n4148?
Apologies for the late reply! Not sure about the diodes, but you could certainly try them if you have them to hand. They only act to direct the current flow, their precise qualities are not critical.
As for the Gate length, in this circuit the cap charges in around 2 to 3mS. Most triggers will be substantially longer, so I wouldn’t worry unless you want to use very short pulses.
Hi! Thanks for your little AR generator! I wonder would it be able to generate two envelopes from a single gate signal, if you added another identical set of circuitry ?
Hi! If I understand you correctly, you want to build more than one AR generator and trigger them from the same gate, yes? That’s certainly possible. The simplest way to do it is to just build two separate circuits with the single Gate input socket wired to both inputs. It’s unlikely to cause any problems unless you have a low Gate voltage or use a lot of envelopes at once 🙂
Thanks! You did understand me perfectly, although I could have been more clear! Inbetween leaving the comment I tried triggering 2 ARs from the 1 Gate and it did work very well. Thanks again for your generator, it was very suitable for my project (cv controlled cassette tape playback “synth”) I’ll use the second envelope out to control the tape speed of my other project, a cassette tape delay effect. (when I figure out the LDR to pot values!)
Glad it worked! Your project sounds interesting. If you’re planning to post about it anywhere, please feel free to link back to my page. Good luck!
Thank you! I will certainly link to your page when I post my project/s. Looking forward to your LFO projects!
Hi, I’ve assembled this circuit based on the parts you suggest and am a bit stuck in using it for a specific application.
I’m trying to essentially have a little “pedal” with a momentary push button, an audio in, and an audio out, with attack/release controls for the volume. So I wired a 1/4″ audio in jack to a momentary button and wired that to the Gate In from your circuit, and wired the AR Out to a 1/4″ audio out jack. However, I can’t get any sound out of it at all.
I also tried adding a manual gate (using this schematic—https://www.muffwiggler.com/forum/userpix/8205_screen_shot_20130831_at_034346_1.jpg) before your circuit’s gate in but no luck.
Is it simply not possible to wire the audio in to gate in and audio out to gate out? Or does there need to be a separate circuit to bridge them? Any suggestions would be much appreciated.
You’re right, you can’t process audio directly with this circuit. To do that, you’ll need a VCA (voltage controlled amplifier). That will have an audio input and audio output, and a control input. The control input is where you’d connect an envelope such as this.
Though I haven’t written a VCA post (yet), you should be able to find a simple DIY VCA circuit online – a basic one should only require a few parts and not be hard to build.
Thanks for the quick reply! I’ve been looking into VCAs and found a couple circuits for single supply ones (which I’m assuming I need if I need to run this whole setup off of a 9V battery?) so I’ll give those a try.
However, I think something is wrong with my wiring of your circuit here. I have a manual gate sending out 9V via a momentary pushbutton to the AR envelope and an LED at the end to try and visualize the attack/release and am not getting anything when it’s running through the AR.
I have tried adding a second 9V to power U1A with no luck. I also previously had points 2/3 wired together on both RV1 and RV2 but not sure if that’s what the looping arrow on the circuit suggests so I clipped them.
Does anything strike you as being wired wrong here? Appreciate any help, I’m fairly new to this and have been doing a lot of forum digging and trial/error with no luck.
Sorry, I can’t work out what’s going on from those photos, but I’ll offer some pointers.
Firstly, your wiring could be neatened by using a dual op-amp instead of what looks like two singles. Secondly, make sure whatever op-amps you use are able to send their outputs to the negative supply rail. Not all op-amps do this. It’s particularly important when using a single supply like a 9V battery.
Secondly, how are you driving the LED? An LED will have a forward voltage drop and requires a series resistor to limit current. Not considering these may cause damage or give the impression of bad operation.
Thirdly, all the connections should be as shown in my diagram. The wiper of each pot (usually the centre pin) should be connected to the clockwise end pin. What this does is make that pot into a variable resistor, so that when it’s turned fully anticlockwise there is no resistance, and when turned fully clockwise, there is maximum resistance. Those should not be clipped.
If you build as suggested using working parts and supply adequate power, you should be fine. Pull your circuit apart and start again, and also make sure your capacitor (which looks like a tantalum, and is therefore polarised) is the right way round. Instead of the LED, just use a voltage meter. You should get a multimeter if you don’t already have one.
Ah it was indeed the op amp situation! I’m using the LM358 but didn’t realize the two op amps in the circuit referred to the same chip. Pulled the circuit apart and rebuilt it with the one chip and now it’s working. Thanks so much! Really appreciate all the help.
So I haven’t built this yet but I just wanted to say that I’m astonished by the simplicity of it. I’ve previously built Thomas Henry’s 555-based AD/AR envelope but this is even simpler. Amazing. Thanks for sharing!
Thanks! To be fair, this is just a simple AR, and would need modification to work as an AD. The main difference is the way an AD completes the cycle once on triggering, regardless of the length of the input, whereas an AR will cut the Attack phase short and go straight into Release if the input trigger is of a lesser duration than the ‘zero to full level’ attack time. An AR will also hold its full level while an input is present, whereas an AD will not.
I should probably add an AD envelope as well. And an ADSR…
Thanks for the highly informative post!
Quick question though: when I built this circuit in Multisim, it’s output voltage changes with the Attack/Release. Should this be happening? Certain configurations have minimal effect, but others change the voltage quite dramatically. Adding the voltage divider on the output as you suggested does minimize the change, but I feel like it’s still a little too big for a VCA.
Of course this is all “simulated”, so perhaps it has something to do with that. But if you (or anyone) have ever encountered this issue, I’d love to know if there’s an obvious solution.
Hi 🙂 I’ve never used Multisim, so can’t comment on that. However, there are a couple of points to note about this circuit.
Firstly, this design runs on a single supply rail, so you need to make sure your op-amp is capable of providing an output that reaches the lower rail (ground/0V here). Not all devices do this.
Secondly, the input required by this circuit is a gate – a constantly held voltage above the threshold level for activation. In most synthesizer circuits using a positive gate, 0V is ‘off’, and something like 5V is ‘on’. When you send it a steady 5V, the output should ramp up, and hold high while the gate is active. When you drop the input back down to 0V, the output will ramp down to 0V. The times these transitions take are determined by the size of the capacitor and the settings of the ‘attack’ and ‘release’ controls respectively. The input should be hard on/off with as little slew time as possible, and should remain high while the envelope cycle is desired. The maximum level of the output will be determined by the reach of the op-amp you use towards the positive rail. I know this is not ideal, but I only wanted to offer a simple utility circuit that could be expanded and modded by the end user if they wish. There are a couple of ways of scaling the output level, if the maximum output is too hot.
Thirdly, this is not a VCA, it’s simply a bi-directional slew limiter. It is intended to provide a control for a VCA, but is not one itself.
Hope that helps!
I’m kind of a novice at electronics, but I’ve been closely looking at the ARP omni Attack/Release circuit and was wondering if it works similar to the LM358 circuit on this page. In the Omni circuit, there’s 22uf caps for every key because it’s polyphonic. Does the comparator rely on the voltage of the caps being charged in order to turn on?
Well, thanks for asking, but I don’t know the Omni well enough to comment. As for the comparator, it doesn’t rely on the voltage at its output at all – comparator action is based solely on its two inputs. The output of the comparator will be high or low, depending which input is higher. As the charge on the capacitor changes, only the action of the following stage will be affected. Here, that’s just a voltage follower, so the follower output tracks its input.
Thanks for all the great information on your page!
Do you think it could be possible to make this a looping envelope, so that when the release phase is complete the envelope re-triggers itself?
Hi! It is possible to turn this into a looping envelope, but it requires enough modification that it’s a separate blog entry. When I get the time (hopefully soon), I’ll be adding that to the page. I guess there are a couple of ways to work it, but I think it would be possible to keep it down to a single chip.
OK Thank You!
Very curious to understand how this can be implemented.
Is it possible to substitute the 1m pots with something a bit more common? B100k?
Hi! The short answer is yes. The longer answer is that the attack and release times are governed by the combination of resistance and capacitance. If you reduce the size of the pot by a factor of ten, you also reduce the maximum time by around a factor of ten. The resistance is the sum of the fixed resistor and variable amount. If you have, for example, a 1K fixed resistor and a 1M variable pot, the minimum total resistance with the pot at zero is going to be 1K. With the pot at maximum, the total resistance will be 1.1M – a ratio of around 1:1000, rounded off. If you reduce that pot to 100K, that ratio of short to long becomes just 1:100. The decision then becomes, how proportional do you want your longest and shortest times to be? Maybe 3ms up to 3s? That’s 1:1000. If you reduce the pot value, you would want to reduce the fixed value resistor as well to compensate and maintain the ratio. Then you have to consider the capacitor value. As you reduce the effective resistance, that reduces the overall timing. You’d also need to increase the cap value to offset the reduced resistance, as the timing is a product of the two. The capacitance would change by the same factor as the resistance, so if you reduce your resistance by x10, you would increase the cap by x10 to maintain the same timing.
I would also add that the “B” pots are linear taper, which means you’ll get a lot of the variation in timing bunched into a short amount of turn at the lower end of the pot. Charge times are not linear, so you’re better off using a “A” (ie. log/audio) taper pot to ensure more evenly spaced timing around the rotation of the control.
I built two of this for the eurorackish modular Im building, it works well with 12V, I just set up a simple voltage divider with two equal resistors acros the outs so I get a 6V signal thats close to the 5V standard I understand eurorack requires. Only thing is that during testing It seemed to need a bit more than 5V in the inputs to output its signal, I didnt fully tested so take it with a grain of salt, will update if necesary.
Great project mr. synthnerd 🙂
Thanks! Glad you found this useful. The reason your circuit needs a higher input to work, is that you’re using 12V instead of the 9V my example uses. As the input is a comparator using a divider to set the trigger threshold, you’ll need to adjust R3/R4 to suit your needs.
If i try to open and close the gate with a ´piezo and im triggering square waves is this possible? i’ve made a simple ad circuit and use a transistor to conect and disconect +5v to the piezo in and have the tone sustain but after some seconds the sound returns i mean i press the piezo (the instrument is silence) and i get the sound thern after is unpress seconds later the sound comes back (so the gates open again) so i was wondering how can this be fix :))
Hi. I don’t entirely understand what you’re doing, but a piezo trigger will only produce a very short signal on impact. The AR circuit expects a gate, not a trigger. A short pulse will only work here if the Attack is also very short. If you need an attack longer than your piezo signal, you need to use a longer input pulse. Also, it needs to be steadily above the input comparator threshold for its duration. Furthermore, the envelope is not suitable for taking a sound as an input – it is not a VCA, it doesn’t process audio – it is only a control signal, which would then control a VCA. The VCA would pass audio, under control of the envelope.
Hope that helps.
Hi, thanks for sharing this project, I am going to build a prototype for my almost-diy euro rack (the idea is to take the gate from the midi to cv converter and feed the output to my diy passive optoresistor gate,which I can’t call lpg as it modes that have any filter. Other than using it with a vca, of course)
I will use a tl072cp op-amp, questions are:
would it be sufficient to connect the pin 4 to -12 and 8 to +12, all the rest as in the schematics, to work with the euro rack power supply?
Also I don’t get the concept and use of the potential divider resistor you mentioned (I am pretty much a beginner). Would you mind to expand please? Is this necessary for my purpose?
Thank you very much!
I’ll tackle those questions in reverse order.
1) I’m presuming you refer to the comment about a potential divider at the output. If you’re running this at Eurorack levels (ie. from a +12V supply) then as it stands the output will peak at over 10V. If this is fine for you, don’t worry about it. Euro envelopes are, I believe, normally up to 8V following the original Doepfer standard, so if you’re keen to maintain that, try putting a 3k3 resistor from the outer end of R6 to ground. The output will still be taken from the same point. This should drop the output level to just over 8V, and in Euro whatever you plug it into should be OK with that.
2) The short answer to the power question is “no”… the long answer is more complicated. There are two main points to make: firstly, the first op-amp stage here is used with its output at full swing, which means that the output will be either as high as it can go, or as low as it can go. One limiting factor is the power rails. The other is the specific op-amp. In my example, the 358 will go down to its lowest rail, and in this circuit that’s 0V. This means the output of the first op-amp stage is either at 0V or about 1.5V below positive supply. The second op-amp stage just follows a smoothed-out transition between these two levels. So, the swing of the first stage governs the envelope minimum and maximum voltages.
The second point to make about this is that the TL072 does not reach either rail. You can power the 072 from +12 and 0V, but it won’t get down to 0V to give a zero voltage base for your envelope. It also doesn’t like being saturated low. So don’t use an 072 for this circuit at +12V/0V. Using it as +12V/-12V is also a problem, because with any op-amp the output of the first stage in that case will be either about +10.5V or -10.5V. You’d have to introduce extra parts to limit the low level, and that would be enough complexity to warrant a separate blog post.
My advice is to find an op-amp that will swing to its lowest rail (and the 358 is a solid choice, and is still available and cheap), and power this simple circuit from 12V and 0V, with the one extra resistor on the output as mentioned before to set the final levels.
Thanks for replying. It was very clear. I will definitely follow your suggestion
Hi! I was wondering if I could use this to manipulate the current flowing from pin 6 of a PT2399? This pin is used to control delay time and I’m attempting to get some warped tape like sounds by using the attack from a guitar through some sort of envelope filter. If so, would I simply connect the “AR Out” to pin 6 or would it require more circuitry? Thanks v much!
OK so this is a more complicated question than I can answer here. I’ve never tried external voltage control of a PT2399, though what seems to be the case is that the control pin is usually hooked up to a resistor. What you’d be looking to do is replace this with a voltage-controlled current sink, which is something you find in VCOs and whatnot already. If you Google “PT2399 voltage control” you’ll find various takes on this circuit, so what I’d suggest is having a good look at what a current sink is (hint: transistors!) and see how people hook up control voltage inputs to them. There are lots of factors so it’s not a simple design to describe in text and I’d need to spend time working on it to come up with a circuit for you, so the short answer is “it can be done but you’ll need to find someone who’s already worked it out” 😀
Music From Outer Space is usually pretty thorough, so check out the late Ray Wilson’s design and see if you can follow his explanation.
First up, this page is amazing. So many great articles with lots of insights for beginners like me. My jaw dropped to see that this comment section is still active! 🙂
I built a very similar AR env gen than this one and this schematic helped me a lot to warp my mind around what all the components are doing. My circuit is working fine and after doing some measuring and testing there’s a couple of questions that I have, mostly about modifications that I want to make.
1. When I looked at the shapes of my Attack and Release curves on an Oscilloscope, I realised that the Attack followed a logarithmic trajectory, while my release was very linear. Here’s some images of the readings: https://drive.google.com/drive/folders/1oa8z2xZ7cdu3vb0y09KR-LCwfRzJm4qM?usp=sharing . I was wondering if these characteristics are defined by the capacitors or the diodes I’m using and if there’s a way to influence the knee of the curves, maybe with a pot or a cv input.
2. The second thing I wanted to add was a “gate out”, that could be patched back into the input to create a sort of loop function. I remember seeing a similar envelope generator that used a schmitt trigger inverter to retrigger the envelope every time the release drops under a certain voltage. What are your thoughts on this Idea and would you by any chance have any resources that could help me design a function like this?
First things first – Thank you so much for the support! It’s much appreciated. This page isn’t monetised so things have had to take a back seat, especially with the way the pandemic has affected my work. However, I try to keep up to comments, and still have plans for several articles at various stages of research and drafting so please do keep watch.
Right, onto your questions.
1. That does look wrong, indeed. You say you built a ‘similar’ circuit but without seeing the schematic, how it fits into your system, and how you’ve built it, I can’t really troubleshoot here. However, it looks like the problem lies in the discharge components. If you’re using a single-sided supply, make sure your opamp can go to the low rail. Not all do. Make sure your diodes are fine. Check all connections. A capacitor will discharge in a straight line if the current is constant, which it shouldn’t be in a simple circuit like this, so it might be doing so through something it should not. Check your rails, check your components, check your build.
2. This is more complicated. You’re right that a schmitt trigger will do the job of detecting the output level and providing a high/low accordingly, but this particular envelope is only the barest of bare bones circuits and adding a looping function to this makes is a different beast really. The input of my simple design is just a comparator, but what if you made *that* into a schmitt trigger? Consider where your flip points would be, and if you want to input gate to have any effect in loop mode. You could also achieve this with a flip-flop, or the ever-useful 555.
Hey thanks a lot for sharing.
I build it on a proto board using a 9v battery.
I have some cheap small scope.
I used everything as stated except the pots which are 500K linear.
Should that work? when I turn the port I only see a sort of envelope shape but the attack or release does not change only the voltage.
I check many times and cannot see my error.
The pots I connected pin 2 and 3 together.
As a trigger I use another 9v battery.
Would you have any thints?
Hi! Honestly, if you’ve built it correctly, even with 500k Lin pots, that should work. Even using a 9V battery as a gate input should work, though it’s definitely not ideal. The main difference with linear rather than log pots is the shape of the slope, but the time the slope takes to rise and fall should still change as you adjust them. Don’t forget the opamp needs to be a single supply, or rail to rail type, that will function down to 0V.
It sounds like you’ve done something wrong – check the components, double check the type, the values, the connections, and whether they work individually.
OMG…. My scope was set to AC ….. I put it on DC and now I see Attack and Decay changing as should.
Thanks a lot.
Was quite fun to breadboard your envelope. I am planning 4 for controlling a Casio SK1 with 4 filter.