It is often assumed that resampling (SRC) or dither are “safe” operations that do not change peak levels of the file and cannot cause clipping. If the file clips, people are surprised and suspect there is something wrong with the SRC algorithm.
In fact, both SRC and dithering can increase peak levels of the file and cause clipping.
Dither is relatively harmless: even with noise shaping, the level of 16-bit dither is usually below −60 dB. It means that it adds less than 0.01 dB to the peak level of your full-scale signal. However if your signal has been normalized to 0 dBFS, even +0.01 dB can cause it to clip. Some level meters are more sensitive to this subtle short-term clipping than others, so your indications may vary.
SRC (resampling, sampling rate conversion) has more impact on signal levels. It can often add 0.5–1.0 dB or more to sample peak and true peak levels. There are a few sources of this increase:
- When you downsample a signal, some high-frequency components get lost. Depending on their phase relationships with lower-frequency components, this loss may easily increase peak levels. Consider a square wave turned by downsampling into a sine wave of higher amplitude.
- Most SRC filters have ringing. I encourage everyone to read the Help section at src.infinitewave.ca website. Pay particular attention to Fig. 6: it displays typical impulse responses of SRC filters. When such a filter is applied to the signal, any flat sections in the signal become ringing too (see the demonstration with a square wave below).
- If the SRC algorithm has a nonlinear-phase lowpass filter, phase shifts in the passband will change phase relationships between signal components, which may increase peak levels (see the square wave demo with a min-phase SRC below).
Let's now resample it to 22.05 kHz with a high-quality linear-phase SRC algorithm (RX 4, default settings). You can see how both sample values and true peak values (peaks of the analog waveform) have increased by over 0.5 dB.
Now let's do resampling with a minimum-phase filter (setting Pre-ringing slider in RX to 0). Now the levels have increased by over 2.5 dB! It would definitely cause clipping, should the waveform have been normalized anywhere near 0 dBFS.
The effect is easy to see on a square wave, but what about real music? Here is some real music after a brickwall limiter with a ceiling set to −0.1 dB. You'd think that 0.1 dB is enough headroom for SRC, but it is not. In fact, even the original sample's true peak levels reach +1.37 dBFS (indicating that the brickwall limiter was not a true peak limiter). The blue waveform here shows digital sample peaks, while red displays intersample peaks (ISPs) or true peaks.
After linear-phase SRC, sample peaks rise to +0.4 dBFS. And after min-phase SRC, sample peaks rise to +1.89 dBFS, while true peaks rise to +2.2 dBFS. Definitely something to worry about!
What can be done to prevent clipping during SRC and dither? The best advice is to leave enough headroom in the signal before it goes to the SRC, then apply the limiter to eliminate this excessive headroom, and, finally, dither. The ceiling in the limiter should be set no higher than −0.01 dB to prevent clipping from dithering. In fact, it is often recommended to keep your limiter ceiling at −0.5 or −1 dB to prevent clipping from a potential .mp3 or AAC conversion later, but this is another story…