Envelopes. Arguably the most important building blocks of any music synthesizer outside of the signal path – and the only component outside of the signal path that in reviews often gets described for its sound (typically, reviewers rate if they are “snappy”).
It’s a pretty simple thing it seems. The usual implementation is ADSR, named for its four stages and its four adjustable parameters. So what is there to discuss?
First of all, the envelope is generated by an envelope generator. This thing does not process audio signals. It receives and sends control signals. For received signals, it’s the gate: a bistate (“on or off”) signal that usually comes from key on or off. It sends a continuous control signal (a modulation signal).
As the most important envelope in most synthesizers is the amplitude envelope (the one that controls the amplifier, i.e. the signal level coming out of that voice), many implementations also include an amplifier, and thus add an audio in and out. As a result, the distinction between the envelope generator and the amplifier included in the envelope generator becomes blurred. As part of this article, I’ll try to always be clear what I’m referring to – i.e. an “envelope generator” here only includes the thing that receives a gate and sends a control signal.
Now, I’ll explain the mother of all envelopes: the ADSR envelope.
The ADSR envelope is a four-stage envelope, with the four stages of attack, decay, sustain and release. You might however consider that there’s in fact a fifth (or zeroth) stage when the generator doesn’t do anything, which I’ll call idle for now.
In a basic implementation, you get four parameters for your envelope, also named attack, decay, sustain and release – very often without any units (“0-10” or, in the MIDI world, “0-127”).
The attack stage is when the control signal (and, for an envelope controlling the amplifier, the audio signal) goes from “off” to the maximum level. It starts when the gate transitions from “off” to “on”. The attack parameter controls the duration of that stage in some way.
The decay stage has the signal falling from the maximum level back to the sustain level of the next stage. It starts once the attack stage has completed. The decay parameter again controls the duration of that stage in some way.
The sustain stage maintains the signal at a constant level. It starts once the decay stage has completed. The sustain parameter is the level of the signal during that stage.
Finally, the release stage has the signal falling from the level before to the “off” level. It starts one the gate transitions from “on” to “off”. Its parameter controls the duration of the stage in some way.
Describing the idle stage, the signal simply is kept at “off” during that stage. It follows the completion of the release stage. This stage has no parameters.
A typical depiction of this envelope looks like this.
In a simplified version, a state machine looks like this.
I call this “simplified version”, because for this, we assume that the envelope is only triggered when in the idle stage, and the gate is only turned off when in the sustain stage. As a consequence, no “gate on” transition happens when the state of gate is “on”.
The Real World…
All of those limitations do not hold in the real world, however. You can release the key while you’re still in the attack or decay stage. In this case, it would make sense to jump to the release stage, but you could also jump to (or remain in) the decay stage and move to idle once this stage has fallen to level zero. Then, you can trigger anew when you’re still in the release stage. You might either start the attack stage from the level you’re currently in, or set the level to 0 (i.e. move via the idle stage) and then trigger the attack stage. And finally, there’s also the possibility you get a “gate on” transition when the gate state is on – a ‘event in VHDL vernacular: this happens if you “run out of voices”, most typically on monophonic synths when you hold a key and then strike another one. Two sensible options would be to either ignore this transition, or to retrigger attack from the current level.
What we can see is that we’re already forced to make choices – and existing implementations have been done with any and all of the choices mentioned above. So the following full-blown state machine is just one example of how one of your ADSR envelopes may work.
For now, we’ve been assuming a so-called piece-wise-linear (PWL) shape for our envelope, not only in part due to the example drawing we’ve looked at before. The level rising and falling in a straight line is one option, but not the only one, and different implementations are possible.
While a lot of the older (read: true analogue) implementations didn’t bring that much specification to that regard, many modern digitally-controlled-analogue, digital or virtual analogue systems allow you to shape those individual segments to your liking. One nice example is the Nord Modular’s ADSR envelope, which allows you to set different combinations of linear, exponential and logarithmic shapes for attack, decay and release.
Steinberg’s HALion VSTi gives you even deeper control – various shapes, including parameters, and the possibility to subdivide the stages, e.g. start the Attack stage with a logarighmic shape to switch to exponential later and end with linear, essentially moving beyond the ADSR concept altogether – something we’ll have a look at later on.
The Duration of a Stage in some Way
Earlier, we discussed that the A, D and R parameters set the duration of the stage “in some way”. Now it’s time to see how it does set the duration.
Setting the time makes sense if we go back to that simplified state machine we’ve looked at before: attack always starts from zero level, decay always starts from maximum level and so on. Here, it doesn’t really matter if we set a tame, or a slew rate, or whatever.
Things change, however, if we move to the real-world scenario: if your attack envelope is set to one second, but you retrigger it just after entering the release stage, with the level sill at 90% of maximum – would you then also want the attack time (the time it takes up to reach maximum level) to be one second, or would you rather have it only 10% of that?
It’s interesting to see what those synth manufacturers of old and new put on the labels:
The mother of all keyboard synths, the Minimoog, has actual durations put on it. Note that the Minimoog does not have ADSR envelopes, though.
Other synths from that era are not so explicit: the Korg MS-20 gives us 0 to 10, the Yamaha CS-80 has a very fuzzy “slow” and “fast”, the Oberheim SEM doesn’t say anything at all. Later on, in the age of digital or digital-controlled synths, it was typically 0 to 127, and actual kinda-physical quantities only started to (re)appear one synthesizers had received larger displays, or moved into a personal computer.
What we’we learned here is however independent of what the actual implementation looks like (and for that, we’ll hopefully gain some insight in the followup article with the case studies).
What is it good for?
Up to now, we’ve taken the ADSR envelope concept as a given, and didn’t care how it relates to what we want to do with it – namely using it in sound synthesis, sometimes for imitating acoustic instruments.
In this section, we’ll be looking at the amplitude envelope (to recapitulate: the envelope controlling the amplifier, and thus the output level of your signal).
Things work well for any instrument that allows for practically unlimited sustain – which, for reasonable uses of the word “practically”, is true for bowed string instruments and wind instruments. As an example, the top half of a recording of a single trombone note.
I added lines to indicate the attack, decay, sustain and release section, as well as what relates to our gate.
The same is true for a violin:
However, what about a piano? Let’s have again a look at a piano note (although here, we’re using a chord).
As you can see, the situation is different: there’s a distinctive Attack, Decay and Release stage, but our Sustain stage is more of a second Decay stage.
And this is true for a lot of instruments: everything percussive (and a piano is, in a sense, a percussion instrument), as well as plucked strings (like on a guitar or cembalo). And for those never-heard-before sound we might want to synthesize, this can also be true.
Discussing this, however, will have to wait until later, when we talk about expanding the ADSR concept. Next up (in the next post) are some case studies, where we’ll look at actual implementations of those ADSR waveforms.