Everything on envelopes for coding your own synthesizer.

If you have ever used a synthesizer, you definitely stumbled upon an envelope.

Sometimes it is referred to as contour or simply ADSR (the most popular type of the envelope).

These synthesizer elements help the musicians and sound designers to effortlessly make the sound more lively, more interesting. They achieve it via automatic control of:

  • sound’s amplitude (volume),
  • cutoff frequency of a low-pass filter,
  • oscillator frequency.

In this article, you will learn what is an envelope, all the types of envelopes, and what to consider when implementing them.

Table of Contents

  1. What Is An Envelope?
  2. What Can an Envelope Control?
    1. Amplitude Envelope
    2. Cutoff Envelope
    3. Frequency Envelope
  3. What Are Envelope Generators (EGs)?
  4. Applications of Envelopes
  5. Types of Envelope Segments
  6. Linear or Exponential?
  7. The Catalog of Envelopes
    1. AD
    2. AR
    3. ADR
    4. ADS
    5. ADSR
    6. AHDSR
    7. ADBDR
    8. Arbitrary
  8. Summary
  9. Bibliography

What Is An Envelope?

From the digital signal processing (DSP) perspective, an envelope is a curve that outlines the extremes of a signal [Pluta2019].

As such, it relates to the analysis of the signal: we have a waveform, we connect its peaks and obtain an envelope.

You can see an example of a signal with its envelope in orange in Figure 1. Note that the envelope is two-sided in this case.

A signal with its envelope marked Figure 1. A signal with its envelope marked.

From the sound synthesis perspective, an envelope is a curve that controls a certain parameter of the generated signal.

As such, it relates to the synthesis of the signal: we want to generate a certain waveform and, thus, we apply an envelope to it; an envelope is a control data source [Pluta2019].

For controlling, we use only the non-negative part of the envelope. Actually, the signal from Figure 1 was generated by applying an ADSR envelope to a sine.

According to the Merriam-Webster dictionary, to envelop means “to enclose or enfold completely with or as if with a covering.” So an envelope is a curve that is enclosing the signal.

In this article, we consider the sound synthesis perspective of the envelope: we use it to control some parameter of the generated sound.

What Can an Envelope Control?

In principle, an envelope can control just about anything.

In sound synthesis, it is typically used to control the amplitude, cutoff frequency of a low-pass filter, or the frequency of the generated signal.

Amplitude Envelope

An amplitude envelope is the most commonly found envelope application. Why?

Because they are everywhere!

A fade-in and a fade-out of a song (also after pausing or playing your YouTube video) are forms of an envelope. But the origins of the amplitude envelope are far more ancient.

Originally, amplitude envelopes appeared with the invention of the first musical instruments. Every one of them has a characteristic amplitude envelope.

Plucking a string has a sharp attack and an automatic release.

Hitting a key on the piano starts with an increasing volume, which then decays to a certain level. Then the sound is slowly fading until the key is released, which causes the sound to fade out completely.

On a more fine-grained level, each of the partials in the amplitude spectrum of an instrument sound can have its own amplitude envelope.

Synthesizers tried to mimic the behavior of natural instruments and so they introduced predefined amplitude envelopes, somewhat simplified with respect to the naturally occurring ones.

Here’s an example of a 220 Hz sine tone with the ADSR envelope from Figure 1 applied as an amplitude envelope.

This single change, the introduction of amplitude envelopes, sufficed to make the synthesizers sound more natural. But to make them sound even more natural, another envelope was needed…

Cutoff Envelope

The cutoff envelope controls the cutoff of a low-pass filter.

When we hit a piano key, its timbre is bright at first (high energy in the high-frequency partials in the amplitude spectrum) and then softens (low energy in the high-frequency partials).

Synthesizers imitate this by an envelope of the cutoff of a low-pass filter.

When we hit a synthesizer key, the cutoff frequency rises, the sound becomes brighter and brighter. After some time (or after releasing the key), the sound becomes darker as the cutoff lowers and high-frequency components are more attenuated.

Here’s an example of the ADSR envelope controlling the cutoff of a lowpass filter processing a 220 Hz sawtooth:

As you can hear, the cutoff envelope influences the amplitude envelope because by decreasing the energy of partials, it decreases the overall signal energy.

I specifically mention the cutoff envelope not the cutoff frequency envelope. That is because we typically want the cutoff frequency to increase with the pitch of the key that we hit. Otherwise, high notes could be inaudible.

