Act X · The Studio and the Stage
Part 57 of 68Mastering and Loudness
What does mastering do to a mix, how is loudness measured, and why did making records louder stop paying?
In 2008 Death Magnetic's CD was mastered so loud that its peaks were clipped, while the Guitar Hero versions were not; an ear question hears Part 56's mix mastered gently (-14 LUFS, PLR 13 dB) and for loudness (-7.7 LUFS, PLR 6.7 dB, limited by up to 23 dB) at the same loudness. What mastering is for, and Monochord's chain (tilt EQ, glue, a look-ahead limiter, dither) stage by stage, heard. Meters: sample peak, VU and PPM on a snare hit; K-weighting; a 60 Hz and a 2 kHz tone at one voltage, 6 LU apart, heard. BS.1770 in four lines, the gates at work on a quiet start (-21.9 LUFS against -23.6 ungated), and the series' meter against ffmpeg's (within 0.05 LU and 0.1 dB); LRA and the targets of R 128 and the services. Inter-sample peaks: a sine 3 dB above its samples; a clipped master +2.5 dBTP; why converters and codecs care. The look-ahead limiter, close up, against a clipper, heard. The loudness war in numbers: six masters, the PLR falling from 15 to 6.7 dB while the loudness range hardly moves (as Deruty and Tardieu found), the limiter topping out near -7.7 LUFS; the sausage; three masters heard as mastered. Normalization to -14 LUFS (the loud master turned down 6 dB, its peaks now the lowest) and an ear question on which was mastered loudest. The loudness bias (an ear question: the same master 1 dB louder), level-matched blind comparison, and the series' own rule. Dither: rounding's staircase, error spectra, a fading note at 8 bits rounded, dithered and shaped, heard. Vinyl's groove and the RIAA curve (+19.3, -19.6 dB), a record without it heard; one master per medium; how this series is mastered. Frontier: what preference experiments found, after the war, machines that master. An album side of Variations, and one war-mastered beside itself.
What you need. Part 4 for loudness, equal-loudness curves and the ear's safety; Part 48 for sampling, quantization and the word length; Part 50 for compressors and saturation; Part 54 for the phone; Part 56 for the mix. Decibels, means and percentiles, interpolation.
- Ideas, mathematics and history
- the chain, true peaks, BS.1770 and LUFS, the loudness war measured, normalization, vinyl's RIAA curve and geometry
- What we build, compute and hear
- a loudness meter that agrees with ffmpeg; the same master, loud and dynamic
What you will be able to do
Foundations
- Hear one mix mastered gently and for loudness at the same loudness, and three masters as mastered and normalized.
- Hear a low and a high tone at one voltage, clipping against limiting, and one master made 1 dB louder.
- Hear a fading note rounded, dithered and noise-shaped, and a record played without its RIAA curve.
Full course
- Derive BS.1770's integrated loudness with K-weighting and both gates, and the loudness range of Tech 3342.
- Show why samples miss true peaks, measure them by oversampling, and hold them with a look-ahead limiter.
- Compute normalization gains, the cost of loudness in PLR, quantization with and without dither, and RIAA.
Research
- Find what peak-to-loudness ratio listeners prefer once everything is normalized, and where they listen.
Practice
- Meter, master and deliver for each medium: a loudness target, a true-peak ceiling, dither, comparisons at equal loudness.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Foundations 21 min · Full course 32 min · Research 34 min · Practice 32 min.
- 0A record too loud for its own goodFoundations3 min
- 1What mastering is forPractice2 min
- 2MetersFoundations3 min
- 3LUFS and gatingPractice3 min
- 4Inter-sample peaksPractice3 min
- 5Limiters and clippersPractice2 min
- 6The loudness war in numbersFoundations3 min
- 7NormalizationFoundations2 min
- 8Comparing at equal loudnessFoundations3 min
- 9DitherFoundations3 min
- 10Vinyl, files and this seriesFoundations3 min
- 11Frontier: loudness and preferenceResearch2 min
- Variation 57, recap and problemsAll tracks2 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
A record too loud for its own goodFoundations3 min
In 2008 Metallica fans compared two releases of the same songs, waveform by waveform. Compare by ear first. Part 56's mix, mastered twice: once gently, once for as much loudness as it would take. Here they are played at exactly the same loudness. Which was mastered for loudness?
The second. Here are the two waveforms, as delivered. The gentle master reaches minus fourteen LUFS, a unit we will build, and its peaks stand decibels above its loudness. The loud master is six decibels louder, and to get there its peaks were pushed down by up to decibels; they stand only above. At the same loudness, it is the one whose drums lost their snap: the sausage, engineers call that waveform.
The question has a history. In September 2008 Metallica released Death Magnetic. The CD was mastered so loud that its peaks were shaved flat, clipped, audibly, on track after track. The same songs, released for the video game Guitar Hero Three, used a less heavily limited version, which many fans preferred. Fans compared the waveforms, posted them, and petitioned for a remaster; the press called the album a casualty of the loudness war. A war fought since the jukebox: louder sounds better for a moment, so every record tried to be louder than the one before.
Normalization later changed the incentive, though loud mastering continued. Many streaming services introduced loudness normalization, with settings and policies that vary. A record mastered louder is simply turned down, and keeps only the damage. The automatic playback-level advantage was reduced on normalized playback, and the war's weapons, meters and limiters, became the instruments of the peace. This part builds them: a loudness meter, a true-peak meter, a limiter, a mastering chain, and dither.
Here is the plan. What mastering is for, and its chain. Meters: peak, VU, and the gated loudness of BS.1770, checked against an independent meter. True peaks, limiters and clippers. The loudness war in numbers, and normalization. Comparing at equal loudness, and dither. And vinyl, delivery, and the levels of this series itself.
1What mastering is forPractice2 min
Why does a finished mix need another engineer?
What is mastering? It is the last creative step in making a record and the first technical one in delivering it. A mastering engineer brings fresh ears and a room built for accuracy. They make the mix translate, with gentle equalization, to improve translation across playback systems; no master can guarantee identical reproduction everywhere, Part 56's phone included. They set a loudness that suits the medium, and peaks that will survive conversion. And they make an album: songs matched to each other, the order, the gaps and the fades, and then the files for every format.
Here is the chain Monochord uses, one illustrative order among several valid mastering workflows. The mix arrives at minus twenty LUFS. A tilt equalizer lifts the extremes a little. A gentle compressor, two to one, slow, makes the mix move as one. Then the look-ahead limiter, which sets the loudness: the mix is pushed into it until it reads, here, minus ten, with no peak above minus one. Last, dither, when the word length is cut, and the files. The crest factor hardly moves until the limiter, which takes five decibels of it.
Hear three stages, each at its own level: the mix, after the equalizer and the glue, and after the limiter.
The glue is barely audible, as it should be; the limited master is much louder, and that is exactly the trap: louder sounds better for a moment, whatever else has changed.
Mastering an album adds its own work. Songs are matched in loudness and tone, so that none jumps out. The order and the gaps are chosen; silence is part of the sequence. Fades and edits are made, start and end points set to the sample. Each track gets its identifiers, and the album its metadata. And there is one master for each medium: streaming, CD, vinyl and broadcast each want something different, as we will see.
2MetersFoundations3 min
What should a meter measure? A sample-peak meter shows the largest sample. It flags sample overload, but cannot by itself rule out reconstructed inter-sample overload, and nothing about how loud anything is. The VU meter of 1939 is a needle that averages over about three hundred milliseconds, roughly how loud speech and music seem. The BBC's peak programme meter rises in ten milliseconds and falls slowly, a broadcaster's guard against overload. None of them hears like an ear: as Part 4 showed, a deep bass and a bright tone at the same voltage are not equally loud. From 2006 there is a meter built on listening tests: the ITU's BS.1770.
Watch the three meters on a single snare hit. Its largest sample is at minus dBFS. The peak programme meter climbs to about below full scale and falls away slowly. The VU needle, averaging, never gets above minus : twenty decibels below the peak. A meter is a choice of what to ignore.
BS.1770 begins by filtering the signal. The K-weighting curve is two filters. A high-pass near forty hertz, so that deep bass counts for less, as the ear hears it at ordinary levels. And a shelf of four decibels above about one and a half kilohertz, which models the head: sound arriving at the ear is boosted there by diffraction round the head. Gilbert Soulodre's listening tests at the Communications Research Centre in Ottawa chose it, around 2004, as the simplest filter that predicted how loud people judged music to be.
Hear it: a sixty-hertz tone and a two-kilohertz tone with exactly the same RMS level, the same voltage on a meter.
The low tone sounds much quieter. A VU meter calls them equal; the K-weighted meter puts them loudness units apart, in the direction your ears do.
Can one number really stand for a song's loudness? It works because listeners judge a song's loudness much as they judge its average. It fails at the edges: very bass-heavy music, very sparse music, and listening far quieter or louder than usual. The loudness models of Part 4, Zwicker's and Moore and Glasberg's, do better, band by band, at a great cost in computation. BS.1770 won by being simple enough to put in every meter, every player and every television.
3LUFS and gatingPractice3 min
How do you measure the loudness of a whole song with one number?
The rest of the meter is four lines. Cut the K-weighted signal into blocks of four hundred milliseconds, overlapping by three quarters, and take each channel's mean square in each block. Add the channels, with surround channels weighted by one point four one, take ten log ten, and subtract nought point six nine one, a constant that makes a one-kilohertz tone at full scale read about minus three. Then gate: drop every block below minus seventy, which is silence, and then every block more than ten units below the loudness of what remains, which is quiet passages. The integrated loudness is the level of the mean of the surviving blocks, in LUFS: loudness units relative to full scale. One LU is one decibel.
Here are the gates at work, on our mix with a second and a half of silence in front and a first phrase fourteen decibels quieter than the rest. Each dot is one block. The silent blocks fall below minus seventy and are dropped. The quiet phrase's blocks fall more than ten units below the loudness of the rest and are dropped too. What remains reads below full scale, where without gates it would read : the song's loudness is the loudness of its music, not of its pauses.
The series has used this meter since Part 1, to set the level of every example. Here it is checked against ffmpeg's EBU R 128 meter, which shares none of its code, on four signals. The integrated loudness agrees to a few hundredths, the true peak to a tenth, which is how finely ffmpeg prints it, and the loudness range, which the two compute by different histograms, to within half a unit.
The standard has three time scales. Momentary loudness over four hundred milliseconds, short-term over three seconds, and integrated over the whole programme. And EBU Tech 3342 adds the loudness range: the spread of the short-term levels, from the tenth to the ninety-fifth percentile, after gating. Our steady mix has a range of units; with its first phrase fourteen decibels quieter, . The loudness range measures a song's dynamics, verse against chorus; the peak-to-loudness ratio, true peak minus integrated loudness, measures its hits. Remember the two: the loudness war will treat them very differently.
With a meter, regulators and services could set targets. European broadcasting adopted EBU R 128 in 2010: programmes at minus twenty-three LUFS, true peaks under minus one. American broadcast uses minus twenty-four, under the name LKFS. The AES recommends minus sixteen to minus twenty for streaming; service targets and modes vary; the values shown are illustrative rather than a permanent delivery standard. And this series' narration sits at minus sixteen, this course's chosen narration target, not a universal online-video requirement.
4Inter-sample peaksPractice3 min
Can a signal go over full scale without a single sample doing so?
Can a signal go over full scale when no sample does? Take a sine at a quarter of the sample rate, sampled forty-five degrees away from its peaks, and scale it so that every sample sits exactly at full scale. A sample-peak meter reads nought. But the samples stand for a continuous wave, the one a converter will rebuild, and that wave peaks three decibels higher, between the samples. An inter-sample peak.
So the standard measures the true peak. Oversample by four, with a low-pass interpolating filter, and take the largest value. At forty-eight kilohertz that catches inter-sample peaks to within about half a decibel. The unit is the dBTP, decibels relative to full scale, true peak. Monochord's meter oversamples with a polyphase filter, and agrees with ffmpeg's to a tenth.
This is not a curiosity. Push our mix to about minus seven LUFS by clipping its samples at minus nought point one: every sample is legal, and the true peak is plus dBTP. Flat tops are corners, and corners ring between the samples when the wave is rebuilt. Monochord's limiter, which watches the oversampled signal, holds the true peak at minus one.
Why does it matter? A converter that rebuilds a wave above full scale clips in its analogue stage: distortion on playback that no meter in the studio showed. Sample-rate conversion rebuilds the wave too, and lands new samples on the peaks. And lossy codecs, the subject of Part 58, change the waveform, and their decoded peaks overshoot by a decibel or more. So delivery specifications ask for minus one dBTP, or minus two for low bit rates: room for the wave to be rebuilt.
Where do the overs actually happen? A converter rebuilds the wave with an interpolating filter: the same arithmetic as the true-peak meter, at a finer step. Many converters leave a few decibels of headroom above digital full scale for exactly these overs; some leave none. So a master that is legal sample by sample can still distort on a cheap player. The true-peak ceiling provides headroom relative to a specified reconstruction estimate; later processing and playback implementations can still change peaks.
5Limiters and clippersPractice2 min
How do you make a record louder without letting a single peak through?
The tool that won the loudness war is the limiter. It is a compressor with an infinite ratio and an instant attack: nothing passes the ceiling. But an instant change of gain is a distortion in itself, so the gain must start falling before the peak arrives. Monochord's limiter looks ahead: at each moment it takes the least gain needed over the next one and a half milliseconds, and glides down to it. Its detector watches the true peak, oversampled four times, to reduce inter-sample overs; output still needs to be remeasured after processing. Then a release of eighty milliseconds lets the gain recover, and a final clip at the ceiling catches anything left.
Here is six tenths of a second of our mix pushed to about minus eight LUFS, close up, with the ceiling at minus one. In grey, the signal before: its drum hits go far over. A clipper slices them off: flat tops, corners and all. The limiter turns the whole signal down around each hit, by up to decibels, gliding down just before it and recovering after, so peaks are controlled by a moving gain rather than hard slicing alone; time-varying gain still changes spectrum and envelope.
Hear both at the same loudness: clipped, then limited. Listen to the drums. The clipped drums crackle on every hit, a buzz riding on the snare; the limited ones are clean, though their snap is a little softened. At this loudness the limiter wins; push both harder and both lose.
And yet engineers clip on purpose. Brief transient clipping can be hard to hear in some material, but audibility depends on amount, waveform and context, and buys level. A soft clipper rounds the corners, Part 50's hyperbolic tangent, trading a little distortion for a lot of loudness. Multiband limiters split the spectrum and limit each band apart, so that the kick does not pump the voice. The loud masters of the 2000s stacked all three, and then clipped the converter for the last decibel.
6The loudness war in numbersFoundations3 min
What does a louder master cost?
The war was an arms race. Vinyl and radio limited loudness by physics: a louder groove is a wider groove, and a shorter side. The CD, from 1982, had a hard ceiling and no other limit, and digital look-ahead limiters in the 1990s let masters press against it. A record louder than the one before stands out on the radio, in a shop, in a CD changer, so each one was. By the mid-2000s hit records were mastered ten decibels and more louder than in the 1980s. Emmanuel Deruty and Damien Tardieu, measuring decades of records in 2014, found what the war actually took: the hits got flatter, while songs kept their verse-and-chorus dynamics.
Here is the war in numbers, on our own mix, mastered by Monochord's chain at six loudness targets. At minus twenty and minus seventeen the limiter does nothing: the mix simply fits. From minus fourteen it starts to work, and every three decibels of loudness after that costs about three decibels of peak-to-loudness ratio, and more and more limiting. Asked for minus seven, it reaches only minus seven point seven: past that, no amount of drive makes this limiter louder on this mix. The masters of the war got there by clipping. And the loudness range hardly moves, as Deruty and Tardieu found.
Plotted against the loudness of the master: the peak-to-loudness ratio falls from fifteen decibels to under seven, the crest factor follows it, and the loudness range stays where it was, near the floor, because our mix was steady to begin with. What the war takes is the difference between a drum hit and everything around it.
And here is what fans saw in 2008, on our mix: the waveforms of four masters drawn at the same scale. At minus twenty the drum hits stand up from the rest. By minus seven the waveform is a solid block from edge to edge: the sausage.
Hear three of them as a CD player would play them, each louder than the last.
Played like this, the loudest is the most exciting, at first. That is the whole reason for the war, and the next chapter shows how normalization changed the playback advantage.
7NormalizationFoundations2 min
What happens to a loud master when the player turns everything to the same loudness?
Here is how normalization changes playback incentives. A player measures each track's integrated loudness, or reads it from the file, and plays the track with one gain. The gain is the target minus the track's loudness, so louder masters are turned down. Quieter ones are turned up only as far as their true peak allows, or not at all. From the early 2010s it became the default on radio, on television under R 128, and on the big streaming services. The simple gain advantage is reduced when normalization is active: a master six decibels louder is simply played six decibels quieter.
Take three of our masters to a player normalizing to minus fourteen. The minus twenty master is turned up by decibels, as far as its peaks allow. The minus fourteen master is left alone. The minus eight master is turned down by . All three now play at nearly the same loudness, but the loud master's peaks are now the lowest of the three: the drums of the gentle masters hit six decibels harder.
Your turn. The same three masters, in some order, each played as a streaming service would play it. Which was mastered loudest?
The first. Normalized, it is no louder than the others, and it is the flattest: its drums hit softest. The war's master is now the one that sounds smallest.
One detail matters for albums. Track normalization brings every song to the target, so a quiet ballad comes up as loud as the single. Album normalization uses one gain for the whole album, keeping the balance the mastering engineer chose between songs. Some services use album gain in supported album-playback modes; playlists, settings and implementations differ. So the right master is no longer the loudest, but the one that sounds best at the target.
8Comparing at equal loudnessFoundations3 min
Can you trust your ears when one version is louder?
Your turn again. Two masters of Part 56's mix. Listen to both, and decide which sounds better: fuller, clearer, more alive.
If you chose the second, you are in good company. They are the same source master; the second is multiplied by a one-decibel gain, so the samples differ only by that scaling, and nothing else. A decibel is barely a change in loudness, and yet it can bias quality judgments; this demonstration does not measure a universal preference.
Why? Louder really does sound fuller: the ear's equal-loudness curves flatten as level rises, as Part 4 showed, so bass and treble come up, and quiet detail rises above the room's noise. Listening tests find that a version a fraction of a decibel louder is preferred even when the listeners report no difference in level. So every plug-in that makes things a little louder seems to improve them, and every comparison of masters is rigged unless the levels are matched. The loudness war ran on this bias, one decibel at a time.
So comparisons have a method. Match the integrated loudness to a tenth of a decibel before comparing anything. Switch quickly, because memory for timbre fades within seconds. Compare blind: the ABX test, from David Clark's comparator of about 1980, asks only whether X is A or B, and the listener must not know. Repeat, and count: twelve or more correct out of sixteen has a one-sided binomial chance probability of about three point eight per cent, for a preplanned independent fair-guess test; repeated testing needs adjustment, as Part 67 will show. The ITU's BS.1116 and the MUSHRA method formalize all this for testing codecs and systems, which Part 58 uses.
This series has followed the rule from the start. Every ear question compares sounds already matched in loudness, unless loudness is the point. Each clip is set by its loudest four hundred milliseconds, to minus fifteen LUFS for an example, minus twenty-one for one meant to sit back. So when Part 50 compared a compressed sound with the original, the comparison aims to reduce loudness bias; a momentary meter match is not a guarantee of equal perceived loudness, and in this part's hook the gentle master did not lose by being quieter. Equal loudness is what makes an ear question fair.
9DitherFoundations3 min
Why add noise on purpose?
The last step of the chain is the smallest. Part 48 showed that each bit is worth six decibels: sixteen bits give a range of decibels, twenty-four bits . A master is made in thirty-two-bit floating point and delivered in twenty-four or sixteen bits, so its word length must be cut. Rounding a loud signal leaves an error that looks like noise. But rounding a quiet one leaves an error that follows the signal: distortion, worst in fades and reverberation tails, exactly where music is most delicate.
See it on a sine only two and a half quantization steps tall. Rounded, it becomes a staircase, and its error repeats with every cycle: harmonics that were never in the music. Now add a little random noise before rounding, triangular-distributed, two steps from peak to peak. Each sample is noisier, but the total error's first two moments become independent of the ideal non-overloading quantizer input; on average the output is the wave itself, plus a steady hiss. Stanley Lipshitz and John Vanderkooy proved in the 1980s that triangular dither makes the error's first two moments independent of the signal.
Here is the error's spectrum for a real note, Part 38's piano dying away, cut to eight bits so that the effect will be audible. Rounded: the error has a shape, peaks that track the note. Dithered: flat hiss. And noise-shaped: the rounding error is fed back and filtered, so the hiss is pushed up above ten kilohertz, where the ear is least sensitive, and the middle becomes quieter than plain dither.
Hear all three, turned up eighteen decibels. Listen to the end of the note, as it fades.
Rounded, the fade turns gritty and buzzy, and then cuts off dead. Dithered, a steady hiss, and the note fades smoothly into it, audible even below the hiss. Shaped, the hiss is higher and thinner, and seems quieter.
The practice is simple. Dither once, at the very last step, when rendering to a lower fixed-point precision that needs it, ideally at the final such conversion. At sixteen bits the hiss sits near minus ninety-six dBFS: inaudible in a loud master, audible in a quiet classical fade on headphones. Avoid unnecessary repeated quantization and dither; later fixed-point requantization may need fresh dither, and floating-point changes require separate consideration. And lossy codecs, the subject of Part 58, should start from the high-resolution master, not from a dithered sixteen-bit file.
10Vinyl, files and this seriesFoundations3 min
What does each medium ask of a master?
First, the oldest medium still sold. A record's groove wiggles sideways, and the stylus's velocity is the signal. For a given velocity the swing is the velocity over two pi f, so bass swings wide: at five centimetres a second, a hundred and fifty-nine micrometres at fifty hertz, under two at five kilohertz. Wide swings need wide spacing between turns, so a louder or bassier cut makes a shorter side. Vinyl enforced its own loudness limit, and low-frequency stereo difference is often controlled during cutting, depending on level, phase and the lathe, so that the two walls of the groove swing together.
So records are cut with the bass turned down and the treble turned up, and every phono stage turns them back. The cutting curve: bass down by about twenty decibels at twenty hertz, treble up as much at twenty kilohertz. The playback curve, the RIAA's of 1954, is its inverse: plus decibels at twenty hertz, minus at twenty kilohertz, from three time constants. The treble boost on the way in and cut on the way out also turns down the record's surface noise.
Hear a record of our mix played without the curve, as a microphone input would, and then with it.
Without the curve the band is thin and harsh, all hi-hat and no bass; with it, the mix comes back.
Each medium asks for its own master. The CD: forty-four point one kilohertz, sixteen bits, dithered, under nought dBFS and preferably under minus one true peak. Streaming distributors often accept twenty-four-bit masters, subject to their specifications, which the service encodes, normalizes and plays. Lossy encoding, Part 58's subject, overshoots, so leave minus one dBTP, or minus two at low bit rates. Broadcast: R 128's minus twenty-three. And vinyl its own master, with mono bass, tamed treble and a side length. One mix, several masters.
And this series itself, which has been mastering all along. The narration is high-passed at sixty hertz, brought to minus sixteen LUFS by a single gain, and passed through a look-ahead limiter at about minus two and a half dBFS for its rare loud syllables. Every example is set by one gain from its loudest four hundred milliseconds: minus fifteen LUFS, two and a half lower in recent parts, minus twenty-one for one meant to sit back. The example-normalization stage does not limit music; individual synthesis and mastering demonstrations can intentionally process dynamics: the narration and the music are summed, measured, and the build stops if a single true peak passes minus one. Loudness differences are stated when they are the lesson, as in this part's bias demonstration; production levels must still be checked on the final narrated film.
11Frontier: loudness and preferenceResearch2 min
Once loudness is equal, what do listeners actually prefer?
What do listeners prefer, once loudness is equal? Naomi Croghan, Kathryn Arehart and James Kates found in 2012 that heavy limiting, compared at matched loudness, lowered listeners' ratings of quality. Jens Hjortkjær and Mads Walther-Hansen found in 2014 that moderate limiting often goes unnoticed: the effect depends on the music and on how much. Listeners seem more sensitive to distortion and lost transients than to lost dynamics as such. Preferences differ by genre and by listener; some music is meant to be dense. And almost every study played the music loud, in a quiet room: not on earbuds on a bus.
Has normalization ended the war? Measurements of new releases suggest masters have eased a little, not much. Engineers still master loud, for clubs, for radio's own processors, for previews, and because the dense sound is now a style of its own. And density is not only loudness: a dense master sounds closer and more present on small loudspeakers in noise. The open question is no longer how loud, but which master serves which kind of listening.
Machines master too. Automatic mastering services, since about 2014, take a mix and return a master. They match its spectrum and loudness to a reference or a learned target, and limit. The same loudness bias applies to judging them: compare at equal loudness, blind. And playback could adapt: a phone could set the master's dynamics for the room it is in, listening through its own microphone.
A research problem to end on. Take mixes in several genres and master each at several peak-to-loudness ratios. Normalize them all to one loudness and play them in several places: a studio, a living room, earbuds in recorded street noise. Collect blind preferences, and model them against the music, the place and the listener. The question: once everything is normalized, what peak-to-loudness ratio do listeners prefer, and does it depend on where they listen? An answer would tell mastering engineers what to make, and players what to adapt.
Variation 57, recap and problemsAll tracks2 min
Every part ends by doing something to the Tune with what it built. Here, an album side: four recent Variations, eight seconds each, sequenced and matched in loudness; then Variation 56 mastered gently and for loudness, side by side at the same loudness.
Row fifty-seven of the ledger. Four Variations at minus sixteen LUFS; the war master's peak-to-loudness ratio decibels against .
What did we find? Mastering is translation, loudness, peaks, the album and the files. BS.1770 measures loudness through K-weighting, four-hundred-millisecond blocks and two gates. True peaks live between the samples, so they are measured oversampled, and a master leaves a decibel of room. A look-ahead limiter buys loudness with the peak-to-loudness ratio. Normalization reduces the automatic playback-level advantage, and comparisons are fair only at equal loudness. And dither turns rounding's distortion into hiss, while vinyl has a curve of its own.
Five problems. One to compute, one to prove, one for your ears, one to build, and a research problem, marked with a star. Solutions are in this part's notes. Pause here.
Where does this come back? In compression for the ear, with codecs, their overshoots and their listening tests. In live sound, with loudness limits and the ear's safety. In the business of music, with formats and the rules of streaming. In research, with blind tests and their statistics. And in the finale, where every Variation is sequenced and matched.
And in practice. Master for the target, not for loudness: a service's normalization target is not a universal mastering requirement. Read integrated loudness, true peak and the peak-to-loudness ratio every time. Deliver at minus one true peak, dither once, and make one master per medium. And compare at equal loudness, blind, and quickly.
The books, standards and papers this part follows. The full list, with notes, is in the README.
Where it goes next. Codecs, their overshoots and their listening tests in Part 58; loudness limits and safety in Part 59; formats and streaming's rules in Part 60; blind tests and their statistics in Part 67; every Variation, sequenced and matched, in Part 68.
Key results
The part's results in one place, for revision.
Try it
Lab 57 · Mastering and loudness, computed
Measure loudness by BS.1770 and true peak by oversampling, master a small groove at several loudness targets with a look-ahead limiter, see what normalization does to each master, and hear dither.
python -m videos.music.labs 57
needs numpy, scipy, matplotlib · download lab57.py ·
source on GitHubthe groove as made: integrated loudness, true peak -29.0 LUFS, -13.4 dBTP
mastered to -18 LUFS: reached, true peak, PLR, most limiting -18.0 LUFS, -1.9 dBTP, 16.1 dB, -0.0 dB
mastered to -14 LUFS: reached, true peak, PLR, most limiting -14.0 LUFS, -1.0 dBTP, 13.0 dB, 4.2 dB
mastered to -10 LUFS: reached, true peak, PLR, most limiting -10.0 LUFS, -1.0 dBTP, 9.0 dB, 13.9 dB
mastered to -8 LUFS: reached, true peak, PLR, most limiting -8.0 LUFS, -1.0 dBTP, 7.0 dB, 19.4 dB
the -18 LUFS master on a -14 LUFS service: gain, then peaks at +0.9 dB, -1.0 dBTP
the -14 LUFS master on a -14 LUFS service: gain, then peaks at -0.0 dB, -1.0 dBTP
the -10 LUFS master on a -14 LUFS service: gain, then peaks at -4.0 dB, -5.0 dBTP
the -8 LUFS master on a -14 LUFS service: gain, then peaks at -6.0 dB, -7.0 dBTP
ear problem: the first four, matched in loudness: which was limited hardest? (listen first) -10 LUFS, -18 LUFS, -14 LUFS, -8 LUFS
then a fading tone at 8 bits: rounded, then dithered 16 bits would give 98 dB of range
A loudness meter weights the spectrum like the ear and ignores the silences; a true-peak meter looks between the samples; a limiter buys loudness with the peaks; a streaming service gives the loudness back and keeps the damage; dither turns rounding's distortion into hiss.
The code (89 lines; it asserts its own result)
"""Lab 57: mastering and loudness, computed: a gated loudness meter and a true-peak meter, a limiter pushed to
several targets, a streaming service's normalization, and dither."""
import math
import numpy as np
from videos.coursekit import labs
from explainer.music.monochord import SR, Clip, concat
from explainer.music.monochord import master as M
TITLE = "Mastering and loudness, computed"
GOAL = ("Measure loudness by BS.1770 and true peak by oversampling, master a small groove at several loudness targets "
"with a look-ahead limiter, see what normalization does to each master, and hear dither.")
TASKS = [
"Change TARGETS. Where does the limiter start working, and what does each extra decibel of loudness cost in PLR?",
"Change SERVICE (a streaming service's target). Which masters are turned down, which up, and how loud are their peaks then?",
"Change BITS. At how many bits does the rounded fade stop sounding gritty without dither?",
]
TARGETS = [-18.0, -14.0, -10.0, -8.0]
SERVICE = -14.0
BITS = 8
def groove(seconds=4.0, seed=0):
rng = np.random.default_rng(seed)
n = int(seconds * SR)
t = np.arange(n) / SR
y = np.zeros(n)
for k in range(int(seconds * 4)):
i = int(k * 0.25 * SR)
L = int(0.2 * SR)
tt = np.arange(L) / SR
if k % 2 == 0:
hit = np.sin(2 * np.pi * (60 + 80 * np.exp(-tt * 30)) * tt) * np.exp(-tt * 12)
else:
hit = rng.standard_normal(L) * np.exp(-tt * 25) * 0.6
y[i:i + L] += hit[: n - i]
y += 0.15 * np.sin(2 * np.pi * 110 * t) * (1 + 0.5 * np.sin(2 * np.pi * 0.5 * t))
return np.stack([y, y], axis=1) * 0.1
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
g = groove(seed=seed)
lab.row("the groove as made: integrated loudness, true peak", f"{M.lufs(g):.1f} LUFS, {M.true_peak_db(g):.1f} dBTP")
masters = {}
for tg in TARGETS:
r = M.master(g, tg)
masters[tg] = r["y"]
lab.row(f"mastered to {tg:g} LUFS: reached, true peak, PLR, most limiting",
f"{r['lufs']:.1f} LUFS, {r['true_peak']:.1f} dBTP, {M.plr(r['y']):.1f} dB, {-r['gain_db'].min():.1f} dB")
assert r["true_peak"] <= -0.95
for tg, y in masters.items():
n = M.normalize(y, SERVICE, allow_up=True)
lab.row(f"the {tg:g} LUFS master on a {SERVICE:g} LUFS service: gain, then peaks at", f"{n['gain_db']:+.1f} dB, {M.true_peak_db(n['y']):.1f} dBTP")
# sound: the masters matched in loudness, in a random order; ear problem: order them by how hard they were limited
order = list(rng.permutation(len(TARGETS)))
clips = []
for i in order:
y = masters[TARGETS[i]]
clips.append(Clip(y * 10 ** ((-20 - M.lufs(y)) / 20), SR))
tt = np.arange(int(1.5 * SR)) / SR
fade = 0.5 * np.sin(2 * np.pi * 440 * tt) * np.exp(-tt * 3)
clips.append(Clip(M.quantize(fade, BITS) * 4, SR))
clips.append(Clip(M.tpdf_dither(fade, BITS, rng) * 4, SR))
lab.audio = concat(clips, gap=0.6)
lab.row("ear problem: the first four, matched in loudness: which was limited hardest? (listen first)",
", ".join(f"{TARGETS[i]:g} LUFS" for i in order))
lab.row(f"then a fading tone at {BITS} bits: rounded, then dithered", f"16 bits would give {6.02 * 16 + 1.76:.0f} dB of range")
fig, (ax1, ax2) = labs.figure(2)
L = [M.lufs(masters[t]) for t in TARGETS]
ax1.plot(L, [M.plr(masters[t]) for t in TARGETS], "o-", color=labs.GOLD)
ax1.set_xlabel("master's loudness (LUFS)")
ax1.set_ylabel("PLR (dB)")
f = np.geomspace(20, 20000, 400)
ax2.semilogx(f, M.k_response(f), color="C0", label="K-weighting")
ax2.semilogx(f, M.riaa_db(f), color="C3", label="RIAA playback")
ax2.set_xlabel("Hz")
ax2.set_ylabel("dB")
ax2.legend(fontsize=7)
lab.fig = fig
lab.note = ("A loudness meter weights the spectrum like the ear and ignores the silences; a true-peak meter looks between "
"the samples; a limiter buys loudness with the peaks; a streaming service gives the loudness back and keeps "
"the damage; dither turns rounding's distortion into hiss.")
return lab
Now change it
- Change TARGETS. Where does the limiter start working, and what does each extra decibel of loudness cost in PLR?
- Change SERVICE (a streaming service's target). Which masters are turned down, which up, and how loud are their peaks then?
- Change BITS. At how many bits does the rounded fade stop sounding gritty without dither?
Problems, with solutions
Try each problem before opening its solution.
-
Compute. A track measures −9 LUFS with a true peak of −0.3 dBTP. What does a service at −14 LUFS play it at, and where are its peaks?
Solution
The service turns it down by −14 − (−9) = −5 dB, so it plays at −14 LUFS with its peaks at −5.3 dBTP. A master made at −14 LUFS with a −1 dBTP ceiling plays at the same loudness with peaks 4.3 dB higher.
-
Prove. Show that a sine at f_s/4, sampled 45° from its peaks, has a true peak 3.01 dB above its sample peak.
Solution
The samples are sin(πn/2 + π/4), which takes only the values ±sin(π/4) = ±1/√2. The continuous sine reaches ±1. The ratio is √2, 20 log₁₀ √2 = 3.01 dB.
-
Ear. The lab masters a small groove at several targets and plays the masters matched in loudness; order them by how hard they were limited.
Solution
The lab prints the order. Listen to the kick's attack and the space after each hit: the harder the limiting, the softer the attack and the louder the space.
-
Build. Add a soft clipper before the limiter, and find how much loudness it buys for 0.1 % distortion.
Where to look. Put a tanh stage (Part 50) before
master.limiter, scaled so that it only touches the largest few peaks; measure loudness at the −1 dBTP ceiling against its drive, and the distortion as the residual of a sine through the same chain. A clipper in front lowers the PLR the limiter has to work against, so the same limiting reaches a few tenths of a decibel more, and on transient-heavy material more. -
★ Once everything is normalized, what peak-to-loudness ratio do listeners prefer, and does it depend on where they listen?
Where the frontier is. Master mixes in several genres at several PLRs, normalize them all, play them in a studio, a living room and on earbuds in recorded street noise, and collect blind preferences; model them against the music, the place and the listener.
Notes and sources
Sources
- B. Katz, Mastering Audio: The Art and the Science (3rd ed., 2015); B. Owsinski, The Mastering Engineer's Handbook (4th ed., 2016).
- ITU-R BS.1770-4, Algorithms to measure audio programme loudness and true-peak audio level (2015); EBU R 128 (2010) and Tech 3341, 3342 (2016); ATSC A/85; AES TD1004 (2015); G. A. Soulodre, "Evaluation of objective loudness meters", AES Convention (2004).
- E. Vickers, "The loudness war: background, speculation and recommendations", AES Convention (2010); E. Deruty and D. Tardieu, "About dynamic processing in mainstream music", JAES (2014).
- N. B. H. Croghan, K. H. Arehart and J. M. Kates, "Quality and loudness judgments for music subjected to compression limiting", JASA (2012); J. Hjortkjær and M. Walther-Hansen, "Perceptual effects of dynamic range compression in popular music recordings", JAES (2014).
- J. Vanderkooy and S. P. Lipshitz, "Dither in digital audio", JAES (1987); S. P. Lipshitz, R. A. Wannamaker and J. Vanderkooy, "Quantization and dither: a theoretical survey", JAES (1992).
- RIAA, Standard recording and reproducing characteristic (1954); D. Clark, "High-resolution subjective testing using a double-blind comparator", JAES (1982).
About this partfrom its README
Part 57 of a sixty-eight-part course in music (see the series plan and
the syllabus), the fourth part of Act X, The Studio and the Stage. In 2008 fans of a rock band found
that the version of its new album inside a video game sounded better than the CD, which had been mastered so loud that
the peaks were shaved flat. The loudness war had a casualty with waveforms to prove it. Then streaming services began
turning loud records down, reducing the automatic playback-level advantage when normalization is active. This part builds the instruments of both the war and the peace: a
gated loudness meter and a true-peak meter (the series' own, checked against ffmpeg), a look-ahead limiter, a mastering
chain, platform normalization and dither. The tools are Monochord's (explainer/music/monochord/master.py, with
loudness.py); the music is Part 56's session and earlier parts' Variations.
- A record too loud for its own good. An ear question (Part 56's mix mastered gently and for loudness, played at the same loudness: which was mastered for loudness? the second, its peak-to-loudness ratio 6.7 dB against 13); Death Magnetic and Guitar Hero III; how normalization changed incentives; the plan.
- 1. What mastering is for. Between the mix and the listener; Monochord's chain (tilt EQ, glue compression, a look-ahead limiter, dither), stage by stage, and heard; an album, not a track.
- 2. Meters. Sample peak, VU and PPM; three meters on one drum hit (the VU 22 dB below the peak); K-weighting; two tones at one voltage, 6 LU apart, heard; what one number can and cannot say.
- 3. LUFS and gating. BS.1770 in four lines; the gates at work (a quiet start: −21.9 LUFS gated, −23.6 ungated); the meter against ffmpeg's (integrated within 0.05 LU, true peak within 0.1 dB); momentary, short-term, integrated and the loudness range; targets (R 128's −23, A/85's −24, the services' −14 to −16, this series' −16).
- 4. Inter-sample peaks. A sine whose samples miss its peaks by 3.01 dB; measuring the true peak by oversampling; overs in a clipped master (+2.5 dBTP with every sample legal); why it matters; inside the converter.
- 5. Limiters and clippers. A look-ahead limiter; 0.6 seconds close up (the gain glides down before each hit); clipping against limiting at the same loudness, heard; clippers on purpose.
- 6. The loudness war in numbers. An arms race; one mix, six masters (PLR from 15.2 to 6.7 dB, the limiter topping out near −7.7 LUFS, the loudness range hardly moving, as Deruty and Tardieu found); what loudness costs; the sausage; three masters heard as a CD would play them.
- 7. Normalization. One gain per track; three masters normalized to −14 LUFS (the loud one turned down 6 dB, its peaks now the lowest); an ear question (which was mastered loudest? the first); tracks and albums.
- 8. Comparing at equal loudness. An ear question (two masters: which sounds better? the same master, the second 1 dB louder); the loudness bias; the method (matched, quick, blind, counted); this series' rule.
- 9. Dither. Cutting the word length (98 dB at 16 bits); rounding with and without dither; where the error goes (rounded, dithered, noise-shaped); a fading piano note at 8 bits, heard; when to dither.
- 10. Vinyl, files and this series. The groove (159 µm at 50 Hz, 1.6 µm at 5 kHz for 5 cm/s); the RIAA curve (+19.3, −19.6 dB); a record played without it, heard; one master for each medium; how this series is mastered.
- 11. Frontier: loudness and preference. What experiments found; after the war; machines that master; ★ research problem: once everything is normalized, what peak-to-loudness ratio do listeners prefer, and does it depend on where they listen?
- Variation 57, recap and problems. An album side of four Variations matched at −16 LUFS, then Variation 56 mastered gently and war-mastered, matched; the ledger (the war master's PLR 6.6 dB against 13.0); what we found; five problems; where it comes back; in practice; references; Part 58.
What is computed and built
python -m videos.music.music57.compute (about a minute) fills .cache/music57/; the meters item runs ffmpeg.
| Item | What it computes | Checked against |
|---|---|---|
hook, war, chain |
Part 56's mix mastered by Monochord's chain at several targets | the targets; −1 dBTP (tests) |
meters |
K-weighting, VU, PPM, gated blocks, LRA; two tones | ffmpeg's ebur128 (tests) |
truepeak, limiter |
inter-sample peaks; clipping against limiting | +3.01 dB; the ceiling (tests) |
norm, matched |
streaming normalization; the same master 1 dB louder | the gains (tests) |
dither |
rounding, TPDF dither and noise shaping at 8 bits | the error's spectrum (tests) |
vinyl |
the RIAA curve, groove excursions, a record without de-emphasis | ±19.3/19.6 dB (tests) |
series |
this series' levels, measured | — |
tune57 |
Variation 57 | — |
Monochord's tools are held in tests/music/test_master.py; this part's claims and clips in tests/music/test_music57.py.
Sounds. Part 56's session (Part 8's voice, Part 38's piano, guitar and bass, Part 40's drums), mixed close and dry and mastered here; Part 38's piano for dither; sine tones; the Variations of Parts 52 to 55.
What the models are, and are not. The limiter looks ahead by having its gain look ahead rather than delaying the audio, which gives the same result without delaying this offline output; a causal streaming implementation needs look-ahead latency. Its detector is the 4× oversampled peak. The mastering chain is deliberately simple (no multiband processing, no clipper), which is why it tops out near −7.7 LUFS on this mix. The record is only the RIAA filters: no groove, no stylus, no surface noise. The dither is shown at 8 bits so that it can be heard; at 16 bits the same effects lie near −96 dBFS.
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hook: an ear question (which master was made for loudness?); the waveforms; Death Magnetic; how the war ended; the plan.
- What mastering is for: between the mix and the listener; the chain, stage by stage, heard; an album, not a track.
- Meters: three old meters; one drum hit; K-weighting; two tones at one voltage, heard; one number.
- LUFS and gating: BS.1770 in four lines; the gates at work; checked against ffmpeg; time scales and LRA; targets.
- Inter-sample peaks: a peak between the samples; measuring it; overs in a real master; why it matters; inside the converter.
- Limiters and clippers: a look-ahead limiter; close up; clipped against limited, heard; clippers on purpose.
- The loudness war in numbers: an arms race; one mix, six masters; what loudness costs; the sausage; three masters heard.
- Normalization: one gain per track; three masters normalized; an ear question (which was mastered loudest?); albums.
- Comparing at equal loudness: an ear question (which sounds better?); the loudness bias; the method; this series' rule.
- Dither: cutting the word length; rounding with and without dither; where the error goes; a fade heard; when to dither.
- Vinyl, files and this series: the groove; the RIAA curve; a record without it, heard; one master per medium; our levels.
- Frontier: what experiments found; after the war; machines that master; the research problem.
- Variation 57: an album side, and one war-mastered beside itself. Outro: problems, payoffs.
Covers: what mastering is for; the chain; inter-sample peaks; meters; BS.1770, LUFS and gating; normalization;
the war in numbers; level-matched comparison as method; dither to delivery; vinyl's equalization and geometry;
delivery formats; this series' own mastering chain, explained and measured.
Built and computed: monochord/master.py: K-weighting, gated blocks, short-term loudness and LRA, VU and PPM, a
true-peak meter (the series' meter agreeing with ffmpeg's within 0.05 LU and 0.1 dB); a look-ahead true-peak limiter; a
mastering chain; one mix mastered at six loudness levels (PLR 15.2 to 6.7 dB), then normalized; TPDF dither and noise
shaping; the RIAA curve and groove excursions.
Variation 57: an album side of Variations, and one of them "war-mastered" beside itself, level-matched (PLR 6.6 dB
against 13.0).
Frontier: loudness and listener preference: what experiments found (open: what PLR do listeners prefer once
everything is normalized, and where?).
Reading: Katz, Mastering Audio; ITU-R BS.1770; EBU R 128; Deruty & Tardieu (2014).
Build the film
python -m videos.music.music57.compute # the part's numbers, into .cache/music57
python tools/build.py music57 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py music57 Hook # one chapter, silent, with a contact sheet
Scenes: videos/music/music57. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
python -m videos.music.music57.compute # numbers and sounds (about a minute)
EXPLAINER_TTS=silent python tools/build.py music57 -q l --fps 15 # a silent-narration preview, with the sounds
python tools/qa_sound.py music57 --sync # the sound gates
python tools/dead_air.py renders/music57_480p.mp4 --sound music57 # no empty screen; no sound over a still one
python tools/lecture_length.py music57 # 30 to 60 minutes, listening included
python tools/build.py music57 # 1080p30, narrated
python -m pytest -q tests/music # Monochord against its references; this part's claims and clips
python -m videos.music.labs 57 # the lab (writes a figure and a short WAV)