Compressor BasicsThe first thing to get clear is that the term "compression" is used in two ways in digital audio, and they're completely different:
Dynamic Range Compression - Making peaky audio less peaky, usually so we can make it louder without clipping. If that's what you're interested in, read on.
What's compression for?
We use compression (dynamic range compression, that is) to smooth out vocal parts, make acoustic guitar parts sound stronger, and to help tame peaks that are making our mixes clip even though the levels are very low. Things like that.
There are purists who believe that we should strenuously avoid the use of compressors, since they sap the lovely dynamics out of the music. They have a valid point. However, in practice we find it sounds good so we do it. Not least because sometimes our dynamics aren't so lovely, and we want to tone 'em down. Like any processing, it's important not to overdo it, and use good judgement.
Compression is used in two rather different contexts:
What IS a compressor?
Inside of a compressor is a little elf. A really quick dude with great ears ... well, all elves are like that, aren't they?
In the typical compressor, the elf does his job according to instructions that generally contain four numbers or "parameters".
The elf listens to the input and has his hand on a volume knob. If the loudness goes above a limit (a parameter called the threshold), he turns down the volume on the output. The amount he turns it down is based on how high the loudness went above the threshold, and another parameter called the ratio. The bigger the difference between the loudness and the threshold, the more he turns it down. And the higher the ratio, the more he turns it down.
When he turns the knob down, he doesn't do it in one quick click, but actually turns the knob in a smooth adjustment. The speed of this adjustment is governed by a parameter called the attack rate or time constant.
If the loudness goes back down, the elf turns the volume back up, but at a much slower rate, governed by the last parameter, the release rate or time constant.
So if the elf only lowers the volume, how does this make things louder (the usual reason for using a compressor)?
Well, there's usually a boost after the elf, sometimes called the post gain. It's usually a constant boost so the elf doesn't need to be concerned by it. So, by adjusting the amount of boost, you can control how much you're raising the quietest parts (if at all) versus how much you're lowering the loudest bits (if at all).
BTW, that's just a typical compressor. There are other varieties, like opto-compressors. These were the first variety and worked something like the above but the effect was due to lucky physics when passing the sound optically through a light bulb and photoreceiver. Engineers noticed this effect and built components for the purpose. Also, there's tape saturation, which also causes a very lovely sounding compression. And then there are special-purpose compressors that work like the typical one, but have parameters in different ranges (limiters), or that work in rather different ways (brickwall limiters). Finally, different compressors use slightly different control laws (math), leading to much confusion in deeply technical discussions with laymen like me. :)
How should we set up a compressor?
Generally, the best way is to set the ratio to a given "starting" value like 3:1. Set the threshold to the top (0dB), and while listening to the material, draw the threshold down until you hear the compression working the way you want it to sound. Sometimes it's a good idea to go a bit too far and then back off. The usual rule about avoiding over-use applies here, so it's usually a good idea to then back off a bit more on principle.
Now you'll find that the material is quieter than it was. (Unless the compressor you're using has "automatic gain compensation", in which case it will sound louder.) In any case, you can compensate for the loudness change using the compressor's post gain. You want to adjust the post gain so that the peaks are as high as possible without clipping (as usual). Then you'll need to adjust the track fader to make the part fit well in the mix.
If you didn't achieve the amount of compression you need, set the ratio higher and try again. With experience you'll get an idea of what ratios serve best for various purposes, and you'll have a better idea what ratio to use for your first try.
While the purpose isn't to increase the overall volume, it will tend to have that effect, at least a little. For starters, apply it on vocal, bass, and acoustic guitar tracks, and any other tracks where the volume varies more than you think it should -- i.e., tracks that sound too loud in some parts and too quiet in others. Use compression to smooth this out.
When adjusting the compression on a track, make sure you're listening to the whole mix, not just the track you're adjusting. (Sure, you can listen to just the track to help understand what the controls do. Just don't make any judgements about what sounds best unless you're listening to the whole mix.) After you adjust each track, go back and do it again, because you've just changed the whole mix. Adjustments, if any, should get smaller on each pass. When adjusting the compression, you'll also be adjusting the track fader because the compression affects the track level. (I.e., fuss with all the knobs!)
Then mix to get a good overall sound without worrying too much about overall volume. Make sure there's NO clipping in the mix. After applying some compression to individual tracks, though, you'll find that the overall mix can be louder without clipping.