The cutoff envelope controls what percentage of the cutoff frequency should be set. Typically, the value of 1 (100%) means that the cutoff frequency corresponds to the value set by the user.

Sometimes the synthesizers allow the user to control the contour amount, i.e., the range of the cutoff change. For example, we may want to have the cutoff change only between 80% and 100% because starting the envelope always from 0% tends to sound too repetitive.

Frequency Envelope

In some sound design scenarios, I can imagine envelopes controlling the frequency of an oscillator.

In these cases, the sound’s pitch would change over time according to the envelope.

As this is very specialized and does not concern traditional sound synthesizers (with a MIDI-based control), I won’t discuss it here in detail.

What Are Envelope Generators (EGs)?

In analog sound synthesis, an envelope generator (EG) is a source of the control signal (the envelope).

Therefore, on module connection diagrams, you can often see EG blocks connected to VCA blocks (voltage-controlled amplifiers), VCF blocks (voltage-controlled filters), or (in rare cases) to VCO blocks (voltage-controlled oscillators).

The connection between any module and an EG means that this EG is controlling a parameter of that module. For VCAs, that’s amplitude, for VCFs, it’s cutoff, and for VCOs, it’s frequency.

Nowadays, EG blocks are also used to depict the interconnections of digital modules but their meaning is the same: they are sources of a control signal, an envelope.

Applications of Envelopes

Amplitude and cutoff envelopes are used for various purposes. For example, to

  • make the sound more lively,
  • make the sound more natural by imitating real instruments’ envelopes,
  • make the sound less natural with obscure envelopes,
  • avoid clicks and other artifacts (e.g., via a fade-in and a fade-out).

Some more specialized applications of envelopes in sound synthesis include

  • amplitude envelopes of partials in additive synthesis,
  • envelope of the amplitude and the cutoff in subtractive synthesis,
  • frequency envelope of an oscillator for sound design purposes.

Types of Envelope Segments

Envelopes consist of segments (ramps). For example, the most popular Attack-Decay-Sustain-Release (ADSR) envelope consists of 4 segments: attack, decay, sustain, and release.

ADSR envelope and its 4 segments Figure 2. ADSR envelope consists of 4 segments.

The segments are crude piece-wise approximations to the natural envelopes but they represent a good trade-off between the quality of the result and the complexity of control.

The following is a comprehensive (to my best knowledge) list of envelope segment types:

  • Delay: the amount of time between the note-on event and the start of the attack segment. Delaying the appearance of sound after a key-press is especially important in ambient music, where the musician can use this time to adjust the timbre parameters. We can control the length of this delay.
  • Attack: the initial portion of every envelope after a note-on event. In this segment the value is rising from the minimum envelope value to the maximum envelope value. When we “control the attack” we change the duration of this segment.
  • Hold: a segment where the envelope value is at its maximum; by controlling its length, we adjust how long will the controlled parameter be at its peak value.
  • Decay: the segment where the envelope falls from the peak value to the initial sustain value. We can control its length.
  • Sustain: the segment where the envelope maintains a constant level until a note-off event. We set the value of this level but its length is controlled by the performer.
  • Release: the final segment of any envelope, where the value falls from its current value to 0.

Linear or Exponential?

A very important consideration when implementing any envelope is how its value should change.

To be exact, should the amplitude increase linearly or exponentially (linearly on the logarithmic scale)? Below is a comparison of these two approaches:

Comparison of value change curves of envelopes Figure 3. A linear change in value (left) vs an exponential change (right).

The caveat here is that we perceive the exponential change as a linear one. To hear this, listen to these two examples.

Each one plays a sine at 220 Hz.

This one has the linear attack envelope (left in Figure 3).

This one has the exponential attack envelope (right in Figure 3).

Which change sounds more “linearly” to you?

For me, the exponential envelope.

In the linear envelope case, I can hear the sound instantaneously and then it becomes kind of louder whereas in the exponential case, I can hear a steady increase in volume.

This applies to amplitude envelopes, what about cutoff or frequency envelopes?

As our perception of frequency is logarithmic as well, these envelopes should also use exponential segments to make the impression of a linear change.

Warning: Although most depictions of envelopes show linear segments not exponential segments, in fact, an exponential change is meant. I follow this linear simplification in every depiction of an envelope in this article apart from Figure 1.

After learning the building blocks of envelopes, now it is time to see what types of envelopes are out there.

