vvvar / PeakEater

PeakEater is a free open-source cross-platform VST3/AU/LV2/CLAP wave shaper plugin
GNU General Public License v3.0
324 stars 16 forks source link

[Bug] Oversampling allows sound to peak beyond ceiling (Peakeater 0.8.1) #101

Open Arkforest opened 1 year ago

Arkforest commented 1 year ago

I am using peakeater on the end of my master strip as a hard brickwall limiter and when I turn the oversampling knob up, peakeater allows sound to break its set ceiling level, so I will have sound peaking at +1dbfs with a ceiling of -0.3dbfs, which is potentially problematic.

Steps to reproduce the behavior:

  1. Add peakeater to effect chain
  2. Set ceiling to any arbitrary height (preferably between -0db to -1db)
  3. Boost unlinked input until some clipping happens
  4. Turn up the oversampling knob to any setting other than "OFF"
  5. Observe audio signal peaking above the ceiling that peakeater sets

I expected the audio signal to instead respect the ceiling and not peak over it. I don't know whether this is normal behaviour when oversampling peakeater or any other clipper or limiter, so I just wanted to double check, as I was told that this is unexpected by another producer who uses peakeater.

I have supplied a video demonstrating the problem. peakeaterproblem.webm

erroreyes commented 1 year ago

I think this is normal behavior of clippers when they are oversampled. I have seen this in other clippers, and I have seen and read people suggest to always turn oversampling off when hard clipping to avoid things getting past ceiling values.

Arkforest commented 1 year ago

That's what I suspected. I was told it was not supposed to happen, but it turned out to be incorrect.

jonlinnarson commented 1 year ago

It has to do with the low-pass anti-aliasing filter itself (and probably lot to do with how steep/high order filter is). A low- or hi-pass filter that's steeper than 6dB/oct will always boost a bit around the cutoff frequency, whether you are using minimum-phase (IIR) or linear-phase (FIR) filters. You also want it to be pretty steep to effectively stop aliasing, which will boost the frequencies around the cutoff even more.

Imperfect resampling and Gibbs phenomenon are probably also part of the problem.

Fabien from Tokyo Dawn Labs said it pretty well:

In addition to this, with all things "limiting", it's important to understand that one can either limit the peak level of a signal, or limit the bandwidth of a signal. Never both at once: A. Any attempt to dynamically limit the peak level extends the bandwidth (by introducing harmonics/IMD of some sort). B. Any attempt to limit the bandwidth (e.g. for antialiasing/a better spectral integrity during limiting) will extend the peak level.