A compressor basically works like an automatic level control, restricting the overall dynamic range of an input signal. In other words, it limits the amount of variation between the loudest and the softest sounds.
Proper use of a compressor can prevent distortion from overload during loud sections of a song, smooth out unintentional peaks and drops in a performance, and provide additional sustain for electric guitars. Improper use can add unwanted noise or accentuate noise already present in a signal. Excessive use can destroy the dynamics of a piece.
The most important control is the threshold control. It tells the compressor the level that the signal must be at in order to start working, and it's expressed in decibels, abbreviated dBs. So, for example, if you are processing your guitar signal, and you set your compressor's threshold to -30dB, the guitar must be louder than -30dB in order for the compressor to care. If your guitar signal comes in at -31dB, nothing happens. If the signal is -29dB or higher the compressor starts to work by reducing the gain of the signal. But how does the compressor know how much to reduce the gain.
The ratio knob sets the amount, or severity, of compression of the input signal once the threshold has been exceeded. It determines the change in the output level that results from a particular input level, and is also expressed in dBs. For example, if the ratio is set to 2 (that really means a ratio of two to one [2:1]), then for every 2dB of incoming signal in excess of the threshold, there will only be a 1dB increase in the output level. Higher ratios, such as 4:1 and 8:1 mean more reduction in the output level, and also mean the output signal is even closer to the level of the threshold.
Extreme amounts of compression, ratios of 10:1, 15:1, or higher, are known as limiting, because the output will increase very little over the threshold, effectively creating an upper limit for the loudness of the sound. Many compressors can be set to an infinite ratio (look for the infinity symbol), meaning that the compressor will not exceed the threshold for any input signal. This can be very valuable when doing digital recording, when exceeding the 0VU mark produces nasty digital distortion, since unlike analog tape, there is no headroom above 0VU.
The attack control lets the compressor know how long to wait before starting to do its job, once it figures out that the input threshold has been exceeded. Attack is measured in milliseconds(ms), with attack times of 1-100 milliseconds considered 'fast', and greater than 100 milliseconds considered 'slow'. The faster attack times will tend to compress high-level peak transients, such as drum hits, or bass guitar slaps, whereas the slower times will let the quick peaks pass uncompressed. Why use slower attack times? There are occasions when the original sizzle or bite of a sound will be lost when using attacks of less than 100 milliseconds. As long as allowing the peaks to be heard does not cause distortion further on down the signal path, you may prefer the sound that using longer attack times will give you.
Compressors without an attack control tend to automatically use faster attack times when the volumes are much higher than the threshold, and slower attack times when the input levels are just over the threshold.
A fourth control found on many compressors is the release control. When the signal drops back below the threshold level, the release control tells the compressor how long to take to get back to normal, when it is no longer modifying the input signal. You'll usually see release times either measured in milliseconds or seconds, with release times of 1000 milliseconds (1 second) considered 'fast', and greater than 1000 milliseconds considered 'slow'.
Slower release times tend to smooth out the signal, and for guitars, can help increase sustain. However, if the release is set too long, the gain will remain turned down for a while after the loud sound has ended. This may result in causing quiet sounds that occur between loud sounds to be turned down as well. There's also a danger with setting release times too fast. Quick release times will make the compression effect too noticeable, to the point where you can hear a very unnatural 'pumping' or 'breathing' sound as the signal level goes up and down. In general, the release should be set fast enough to recover in time to process the next bass slap, power chord or drum hit.
Again, like the attack control, some budget compressors might not include a release time control. Some models simply have switches for 'slower' and 'faster' release. If there is no release control at all, the manufacture has designed the compressor to use a release time to fit the most common musical situations.
Some compressors have an additional control called a peak level control and like the threshold control, it's expressed in dBs. Using this control, you can set a level which will not be exceeded at the output, even when you have a very quick, loud sound, such as a snare drum hit. This control gives you additional flexibility, because now the ratio control can be used for smaller compression ratios (4:1 or lower), while you still have an upper limit in place to avoid possible overload or distortion due to unexpectedly high signal levels.
Additionally, you'll probably have an output gain control to set the final output level. This is needed because the compressor is reducing the level of signals that cross the threshold, so an additional stage of gain is used to bring the signal back up to a nominal level.
Soft Knee Compression
Another approach to compression is what's known as soft knee or over easy compression. Instead of a user-defined threshold control, a soft knee compressor is always working, automatically applying more compression (a higher ratio) as the signal gets louder. The compression is very low to minimal when the signal is very soft. Some manufacturers apply a bit of soft knee compression to the signal even when they provide a threshold control. It simply means that a bit of compression is beginning as the signal approaches the threshold, and the user-defined ratio is applied once threshold is reached. Some musicians and engineers like the soft knee approach, claiming a warmer sound due to the gradual transition from uncompressed to compressed sound. It's also claimed to make the compression a bit less noticeable.
You can see the advantages that using a compressor might have over the old method of controlling the dynamics of a piece by 'riding' the gain. The engineer who wished to eliminate peaks and high signal levels used to have to listen carefully with hands on faders, trying to anticipate the loud points in the music, and frantically making abrupt adjustments. Once the compressor's controls are set up properly, the compressor is automatically doing all the adjustments in gain, much faster and much more accurately than the best human engineer.