30 September 2008

Lars's Paradox, or, Everything You Know Is Wrong

"Listen, there's nothing up with the audio quality. It's 2008, and that's how we make records... Of course, I've heard that there are a few people complaining. But I've been listening to it the last couple of days in my car, and it sounds fuckin' smokin'."
Look, people. The dude isn't fucking deaf. Rick Rubin is also, contrary to popular opinion, not deaf (he owns a rather nice hifi, in fact). Metallica as a band is not deaf. Vlado Meller is not deaf. Millions of music listeners are not deaf. And now quite a few people are coming out the woodwork and saying that Death Magnetic sounds just fine, thank you very much. They too are not deaf.

To suggest otherwise, or to suggest that something is inherently wrong with the way they are listening, is merely fallacious smearing, and honestly, unintelligent. Continuing to insist that music products like Death Magnetic are not of a sufficiently high quality without further proof - especially in the face of #1 sales - is only going to continue the abject apathy that the rest of the music world seems to treat this whole issue with.

Certainly, Rick Rubin knows exactly what he's doing when he produces records like this, and he is quite certain in his belief that it is towards delivering a superior product, as his interview with Michael Fremer made abundantly clear:
Ultimately, if you listen on a car sound system or in the mainstream place where most people listen to music—cars, boomboxes sound systems you get at (chain stores), and if you “A/B” the less compressed version to the more compressed version, you pick the compressed version... Even in a good car stereo. We do shoot-outs all the time. I master with as many as five different mastering engineers mastering the same album and then we “A/B” them and it’s interesting, Vlado wins nine out of ten times, and he claims it’s not him. He’s got technology in that room that’s a 2 million dollar mastering suite that other people don’t have. All I’ll tell you is that my whole job in life is to A/B things, that’s all I do, and for some reason, I don’t know that what he’s doing is necessarily the best, but I haven’t heard anything to beat it and we try.
That the album distorts needlessly is established beyond a reasonable doubt, thanks to mastering engineer Ted Jensen's comments, and comparisons with the vinyl. I haven't bought the album, but I have listened to the free clips from Metallica's web site, and the YouTube GH3 rips, enough to know that I'd prefer the GH3 versions.

But let's have some perspective here. The truth of the matter is that this is a serious counterexample to the entire narrative of the "loudness war": that, despite diverse objective and subjective evidence that modern hypercompressed mastering styles degrade sound quality and music appreciation, the vast majority of music listeners, at all experience levels, at least continue to buy such purportedly terrible masterings, and may even prefer them to less compressed styles. I am going to call this Lars's Paradox, since Lars Ulrich, belligerent bastard that he is, has managed to wade neck-deep into the middle of this like he always tends to do. But whether due to a similar level of belligerence, or devil's-advocacy, or whatnot, I'm actually going to take his side here for a minute.

