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.

## 11 September 2008

Subscribe to:
Posts (Atom)