Dynamic range compression or expansion involves the modification, typically via a time-varying gain control, of a signal's dynamic range.
The reduction of a signal's dynamic range is referred to as compression, while a range increase is referred to as expansion
Applications of dynamic range reduction/compression include:
increase perceptual loudness;
peak limiting;
transmission to a system with lower dynamic range;
reproduction of material with wide dynamic range in noisy environments;
to achieve timbre variations.
Applications of dynamic range expansion include:
noise suppression (noise gate or downward expansion);
restore dynamic level of a previously compressed signal;
add dynamic range for perceptual effect.
If a signal has a short-term signal level given by
over the period , the dynamic range of the signal is given by
, and is usually expressed in decibels.
Various metrics exist for estimating or evaluating the short-term level of a signal, including peak, average, and average root-power levels.
The short-term peak value of a signal (i.e., the greatest absolute value within the last seconds) is given by:
Figure 5:
A signal and its short-term peak and average root-power level estimates.
The short-term average root-power level can be defined as:
where denotes convolution and is the unit step function. The value of is thus formed by squaring the signal , performing a “leaky” integration, and taking the square root of the result.
A “leaky” integrator can be implemented in discrete time as:
where for unity gain and for filter stability.
Automatic gain control involves the application of a time-varying gain to a signal, based on an estimate of the signal level.
The compression/expansion gain control is typically specified as a memoryless function that takes a signal level estimate as input and produces a desired gain level as output (levels in dB). An example compression curve is shown in Fig. 6 (the dashed line indicates an input-to-output ratio of 1).
Figure 6:
A static compression curve (top: in dB; bottom: on a linear scale.
The dB output level is equal to the dB input level up to a threshold level (near -50 dB in Fig. 6). Beyond , a constant compression ratio is defined by such that there is an increase of dB in output for every dB increase of the input.
For example, if the compression ratio is 3:1, an input signal that is 9 dB over the threshold will be attenuated (by subtracting 6 dB from the input signal level) to a level 3 dB over the threshold. That would correspond to a linear attenuation factor of 0.5 being applied to the input signal.
The time duration over which the input signal level estimates are calculated has important influence on the response of the compression/expansion system.
It is often desirable that a compressor limit peak amplitudes. This ability requires a relatively small value. However, small values of result in more level variance, which is generally undesirable. For this reason, different integration constants are often used for the attack and release portions of a signal.