I believe any fight against hypercompressed mastering in the "loudness war" will founder until this paradox is resolved. More concretely, and extending to other issues, I am claiming the following:
  • Claims of the hypercompressed style resulting in reduced musical enjoyment are completely unproven except on personal, anecdotal, and therefore meaningless, grounds. Real studies need to be done, in real listening environments, to show that the application of hypercompression is a detriment to popular music and the popular music industry.
  • Objective evidence is inaccurate in arguments regarding mastering. Objective evidence cannot prove statements about enjoyment. Such analyses must be more explicit in their relationship between the music, the dynamic range, and the dissonant distortions if they are to be ultimately taken seriously. Waveform plots, ReplayGain, RMS, and pfpf are all highly deficient in one way or another here.
  • (Lars's Paradox) Evidence suggests that the hypercompressed style is preferred by at a large amount, and probably most, of the popular music listening population. Both audio professions and untrained listeners are making this preference. For the uncompressed styles to be taken more seriously, it must be shown concretely that this preference is based on faulty measurements, or is otherwise false in meaningful and important ways.
As long as these points stand, the argument against hypercompression will remain fundamentally flawed, and popular music will continue to be released in the hypercompressed style. Regardless of how many petitions get signed. Marginal releases like on vinyl and high-res formats obviously don't follow this logic as much, nor does classical and experimental music, etc. By and large, those are not popular genres or (yet) popular formats, and this discussion revolves largely around popular music. But there's simply no hope for popular CD/iTunes releases to follow any different mastering style as long as these issues exist with this whole argument.

(I have my own ideas, revolving mostly around psychoacoustics, for resolving the paradox, but they are as yet unfinished.)

Update, October 1:
Debate on the new JusticeForAudio.org forums.

Update, October 2.

17 September 2008

Waveform Plots Considered Harmful

(Revision 2.)

One of the most commonly used audio measurement tools used today is the waveform plot. This is the graph of the audio signal versus time. It directly relates the amplitude of the signal to the various parts of the musical piece, and seems very easily interpreted. It is also extremely sensitive to changes in mastering, and so is the tool of choice used for illustrating "the loudness war". From sound editor screenshots to animations to elaborate, egg-in-a-frying-pan-style "this is your music on drugs!" Youtube videos, it has become something of a mascot for hypercompression.

Unfortunately, it can also be highly misleading. In general, waveform plots cannot be solely trusted as an evaluator of sound quality. Use caution when using them, because they may lie to you.

An Example: Vinyl waveforms can look better than they really sound
The most common point made with a waveform plot is to prove or disprove the existence of clipping, or more generally, hard limiting. Clipping refers to a music signal that is clamped to a fixed magnitude if that magnitude is exceeded - the peaks of the music are "clipped" off. Hard limiting is roughly the same concept - clipping is a form of hard limiting - but allows for more flexibility in how the fixed magnitude is approached. Typically, a hard limiter will allow for a softer transition between the "undisturbed" region of the music and the "limited" region.
The outer shape of a waveform plot shows the peak level of the music over time. If that peak is at exactly the same level across an entire song, down to a fraction of a dB, it is believe to be good evidence that a limiter was applied to the music; the flatter the peaks are, the more limited the music is, and thus the more distorted the music is. Conversely, the more ragged the peaks are, the less distorted the music is.

Rather than describe an elaborate explanation as to why this is not true, it is far easier to just find a counterexample. Here's a waveform plot of a song from the album Mirrored, by Battles, in both CD and LP versions, loudness-equalized.

(Battle's Leyendecker. White: CD version amplified -7.44db. Red: Vinyl version. Recorded with Technics SL-1200, AT-OC9MLII, flat transferred with Yamaha GO46 at 44.1khz. 2M samples of left channel at +4M samples from start of track. Time axis in seconds.)

"Excellent! The vinyl really is better!" you think. Visually, the CD is quite obviously "hypercompressed", and the vinyl is clearly not - in fact, the vinyl peaks around 6.6db higher than the CD does, once the two tracks are loudness-equalized. Based on this sort of plot, 99% of the music listeners who care about dynamic range in their music would believe the mastering on the vinyl release is superior.
But 99% of music listeners are dead wrong.
(Same plot; zoomed in to 27.43-27.44s)

Vinyl is full of linear distortions and noise sources that do not exist on CD, and so the waveforms rarely if ever match at short time scales, even if the mastering is the same. Such is the case here. But it should be quite obvious that the clipping that exists on the CD also exists on the LP. The "flat" regions on the CD very closely match the "flat" regions on the LP. [1]

This is fairly incontrovertible proof that the vinyl release of Mirrored originates from masters utilizing a similar amount of dynamic range compression as exists on the CD. And yet, the first waveform plot appeared to clearly indicate a higher dynamic range. In the case of vinyl specifically, this conclusion can be wrong for a number of reasons:

  • The recorded vinyl waveform is not sample-aligned with the CD waveform. Intersample peaks that are not visible on the CD waveform suddenly become visible on the vinyl waveform. In exceptional cases this can artificially raise the peak level by a few dB.
  • Variations in the frequency response of the vinyl system (both in recording and playback) can artificially raise peak levels. One particularly strong culprit here is low-frequency rumble at the tonearm-cartridge resonance (around 10hz) which can easily dwarf all the other musical content on the recording. (In this comparison, the rumble was filtered out.)
  • Tracing and tracking error in the tonearm system can artificially raise peak levels.
A similar situation exists with FM radio, which is also compressed very aggressively, although waveform plots of recordings do not show an excessive amount of limiting. But applying the preemphasis, resulting in a signal analogous to what is actually transmitted, results in a much more obviously limited waveform.

Another Example, with a CD
Metallica's Death Magnetic is being widely criticized as one of the most sonically unpleasant popular records of recent memory. And yet, its waveform plot, while ugly, is not perfectly flat:
"My Apocalypse"; CD; source.

Many albums that visually appear worse than this sound much better.

Why can waveform plots lie? Blame your ears

The human ear may be relatively insensitive to limiting, if it only happens a few times a second - for instance, if only the percussion is affected. Bob Katz has commented in Mastering Audio that in regards to peak limiting, "a rule of thumb is that short duration (a few milliseconds) transients of unprocessed digital sources can be reduced by 4 to 6 dB with little effect on the sound." Those people who would worry about 10-20 sample runs of clipping on CDs should note that 1ms = 44 CD samples; examples of hard limiting become exponentially harder to find as the number of consecutively limited samples increases. Mastering engineers use peak limiting all the time because, in all honesty, the human ear ear often lets them get away with it! In other words, clipping that may appear blindingly obvious on the waveform plot may not be audible.

On the flip side, when limiting occurs with periodic signals - like those emitted by most non-percussion instruments - it becomes a form of high-order distortion, and may become very, very audible. In the worst case, limiting of very few samples at a time (1-5) may be audible.

Furthermore, different forms of hard limiting have different effects on the sound quality. Clipping is merely one of the most dissonant forms of hard limiting. A large market exists for high-quality limiters that remove as much of the peak as possible, while maintaining as much of the sound quality as possible. And yet all of these limiters will appear more or less the same on a zoomed-out waveform plot. How can can sound quality be evaluated from such a plot when one can't use it to tell apart different forms of limiting?

When limiting is tastefully done, by a professional mastering engineer, it can negligibly distort the music while making it much more enjoyable for those of us with less expensive or desirable listening environments. In this situation, the effect of more general forms of dynamic range compression may be more objectionable, in that the reduction of dynamic range is worse than the addition of light amounts of limiting distortion.

How can I tell if one master is superior to another if waveform plots are bogus?

Unfortunately, while many alternatives exist to the waveform plot to measuring mastering quality, they all have major downfalls. None of them are trustworthy.

  • Many people use ReplayGain track gain values as an estimator for the dynamic range of the music. Most importantly, it is easily fooled by global changes in gain - so that the "fake" dynamic range of the Battles recording above would completely fake out ReplayGain. Certainly, ReplayGain values place limits on how much dynamic range may exist in the music, and it can be used to guess a lot about the mastering, but it does not, in fact, actually measure dynamic range, nor does it measure distortion. Many albums considered great-sounding from the likes of Radiohead and Gorillaz tend to Replaygain in the -10dB range, which many people would consider "hypercompressed".
  • Audio engineers use an "RMS" value that is conceptually about the same as ReplayGain, and shares its faults. However, it is an acceptable figure of merit proving that Iggy Pop is a crappy producer.
  • pfpf was more or less explicitly designed for this sort of thing, but only in the context of changes in dynamic range - not in terms of clipping, or any kind of timbral changes. This approach should be fairly good teasing out changes in dynamic range compression, but quite insensitive to limiting. Also, pfpf is still sort of half-baked, and it's not clear yet how close the long/medium/short term numbers need to be before concluding that two samples are of the same master.
  • The Sparklemeter was designed by somebody else on somewhat similar lines as pfpf, but specifically relating to measuring mastering quality. See that thread for my comments.
  • Some people are content with using the "Peak Level" result from CD audio rippers such as EAC as an indicator of audio quality: the idea being that CDs with a peak level lower than 99% run a much lower risk of hard limiting than those at that peak level or above. This is wrong in so many ways it's hard to count. It is, quite simply, the least accurate method possible of evaluating mastering quality.

Perhaps the most accurate method of evaluating mastering quality, though, is the simplest: Asking the mastering engineer. They, of course, would know best.

Another method is to simply use your ears. Know what clipping sounds like, and what other forms of hard limiting sound like, etc., but also evaluate your own music collection's sound quality, and investigate the mastering techniques used with its songs.

What is to be done?

  • Avoid the use of zoomed-out waveform plots to prove points about sound quality. They convey less information than you might think, and they are easy to misinterpret.
  • Do not trust the sound quality of a record simply because it looks good on a waveform plot. The ear is not an oscilloscope. Waveform plots are an informational tool, but the only relate to the perception of hearing in an abstract sense. There are plenty of ways that a good-looking waveform plot can sound terrible!
  • Avoid using any numeric measurement for evaluating audio quality, unless you understand exactly its exact meaning for audio perception. Most numeric tools today are fairly flawed. They can be used to make meaningful statements about mastering quality in specific circumstances, but they can also make lots of meaningless or flawed statements.
  • Do not buy vinyl on mastering merits alone, unless you have information coming from the vinyl mastering engineer attesting to its superiority over other release. As a rule of thumb, the cost of a vinyl remaster is high enough that those labels that choose to remaster will make it quite clear to potential customers that they did so, and the labels that didn't, won't. But of course, just because a special mastering job was done for a vinyl release doesn't mean that the mastering changes were significant. Caveat emptor.
  • Enjoy music purely on its subjective merits, but pay attention to your perceptions and look for ways to quantify it. There's too much good music out there today to ignore because the mastering is crap. And despite the shrill cries of the hi-fi set, the sound quality of music today is still considerably better than what it was for (most of) the last 60 years. And if all the kids today have no problem listening to the music, who's to say that us old farts can't listen to it too?

    Nevertheless, reduced dynamic range and increased distortion in modern mastering are real issues. Solving them requires subjective and objective evaluations of sound quality, rigorous in their execution, to convince the audio world that this is not mere idle talk of ignorable audiophiles.
For further reading: the HydrogenAudio forums, including some recent topics on the subject, and a wiki entry on vinyl mastering (semi-maintained by me). Related thread.

[1] The regions of clipping on the LP version of "Leyendecker" seem to imply that it is slightly less limited than the CD version. However, the difference is so slight that it is not believed to be audibly superior - and besides, the example still breaks the myth that vinyl must necessarily not be hypercompressed.

17 September 2008: Incorporated feedback. Previous revision. Thanks to David "2BDecided" Robinson, Lyx, krabapple, and others on HA, for their feedback.

12 September 2008

Metallica's "Death Magnetic": Clips on both CD and Vinyl

Much hay has been raised about the sound quality of this album, although interestingly enough, none of it has been from mainstream music journalism (or even the blogosphere) yet. The mastering engineer has even disowned the sound quality of the record, passing the buck onto the mixing engineer, and ultimately, the band itself.

The MP3 prerelease leaks have been so commonplace (and so bad sounding) that a lot of people are buying the 2LP and 5LP versions thinking that they are getting superior sound quality. However, judging by the large amount of clipping still extant on the vinyl, they probably won't:

Image credits: hdsemaj on stevehoffman.tv. Original post.

Subjectively, some people are reporting that the warmer sound of the record is dampening the clipping somewhat, but really, that's damning with faint praise.

My recommendation is to spend as little money as possible on the release until they sell a better master. Metallica.com is streaming the album for free right now. Beyond that, buy the MP3s. Personally, I smell a rat.

11 September 2008

Some thoughts on a new technique for clipping detection

I decided to riff on an idea I had for smarter ways to detect clipping. I'm sure it's not a new approach - a quick search on Google pointed out several papers on the same basic concept - but I'm not aware of it being used for audio, or for mastering evaluation specifically.

Clipping clamps the signal to a constant value. It also tends to occur right in the middle of signal content which is of a high power. If the signal derivative is calculated, the DC component of the clipping is effectively eliminated, bringing the values to 0, while the values before/after the clipping are relatively unmodified. (Specifically, low frequencies are attenuated and high frequencies are boosted.) So naively, one could use this derivative as the basis for a clipping detector - compare y' to y, and if y' is zero or very close to 0 while y is of a high power, you may have clipping. This technique would be immune to attenuated clipping - if it occurs at -10db it should work as well as if it is at 0db.

However, this approach fails when gross frequency response distortions are introduced - like what exists on vinyl. As discussed earlier, vinyl clipping examples exist which are sloped, not flat. The derivative of these a sloped line is a constant nonzero value. The workaround for this is simple: take another derivative, the second derivative, so that this constant nonzero value collapses to 0. In theory this could be extended to an arbitrary number of derivatives, but because high frequencies are amplified, background noise tends to dominate the response after the 2nd derivative, so the 3rd and beyond are pretty useless for vinyl analysis.

What I'm ultimately hoping for is to have the final output be a histogram and running a threshold on that to give an estimate for how many clipped samples exist in the signal. This allows comparisons between signals that are not sample-aligned (as is usually the case with vinyl vs. CD comparisons).

Here's what I have so far. First, some clipped stuff from Leyendecker again, on CD:

Note how the clipped content is neatly crushed to 0 on the second derivative plot - and most importantly, that the histogram plot shows a lot of values on the left, outside the distribution curve with a high signal energy and a low 2nd derivative energy. Those are the clipped samples.

Now for the LP version, different part of the file:

The 2nd derivative crush still occurs, but it's not nearly as prominent as on the CD. And the clip signal is so weak on the 2nd derivative plot (or the noise is so high) that none of it really shows up on the histogram plot; there's no real indication of clipping there.

But it's a start.

10 September 2008

Feedback on "Waveform Plots Considered Harmful"

I received lots of feedback on my HA thread and some in the comments. I intend to update the paper incorporating this feedback, archive the original somewhere, and post it for more general consumption soon.
  • Several people commented that the tone of the article in general was too inflammatory, and given that I used waveform plots to make a few important points, potentially hypocritical. I blame the insanely late hour that I wrote it. It will be edited to be a bit more evenhanded.
  • One person commeneted that the particular waveform examples I used seemed to imply that the vinyl master is clipping significantly less than the CD master. I'm seeing that too, and I cant' really explain it. It's clearly not some sort of analog effect in the playback system, and it seems to be consistent across the entire disc. The fundamental issue is the same - buying vinyl does not always mean you are getting a product without hard limiting - so I think the article still stands up well. But the specific point of that example, that there exists a vinyl master which provably has just as much clipping as the CD master, is compromised significantly.

    Note, also, that other people have observed vinyl waveform plots that don't share Mirrored's subtle difference in clipping levels. The clipping levels really do seem to match in those cases.
  • A clearer distinction needs to be made between periodic clipping of periodic signals - which is extremely audible even in small amounts - and clipping of transients, which is far less audible. Modern mastering practices can occupy either extreme or somewhere in between.
  • I'm equivocating between clipping and hard/brickwall limiting; clipping is only one form of hard limiting. A proprietary hard limiter is capable of doing the same job that clipping does, but with potentially far less audible distortion. It's an open question as to how much more audible clipping is than a good hard limiter. Nevertheless, the damage done to the audio is quite significant for all hard limiters.
  • While we're on the subject of things that should be made more clear, the extensive use of dynamic range compression (of the non-limiting variety) clearly has a far more audible effect on the sound than limiting/clipping.
  • Important tip: Bob Katz commented that he always sends vinyl masters out without the use of the hard limiters used on the CD masters. Yay!