# Envelope detector

An envelope detector (sometimes called a peak detector) is an electronic circuit that takes a (relatively) high-frequency signal as input and outputs the envelope of the original signal.

## Diode detector

A simple form of envelope detector used in detectors for early radios is the diode detector. Its output approximates a voltage-shifted version of the input's upper envelope.
Between the circuit's input and output is a diode that performs half-wave rectification, allowing substantial current flow only when the input voltage is around a diode drop higher than the output terminal.
The output is connected to a capacitor of value $C$ and resistor of value $R$ in parallel to ground. The capacitor is charged as the input voltage approaches its positive peaks. At other times, the capacitor is gradually discharged through the resistor. The resistor and capacitor form a 1st-order low pass filter, which attenuates higher frequencies at a rate of -6 dB per octave above its cutoff frequency of ${\tfrac {1}{2\pi RC}}$. The filter's RC time constant $(\tau {=}RC)$ must be small enough to track quickly-falling envelope slopes and "top up" the envelope's voltage every peak to prevent negative peak clipping.

### AM demodulation

Envelope detectors can be used to demodulate an amplitude modulated (AM) signal. Such a device is often used to demodulate AM radio signals because the envelope of the modulated signal is equivalent to the baseband signal. To sufficiently attenuate the frequency of the carrier wave frequency $f_{\text{carrier}}$, the cutoff frequency of the low-pass filter should be well-below the carrier wave's frequency. To avoid negative peak clipping, the original signal that is modulated is usually limited to a maximum frequency $f_{\text{max}}$ to limit the maximum rate of fall of the AM signal. To minimize distortions from both ripple and negative peak clipping, the following inequality should be observed:
${\frac {1}{f_{\text{carrier}}}}\ll \tau \ll {\frac {1}{f_{\text{max}}}}\;.$
Next, to filter out the DC component, the output could pass through a simple high-pass filter, such as a DC-blocking capacitor.

## General considerations

Most practical envelope detectors use either half-wave or full-wave rectification of the signal to convert the AC audio input into a pulsed DC signal. Full-wave rectification traces both positive and negative peaks of the envelope. Half-wave rectification ignores negative peaks, which may be acceptable based on the application, particularly if the input signal is symmetric about the horizontal axis. Low threshold voltage diodes (e.g. germanium or Schottky diodes) may be preferable for tracking very small envelopes.
The filtering for smoothing the final result is rarely perfect and some "ripple" is likely to remain on the output, particularly for low frequency inputs such from a bass instrument. Reducing the filter cutoff frequency gives a smoother output, but designers must compromise this with the circuit's high frequency response.

## Definition of the envelope

Any AM or FM signal $x(t)$ can be written in the following form
    $x(t)=R(t)\cos(\omega t+\varphi (t))\,$
In the case of AM, φ(t) (the phase component of the signal) is constant and can be ignored. In AM, the carrier frequency $\omega$ is also constant. Thus, all the information in the AM signal is in R(t). R(t) is called the envelope of the signal. Hence an AM signal is given by the function
    $x(t)=(C+m(t))\cos(\omega t)\,$
with m(t) representing the original audio frequency message, C the carrier amplitude and R(t) equal to C + m(t). So, if the envelope of the AM signal can be extracted, the original message can be recovered.
In the case of FM, the transmitted $x(t)$ has a constant envelope R(t) = R and can be ignored. However, many FM receivers measure the envelope anyway for received signal strength indication.

## Precision detector

An envelope detector can also be constructed using a precision rectifier feeding into a low-pass filter.

## Drawbacks

The envelope detector has several drawbacks:
* The input to the detector must be band-pass filtered around the desired signal, or else the detector will simultaneously demodulate several signals. The filtering can be done with a tunable filter or, more practically, a superheterodyne receiver
* It is more susceptible to noise than a product detector
* If the signal is overmodulated (i.e. modulation index > 1), distortion will occur
Most of these drawbacks are relatively minor and are usually acceptable tradeoffs for the simplicity and low cost of using an envelope detector.

## Audio

An envelope detector is sometimes referred to as an envelope follower in musical environments. It is still used to detect the amplitude variations of an incoming signal to produce a control signal that resembles those variations. However, in this case the input signal is made up of audible frequencies.
Envelope detectors are often a component of other circuits, such as a compressor or an auto-wah or envelope-followed filter. In these circuits, the envelope follower is part of what is known as the "side chain", a circuit which describes some characteristic of the input, in this case its volume.
Both expanders and compressors use the envelope's output voltage to control the gain of an amplifier. Auto-wah uses the voltage to control the cutoff frequency of a filter. The voltage-controlled filter of an analog synthesizer is a similar circuit.
Modern envelope followers can be implemented:
* directly as electronic hardware,
* or as software using either a digital signal processor (DSP) or
* on a general-purpose CPU.