Dynamics: compressors, limiters and loudness
A sound’s dynamics are how its level moves: a whisper and a shout, the snap of a drum against the ring that follows it, a quiet verse and a loud chorus. A great deal of audio processing exists to change them: to keep a voice steady, to stop a peak from clipping, to make a podcast sound even, to fit music into a hearing aid’s narrow range, and, for a couple of decades, to make records as loud as possible.
It leans on:
- Sampling and reconstruction, for decibels, full scale, and what happens between the samples.
- Designing IIR filters: a level follower is a one-pole low-pass, and the loudness meter starts with two biquads.
- Mapping your hearing: equal loudness explains how loudness meters weight frequencies, and your audiogram can drive section 7’s hearing aid.
- A synth to play: every synthesis page on this site plays through a limiter, so that big chords don’t clip.
1 · Peaks and averages
Section titled “1 · Peaks and averages”Two numbers describe a sound’s level. Its peak is the biggest sample, and it’s what clips: nothing digital goes past 0 dBFS. Its RMS (the root of the mean square) measures its average power, and is much closer to how loud it sounds. The gap between them is the crest factor.
The waveform, its peak (dashed) and its RMS level (solid). A sine’s crest factor is 3.0 dB (a square wave’s would be 0). The drum loop’s is 15.0 dB: short, sharp hits with little in between. The sentence’s is 18.1 dB, and the tracker tune’s 11.5 dB: busy music, with something always playing.
A sound with a high crest factor has to be turned down so its peaks fit, which leaves its average low: it sounds quiet for its peak. Lower the crest factor, by turning the peaks down and leaving the rest, and the whole sound can be turned up. That’s most of what this page is about.
2 · Following the level
Section titled “2 · Following the level”To react to a sound’s level, a processor first has to measure it, moment by moment: an envelope follower. The level of a single sample is no good on its own: a sine passes through zero twice a cycle. So the follower smooths it, with a one-pole filter (as on the IIR page) that uses two time constants: an attack time when the level rises, and a release time when it falls. Each is the time to get 63% of the way to a new level.
The drum loop’s level, sample by sample (faint), and followed (blue). A short attack catches each hit at once; a long release lets the level down slowly between them. A peak detector follows the biggest samples; an RMS detector follows the average power over 10 ms, and sits lower and smoother.
3 · The compressor’s curve
Section titled “3 · The compressor’s curve”A compressor turns the sound down when its level goes over a threshold, by an amount set by the ratio: at 4 : 1, every 4 dB the input goes over the threshold comes out as 1 dB over. Below the threshold it does nothing. A soft knee bends from one to the other over a few decibels, so it’s harder to hear the compressor starting to work. Then makeup gain turns everything back up: the peaks are lower, so there’s room.
For a level (dB), threshold , ratio , and knee width , the gain is
Top: the static curve, the output level for a steady input level (dashed: unchanged). Bottom: the sound’s level going in (faint) and coming out (blue), and the gain reduction (orange), with an attack of 5 ms and a release of 150 ms. At the settings shown (threshold −24 dB, 4 : 1, a 6 dB knee), the drum loop is turned down by up to 14.9 dB, its RMS level falling from −16.0 to −27.1 dBFS. The drums’ hits stand out further from their tails afterwards (9.2 dB before, 14.7 after): section 4 shows why. With a ratio of ∞ : 1 it’s a limiter.
4 · Attack and release: what compression sounds like
Section titled “4 · Attack and release: what compression sounds like”The attack and release times shape the sound as much as the curve does. With a fast attack, the compressor catches each drum hit and turns it down: the hits lose their snap. With a slower one, the start of each hit gets through before the gain comes down, and then the compressor squashes its tail: the hits stand out more than before. That’s why engineers often use a slow attack to add punch.
A fast release lets the gain recover between the hits, so the quiet parts come up loud: everything sounds denser, and with very fast releases the gain follows the waveform itself and distorts it. A slow release keeps the gain down after a loud moment; if it’s slow enough to hear coming back up, the sound pumps or breathes.
The drum loop through a compressor (threshold −30 dB, 6 : 1, with 10 dB of makeup), with the attack and release to change. “Stand out” compares each hit’s first 5 ms with 30 to 60 ms after it starts: 9.2 dB going in. With a 0.1 ms attack and a 60 ms release, 8.3 dB: the hits are flattened. With 1 ms, 14.4 dB. With 10 ms, 20.8 dB: the hits get through, and the tails are turned down. Lengthen the release to 1 s and the gain barely recovers between hits (12.1 dB, at a 10 ms attack): try the tracker tune with a long release, and listen to it pump.
Ducking: one sound turning another down
Section titled “Ducking: one sound turning another down”The level that decides the gain doesn’t have to come from the sound being compressed. In sidechain compression, it comes from another sound. Radio and podcasts use it for ducking: the music turns down whenever someone speaks, and comes back up when they stop. Dance music uses it the other way, with the kick drum ducking everything else, for the rhythmic pumping that’s part of its sound.
The tracker tune with the site’s sentence over it, the sentence as the sidechain: the music is turned down while it speaks, by up to the depth, and comes back over the release.
A de-esser is the same idea again: the sidechain is the sound itself, through a filter that picks out the “s” sounds (around 5 to 8 kHz), so only sibilance makes it turn down.
5 · Limiters, and the peaks between samples
Section titled “5 · Limiters, and the peaks between samples”A limiter is a compressor with an infinite ratio and a fast attack: nothing gets past the ceiling. But a compressor reacts to what has already happened, so the first moment of a peak always gets through. The fix is to look ahead: delay the sound by a millisecond or two, and let the gain see each peak coming. This page’s limiter takes, for each sample, the smallest gain needed anywhere in the next 1.5 ms, and averages that over the same 1.5 ms: every average then includes the gain the sample itself needs, so no sample ever passes the ceiling, and the gain still moves smoothly.
There’s a catch the limiter can’t see. The samples aren’t the waveform: a DAC draws a smooth curve through them, and the curve can rise between samples, above every one of them. These inter-sample peaks can clip in the DAC, or in an MP3 decoder, even though no sample reaches 0 dBFS. Meters find them by oversampling 4× (ITU-R BS.1770): the result is the true peak, in dBTP.
The tracker tune pushed louder into the ceiling (−1 dBFS), by the limiter (with and without look-ahead) or by hard clipping. Bottom: the extreme case of a peak between samples: a 12 kHz tone (a quarter of the sample rate) sampled 45° away from its peaks. Every sample reads 3.0 dB below the waveform’s real peak, which a DAC draws (green). Pushed 8 dB with look-ahead: no sample over −1.0 dBFS, the true peak −0.9 dBTP, and the loudness −7.5 LUFS (section 8). Hard clipping gets it louder (−4.4 LUFS) by squaring off the waveform, with a true peak of −0.5 dBTP, and audible distortion.
A 4× oversampler can itself miss a peak that falls between its own points, by up to a few tenths of a decibel for the highest frequencies, which is why masters usually leave 1 dB of headroom below 0 dBTP.
6 · Gates and expanders
Section titled “6 · Gates and expanders”The opposite job: making quiet sounds quieter. An expander turns the sound down below its threshold, by a ratio (1 : 2 turns every decibel below into two). A gate is an expander with a very large ratio: below the threshold, it shuts. They’re used to remove noise between notes or words, hum and spill between drums.
Gates have two extra controls, to stop them chattering open and shut on a level that hovers near the threshold: hold keeps the gate open for a while after the level drops, and hysteresis opens it at the threshold but closes it only some decibels below.
The sentence’s three phrases, half a second apart, with mains hum (50 Hz, and its third harmonic) and hiss under them, at the level set by noise. The gate (or expander) closes between the phrases, turning the noise down by up to the range. As set (noise −45 dB, threshold −35 dB, a 20 ms hold, closing over 40 ms), the noise between the phrases falls from −45.0 to −60.4 dB; as a 1 : 2 expander, only to −49.4 dB. Most of what’s left is the moments while it closes. The threshold has to sit well above the noise’s average level, because hiss keeps peaking above its average and the gate follows the peaks: at −40 dB it never closes. Too high, and it cuts off the quiet ends of words: at −35 dB it already dips for a moment between some words. A longer hold bridges those dips, but holds the gate open for the noise’s peaks too: with a 100 ms hold, the gaps fall only to −53.1 dB. Turn the noise down to −55 dB, and a threshold of −45 dB takes it to −67.4 dB.
7 · Hearing loss is a dynamics problem
Section titled “7 · Hearing loss is a dynamics problem”The most common hearing loss, from age or noise, isn’t the world simply getting quieter. It comes from damage to the cochlea’s outer hair cells, which amplify quiet sounds (by around 40 to 50 dB) and leave loud ones alone: the ear’s own compressor. Without them, quiet sounds go missing, but loud ones are about as loud as ever. The range from “just audible” to “too loud” shrinks, and loudness grows faster than normal within it: recruitment.
That’s why turning the volume up doesn’t help much. Enough gain to make quiet speech audible makes loud sounds painful. A hearing aid needs multiband compression: lots of gain for quiet sounds, little for loud ones, set separately in each frequency band, according to the loss in that band.
A model of the loss: in each band, levels from the threshold (raised by the loss) up to 100 dB SPL (uncomfortably loud) are heard as if spread from 0 to 100 dB SPL. Top: the loss in each band. Bottom: in one band, how each level is heard: with the loss, after a flat 20 dB boost, and after the hearing aid, which compresses 0–100 dB into the remaining range. In the 4 kHz band of the mild loss (35 dB), the aid’s ratio is 1.54 : 1: quiet sounds (20 dB SPL) get 28.0 dB of gain, and loud ones (90 dB SPL) only 3.5 dB. In this model the aid undoes the loss exactly. Choose your audiogram to use the one you measured on the hearing page: your best-heard band is taken as normal, since the calibration is unknown.
Real hearing loss does more than recruit. Damaged cochleas also lose frequency resolution: the ear’s filters (section 5 of the hearing page) widen, so sounds mask each other more, and speech in a noisy room blurs. No amount of compression fixes that, which is why hearing aids also use directional microphones and noise reduction, and why a quiet table in a restaurant helps more than anything.
Hearing as another ear hears
Section titled “Hearing as another ear hears”The same model can run the other way: take a sound, and play it as a different ear would hear it. How hearing changes with age is standardised: ISO 7029 gives the median loss at each frequency, for men and for women, for people with no ear disease or noise damage, as dB at age . To simulate an older ear, apply that ear’s loss with recruitment; for the blurring that comes with it, also smear each moment’s spectrum across frequency, as if the ear’s filters were wider, the method Thomas Baer and Brian Moore used to let listeners with normal hearing hear what wide filters do to speech in noise.
To hear as an ear with loss through your own ears, with loss , a sound has to reach you at the level your ear hears as ‘s ear would hear it: ‘s loss, then a hearing aid for . Towards a worse ear, that’s exact in the model (it takes information away). Towards a better ear, it’s the hearing aid again, with its limits.
A typical ear, at an age: ISO 7029’s median loss, for a listener with normal hearing: for men at 70, 33 dB at 4 kHz and 50 dB at 8 kHz; for women at 70, 27 and 39 dB (the faint lines are each decade’s medians). The standard stops at 8 kHz: above that the page holds the 8 kHz figure (shaded), which understates the loss there. Your ears, years from now: your ears (your audiogram, or typical for your age) with only the extra loss the standard expects over those years, so what you hear is what you’d hear then. Towards an 18-year-old’s: the hearing aid for your ears; bands you couldn’t hear at all on the hearing page are out of reach, and left alone. Blurring widens the filters; it can only be added, never taken away. The sentence over music shows what it does best. If the result would clip, it’s turned down to fit, and the readout says by how much.
Listen for what goes first: the “s”, “f” and “t” sounds, which carry much of speech’s meaning and live above 4 kHz. Vowels, which carry most of its loudness, are lower and survive longer. That’s why speech in older ears sounds loud enough but unclear: everything is there except the consonants.
8 · How loud is it?
Section titled “8 · How loud is it?”Neither peak nor RMS says how loud something sounds. Peak ignores how long a sound lasts, and RMS counts deep bass, which the ear hears poorly, as much as the middle. The standard answer, from the ITU (BS.1770) and adopted by broadcasters everywhere (EBU R128 in Europe, ATSC A/85 in the US, OP-59 in Australia), is LUFS: loudness units relative to full scale.
- K-weighting. Two filters: a high-pass that ignores the deep bass (the ear’s poor sensitivity there, from the hearing page’s equal-loudness curves), and a gentle lift of about 4 dB above 2 kHz (the head’s effect on sound arriving at the ears).
- Mean square, in blocks of 400 ms, overlapping, every 100 ms; the channels’ powers add.
- Gating. Blocks quieter than −70 LUFS (silence) don’t count. Then nor do blocks more than 10 LU below the average of the rest: a film’s quiet scenes don’t drag its loudness down.
- Average what’s left: the integrated loudness. A 1 kHz sine at −23 dBFS in both channels reads −23 LUFS.
The same blocks give the momentary loudness (each 400 ms), the short-term (3 s), and the loudness range (LRA, in LU): the spread of the short-term loudness, from its 10th percentile to its 95th, after gating.
Top: the K-weighting. Bottom: loudness over time. The test tone is the EBU’s gating test (shortened): 1 kHz at −36, −23 and −36 dBFS. The quiet parts fall below the relative gate (−35.0 LUFS), so only the loud part’s blocks count (123 of 197), and it reads −23.1 LUFS, as if the quiet parts weren’t there. The tracker tune reads −10.7 LUFS, the sentence −16.7, the drum loop −14.7.
This page’s meter passes the EBU’s compliance tests for loudness (EBU Tech 3341) and loudness range (Tech 3342): the page’s tests run them.
9 · The loudness war
Section titled “9 · The loudness war”Put two identical recordings side by side, one a decibel louder, and most people prefer the louder one: it sounds fuller and clearer, because (from the equal-loudness curves) more of it is audible. For radio, jukeboxes and CD changers, where songs played one after another at the same volume setting, a louder master stood out. So from the 1990s, masters got louder, by compressing, limiting and clipping them harder, until by the late 2000s many albums had almost no dynamics left: the loudness war.
Adverts fought the same war on television, compressed to sit at the same peak level as the programmes but much louder on average, until loudness regulations (from about 2010: EBU R128, the US CALM Act, Australia’s OP-59) made broadcasters measure in LUFS and hold everything to a target, around −23 or −24 LUFS.
The tracker tune or the drum loop, mastered louder: turned up by the slider, then brought back under full scale by the mastering limiter (ceiling −0.1 dBFS, 1.5 ms look-ahead, a fast 10 ms release) or by clipping. The tune as mixed is −10.7 LUFS, with a crest factor of 11.5 dB and a loudness range of 2.0 LU. Pushed 9 dB into the limiter: −6.2 LUFS, crest factor 7.8 dB; pushed further, the limiter can’t make it any louder (−5.9 LUFS at 18 dB): only clipping can (−3.4 LUFS at 9 dB, with true peaks above full scale, +0.4 dBTP). The drum loop goes from −14.7 to −9.7 LUFS at 9 dB, and its hits, which stood 9.2 dB above their own tails, now stand 2.5 dB above them.
The three buttons play the same comparison three ways:
- Mastered, at full loudness plays the master as it comes out of the limiter: what the loudness war was for. Next to the mix played at the same volume setting, it jumps out.
- A plays the mix, and B the master, both turned to −14 LUFS, as a streaming service would (or to the quieter version’s loudness, if that’s lower, so that neither is turned up). With the extra loudness taken away, all that’s left to hear is what the limiter did.
With the tune, A and B can be hard to tell apart. It’s a dense mix of sustained synth notes, already fairly even (2.0 LU of loudness range), and a limiter acts on peaks, which it has few of. The drum loop shows the damage plainly: in B, each hit’s crack is pulled down towards the ring after it, so the hits sound softer and more crowded, and the ring between them comes up. Pushing the slider to 18 dB, or switching to clipping, makes the difference easier to hear with either sound. Clipping adds distortion as well, heard as a harsh buzz on every hit.
The limiter holds every sample to −0.1 dBFS, but not the waveform between them: the limited drum loop’s true peak is +1.6 dBTP, enough to clip in a DAC or an MP3 decoder (section 5).
Streaming ended the war’s point. Services measure each track’s loudness and turn it to a target, typically between −14 and −16 LUFS. A track mastered to −6 LUFS is simply turned down 8 dB, and next to a dynamic master at the same loudness, it sounds flatter, not louder: the squashed peaks are all it has lost. Many recent masters have eased off as a result, though the loudest genres still push.
10 · Your own music
Section titled “10 · Your own music”Open a song, or two versions of one (an original release and a remaster, say), and measure them. Nothing is uploaded.
Nothing is uploaded: the files are measured in your browser.
Short-term loudness over time for each file (dashed: integrated), with the loudness range, true peak, the peak-to-loudness ratio (how far the true peak stands above the integrated loudness: a measure of dynamics that loudness normalisation doesn’t change), and how much a −14 LUFS service would turn it up or down. A and B play 20 seconds from the point chosen, both at the quieter one’s loudness.
Summary
Section titled “Summary”- Peak is what clips; RMS is nearer loudness; the crest factor is the gap between them.
- An envelope follower measures the level, with attack and release times.
- A compressor turns the sound down above a threshold by a ratio, with a knee, then makeup gain turns it back up. Its attack and release shape the sound: slow attacks keep the punch, slow releases pump.
- Sidechains let one sound duck another.
- A look-ahead limiter keeps every sample under the ceiling, but the waveform between samples can still go over: true peak, by oversampling.
- Gates and expanders turn the quiet parts quieter, with hold and hysteresis to stop chatter.
- Most hearing loss shrinks the range between audible and too loud (recruitment); hearing aids use multiband compression to fit sound into it.
- The same model plays a sound as another ear hears it: older ears by ISO 7029, with spectral smearing for their wider filters.
- LUFS measures loudness: K-weighted, in blocks, gated, averaged.
- The loudness war squashed music to make it louder; loudness normalisation made that pointless.
Further reading
Section titled “Further reading”- Dimitrios Giannoulis, Michael Massberg and Joshua D. Reiss, “Digital dynamic range compressor design: a tutorial and analysis”, Journal of the Audio Engineering Society 60(6), 2012: the knee formula and detector designs.
- ITU-R BS.1770-4, Algorithms to measure audio programme loudness and true-peak audio level, 2015.
- EBU R 128, Loudness normalisation and permitted maximum level of audio signals; EBU Tech 3341 and 3342: the meter’s behaviour, loudness range, and their compliance tests.
- Free TV Australia, Operational Practice OP-59: Measurement and management of loudness for TV broadcasting.
- ISO 7029:2017, Acoustics: statistical distribution of hearing thresholds related to age and gender (Formula 1 and Table 1 give the median).
- Thomas Baer and Brian C. J. Moore, “Effects of spectral smearing on the intelligibility of sentences in noise”, Journal of the Acoustical Society of America 94(3), 1993.
- Brian C. J. Moore, Cochlear Hearing Loss: Physiological, Psychological and Technical Issues (2nd edition, Wiley, 2007): recruitment, and what hearing aids can and can’t do.
- Earl Vickers, “The loudness war: background, speculation and recommendations”, 129th Audio Engineering Society Convention, 2010.
- Bob Katz, Mastering Audio: The Art and the Science (3rd edition, Focal Press, 2015).