Skip to main content

Topic: 0 dB Peaks and ABXing (Read 462 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Makaki
  • [*][*][*]
0 dB Peaks and ABXing
To make this short, I'll start with the question, and then I'll post the story behind it.

How do the different codecs (Opus, AAC, MP3) handle encoding/decoding when the original source (FLAC) peaks all the way to 0 dB? In other words, What happens when the decode algorithm results in sections louder than 0dB. Is there a recommended normalization for source files, so that the peaks are a certain dB difference below 0 dB?

My guess there's some sort of on the fly normalization, or volume reduction. So that the sound doesn't "clip" ? But it seems to work more like a loudness filter than a normalization of the whole file?

What happened was that I was ABXing FLAC vs 32kbps OPUS, and I found a section of the song that was easier to ABX because of a volume difference. The section on the source was louder and peaked to 0 dB considerably more than other sections. When decoded, foobar2000 would show the Peak meter as going over 0 dB.

As I started raising the bitrate, since I already knew the exact spot where to look, I could still hear the volume difference. So I started getting suspicious, I decided to switch codec to AAC (using qaac), same results. Then I tried LAME, same result.

Now, I know I've read something about this before, but can't find a single compound answer. I got tired of comparing files yesterday, but I have a feeling that if I normalize the source volume first, and then compare THAT to the codec's result, I wouldn't be able to hear said volume difference.

  • Makaki
  • [*][*][*]
Re: 0 dB Peaks and ABXing
Reply #1
I wonder if the fact that the USB headphones I was using are limited to 16 Bit, was working against me?

Maybe with 24 Bit, the output chain would take care of the problem, and because of the 16 Bit limitation it's not happening?

...Just a thought

  • Case
  • [*][*][*][*][*]
  • Developer (Donating)
Re: 0 dB Peaks and ABXing
Reply #2
I think it's cheating to lower the source file loudness. You have volume difference because DirectSound in modern Windows automatically prevents clipping by lowering the amplitude.

You can prevent that with several different methods. WASAPI output won't have limiter and you get clipping instead. You could lower the playback volume digitally in foobar2000. Or you can convert the lossy encode back to PCM WAV to hard clip it. Or you could use a DSP that clips the signal preventing volume pumping.

  • bennetng
  • [*][*][*][*][*]
Re: 0 dB Peaks and ABXing
Reply #3
Some info:
https://hydrogenaud.io/index.php/topic,114125.msg940028.html#msg940028
https://hydrogenaud.io/index.php/topic,114881.0.html

As you can see, while there is something like "true peak", the clipping point of different true peak scanners and DACs are not the same, that means you have to find out the clipping point yourself.

As for 16-bit vs 24-bit, they are just specs, a bad 24-bit DAC can have sub 16-bit quality, if you use foobar the signal should remain in floating point until it leaves foobar.

  • Makaki
  • [*][*][*]
Re: 0 dB Peaks and ABXing
Reply #4
Noticed two things.

1) There's a replay gain checkbox on the ABX Comparator, that maybe I need to play with.

2) At one point I was just scrolling to sample without using the ABX Comparator. Seems the ABX comparator would try to match the volume for me. But playing the files straight up, does yield the different volumes.




  • bennetng
  • [*][*][*][*][*]
Re: 0 dB Peaks and ABXing
Reply #5
If you find the RG mechanism distracting, decrease the volume of the source file and resave it as 24-bit lossless* to prevent DAC and codec induced clipping, then encode it and perform ABX tests without using RG.

*disclaimer: in order to avoid loss of low volume detail, if any.

[edit] uploaded example files. ABX a.flac and b.opus without using RG.
  • Last Edit: 06 November, 2017, 09:04:50 AM by bennetng

  • saratoga
  • [*][*][*][*][*]
Re: 0 dB Peaks and ABXing
Reply #6
Decoders work in floating point (except the weird integer ones we use), so clipping happens after decode. How that's handled depends on the application using the decoder. If it requests integer output from the encoder, it's usually just clipped as is. If it's floating point output, something further down the chain will have to handle it.

  • DVDdoug
  • [*][*][*][*][*]
Re: 0 dB Peaks and ABXing
Reply #7
If you're hearing a volume difference the encoder has failed the ABX test (or your ears have passed ;) ).
If you're hearing clipping the encoder has failed.

If you're only hearing clipping, reducing the volume before encoding  will improve encoder performance.

...I've never used Opus and I mostly encode music (rarely voice-only) to MP3 at much higher bitrates.    What I've noticed is that some peaks get higher and some peaks get lower with the new highest-peaks often going over 0dB.   However, I've never noticed a change in loudness or dynamics.    And, I've never heard clipping...    When I've heard a compression artifact, it's been something else. 

I assume you're working with spoken-voice files?   I wouldn't expect music to be transparent at 32kbps.

Quote
Is there a recommended normalization for source files, so that the peaks are a certain dB difference below 0 dB?
It's "statistical" so there's no solid answer.   A lot of people like to normalize to -1dB.*   I'd guess that -2dB would be "safe" more than 99% of the time, but I haven't done enough analysis so that's just a guess.



* Sometimes -1dB normalization is done by people who are paranoid about "inter-sample overs", not necessarily for lossy compression.    And, if you're worried about inter-sample overs, you're probably not using lossy compression.      I'm not paranoid about either one and I normalize to 0dB.

  • Last Edit: 06 November, 2017, 10:51:40 AM by DVDdoug

  • bennetng
  • [*][*][*][*][*]
Re: 0 dB Peaks and ABXing
Reply #8
It's "statistical" so there's no solid answer.  A lot of people like to normalize to -1dB.*  I'd guess that -2dB would be "safe" more than 99% of the time, but I haven't done enough analysis so that's just a guess.
The lower the encoded file's quality, the higher the chance to have 0dBFS+ values in the encoded file. In Reply #5, a.flac is -4dBFS, after encoded to b.opus at 60kbps the peak increased to -0.66dBFS.