As the name implies, compression reduces the dynamic range of a signal. It is used extensively in audio recording, production work, noise reduction, and live performance applications, but it does need to be used with care. It is commonly said that compressors make loud sounds quieter, and the quiet sounds louder, but this is actually only half-correct.
How it Works
A compressor is a variable gain device, where the amount of gain used depends on the level of the input. In this case, the gain will be reduced when the signal level is high which makes louder passages softer, reducing the dynamic range. The basic scheme is shown in Figure 1.
Figure 1: Flow diagram of a compressor. It is also possible to do the level detection after the gain is applied (a feedback compressor, rather than feed forward).
A compressor's input/output relationship is often described by a simple graph, as in Figure 2. The horizontal axis corresponds to the input signal level, and the vertical axis is the output level (both measured in decibels). A line at 45 degrees corresponds to a gain of one - any input level is mapped to exactly the same output level. The compressor changes the slope (makes it more horizontal) of that line above some value called the threshold (which is most often adjustable). The height of the line defines the dynamic range of the output, and the slope of that line is the same as the compressor's gain.
Figure 2: The compressor weakens the input signal only when it is above the threshold value.Above that threshold, a change in the input level produces a smaller change in the output level.
The compressor setting is usually stated as a ratio, such as 2:1, which means that the input level would have to increase by two decibels to create a one-decibel increase in the output. With a 4:1 setting, the input would need to change by 4 dB for a 1 dB change in the output level, and so on. Limiting is simply an extreme form of compression where the input/output relationship become very flat (10:1 or higher). This places a hard limit on the signal level.
So looking at Figure 2, we can see that the compressor makes loud signals quieter, but it does not make quiet sounds louder (although it may be perceived that way). However most compressors do have a secondary gain stage for adjusting the output level so that if you turn the compressor on while playing, the extra gain will prevent your instrument's volume level from dropping. You can make a case that this extra gain stage is or is not really part of a compressor, but in any case, that is what makes the softer sounds louder.
So far, we have not discussed exactly how the level detector in the compressor operates. It is usually some sort of time average of the input (often a root-mean-square (RMS) calculation). Alternatively, the instantaneous peak voltage or sample value can be used, in which case, the compressor becomes a hard limiter.
When the level sensing function is a short time average, the compressor will take a little time before the gain is adjusted to meet the new input level. The amount of time the compressor takes to respond when the input level rises above the threshold is called the attack time, and is usually fairly short (less than 100 ms.). When the input level is above the threshold and then drops below it, the compressor will take some time to increase the gain as well. This is the release time of the compressor, which is generally larger than the attack time (possibly up to a second or two). Figure 3 shows how the attack and release times affect an example input.
Figure 3: The effects of a compressor on a signal. Only the middle portion of the input is above the compressor's threshold. Note the overshoot when the signal level increases (it takes some time for the gain to decrease), and the attenuation when the input signal returns to the first level(and the gain increases). The release time is generally longer than the attack time.
At times it may be desirable to have a very short attack or release time which requires a quick change in the gain, which in some cases can be heard as a 'breathing' or 'pumping' sound. When the sound level drops below the threshold, the gain increases (to a gain of one). The input signal is now closer to the noise level in the system, so the noise can be made audible. A more sophisticated compressor may watch the input closely and adjust the gain when the input hits zero shortly to reduce the 'breathing' effect.
Why use Compression/Limiting?
To illustrate one important application, it is best way to go back to the early 1900's. At the time, the 'records' were recorded by having a singer or musician playing into a horn, which would then cause a needle to trace a groove into a wax master (the system was totally acoustic - no electronics whatsoever). The sound would cause the needle to wiggle a small amount. However, if you were to sing too loudly, then the needle would cross into the neighboring track, ruining the work. There was no way to restrict the audio level in the recording process. The same situation holds with other recording media, though it is not as physically obvious. For example, if signal levels get too high when recording to magnetic tape, there will be distortion. However, to make a good recording, you want to keep the signal level up above the background noise. Compressors and limiters provide protection against sudden transient sounds that could result in distortion or damage to equipment.
In the studio, compression is a useful tool when cutting tracks and adjusting the mix. For example, in a session, the singer may be moving to and away from the mic, and a little compression will even out the volume changes that would otherwise be recorded. Once the tracks have been recorded, a compressor gives you a way to adjust the dynamic range of the track and balancing the tracks. Using an appropriate attack time, the naturalness of an instrument's sound will get through before the compression sets in. In some cases, compression may even reduce the need for equalization.
One popular use of compression is to increase an instrument's sustain. This is technically incorrect since a compressor does not change an instruments behavior, and it only operates on an audio signal. The compressor will try to maintain a constant level of output by amplifying the incoming signal to maintain that constant level. For example, after a string on a guitar is plucked, the voltage produced by the pickups gradually dies away. A little compression will keep the instrument's level from changing radically after its plucked, which is perceived as increased sustain or a 'smoothing' of instrument. A release time longer than the instruments decay will preserve the instrument's sound.
Note that there is a trade-off with the compressor. You may want to have as much sustained as possible, but in the process, you are eliminating your playing dynamics so you can no longer accent notes and phrases effectively. The attack of an instrument is very important factor is the instrument's sound and hard limiting can take 'life' out of an instrument. Moreover, of course you can use extreme settings on a compressor to create unusual sounds from instruments.
So far, we have been talking about compressors that process the signal that is being used in the level detection process. However, in some cases, you would prefer to have a signal's level controlled by a different signal - when one signal level is high; the other signal is attenuated, as in Figure 4. This is called 'ducking' (since it 'ducks' a signal out of the way) or cross limiting. The most common example would be a radio DJ. While music is playing, speaking into the microphone will cause the level of the music to drop so that it is easier to understand the DJ. When mixing in the studio, a ducker can also be used to emphasize certain elements, such as the kick drum. The kick could lower other tracks in the mix, increasing its 'presence.'
Rather than monitoring the level of the input signal, you could watch only a certain frequency range, and this is what a 'de-esser' does. It is simply a limiter that operates on high frequency components (separated out of the input with some filtering system) in the signal. When the level of high frequencies rises above the threshold, only that frequency band is reduced in volume. This allows it to tame the 's' sounds, such as in 'set.'
Placement in the Effects Chain
When using the compressor along with other effects, it is most often best to put it first in the chain, primarily for noise reasons. When the compressor is on (which reduces the output peak dynamic range) and the output level is increased with the additional gain, the noise will be amplified along with the instrument's sound. Other effects can introduce more noise into the system, so if you put the compressor after those effects, you will end up amplifying that noise as well. Using the compressor first in the chain also gives the other effects a better signal to work with.
Eargle, John. Handbook of Recording Engineering. New York: Van Nostrand Reinhold, 1992. (ISBN 0442222904) Keene, Sherman. Practical Techniques for the Recording Engineer. Sedona: S. K. E. Publishing, 1981. (ISBN 0942080122) Orfanidis, Sophocles. Introduction to Signal Processing. New Jersey, Prentice Hall. 1996. (ISBN 0132091720)