The Catalog of Envelopes

Below, I listed all types of envelopes that exist based on [Pluta2019, Russ09].

Their visualizations were created by me but I was heavily inspired by those great books so they should take all the credit.

Sound examples were created by generating 5 seconds of a sine at 220 Hz and applying the specified envelope as the amplitude envelope.

The Attack-Decay (AD) envelope consists of just two segments. It is a kind of “one shot” envelope that you cannot sustain. When you release a key during the attack, the envelope transitions to the decay slope with the current amplitude value.

Attack-Decay (AD) envelope Figure 4. Attack-Decay (AD) envelope.

Sound example:

AR

The Attack-Release (AR) envelope has 3 segments: attack, sustain and release. Sustain’s value is fixed to the maximum.

Attack-Release (AR) envelope Figure 5. Attack-Release (AR) envelope.

Sound example:

ADR

The Attack-Decay-Release (ADR) envelope has 3 segments. When the key is released, the envelope transitions to the release segment with the value it currently holds. It may happen that the envelope reaches 0 already in the decay segment. In such case, the release segment is omitted.

Attack-Decay-Release envelope Figure 6. Attack-Decay-Release envelope.

Sound example:

ADS

The Attack-Decay-Sustain (ADS) envelope has 4 segments, where that last is either a short, non-parameterized release segment (Figure 7) or a repeated decay segment (Figure 8).

Attack-Decay-Sustain (ADS) envelope with a short release segment Figure 7. Attack-Decay-Sustain (ADS) envelope with a short release segment.

Sound example:

Attack-Decay-Sustain (ADS) envelope with a repeated decay segment Figure 8. Attack-Decay-Sustain (ADS) envelope with a repeated decay segment.

Sound example:

ADSR

The Attack-Decay-Sustain-Release (ADSR) envelope is in my experience the most popular envelope type. It is an approximation of the impression of most musical instruments. It is also easy to control. Its practical usefulness resulted in its popularity among synthesizer players.

Attack-Decay-Sustain-Release (ADSR) envelope Figure 9. Attack-Decay-Sustain-Release (ADSR) envelope.

Sound example:

AHDSR

The Attack-Hold-Decay-Sustain-Release (AHDSR) envelope in comparison to ADSR has an additional hold segment between the attack and the decay, whose duration is an adjustable parameter.

Attack-Hold-Decay-Sustain-Release (AHDSR) envelope Figure 10. Attack-Hold-Decay-Sustain-Release (AHDSR) envelope.

Sound example:

ADBDR

The Attack-Decay1-Break-Decay2-Release (ADBDR) envelope is my personal favorite because it approximates the amplitude envelope of the piano; while the key is being held, the sound slowly decays. This is opposite of the sustain segment in ADSR, which to my taste sounds a little bit artificial. The “break” element allows to set the value at which decay 1 transitions to decay 2.

Attack-Decay1-Break-Decay2-Release (ADBDR) envelope Figure 11. Attack-Decay1-Break-Decay2-Release (ADBDR) envelope.

Sound example:

Arbitrary

Current synthesizers are capable of having an arbitrary envelope: one consisting of many segments where the envelope value is rising, falling, or constant. Although these give you the complete control over the sound, they are hard to change during performance and tend to sound repetitive. Therefore, I would restrict their usage to ambient/sound design applications.

An example of a commercial synthesizer that allows an arbitrary envelope is Massive from Native Instruments (Figure 12).

The user interface of Massive synthesizer from Native Instruments Figure 12. The user interface of the Massive synthesizer from Native Instruments (source).

Summary

In this article, you learned what is an envelope, what it can control, what are the possible envelope segments, and what is the difference between a linear and an exponential change in an envelope. Finally, you learned every possible type of envelope that exists. With this knowledge you are ready to use and code your own envelopes.

Envelopes is just one subject that you must learn if you want to develop audio plugins. To see which other subjects you should learn, download my free audio plugin developer checklist.

Bibliography

These two books are great resources on envelopes:

[Pluta2019] Marek Pluta, Sound Synthesis for Music Reproduction and Performance, monograph, AGH University of Science and Technology Press 2019.

[Russ09] Martin Russ, Sound Synthesis and Sampling, 3rd Edition, Focal Press, 2009.

Links above may be affiliate links. That means that I may earn a commission if you decide to make a purchase. This does not incur any cost for you. Thank you.