How do MP3 files have samples above 0db in Audacity? As far as I am aware, that shouldn’t be possible.
I have some MP3 files that when uploaded into Audacity, they have samples above “1”, however, when using the NAudio package in a C# project to read and then re-write the file to a wave file, it clips all samples above “1”. Here is an example of each result: (correct unclipped version above, NAudio processed version below)
MP3 gets its small, convenient files by re-arranging musical tones … and throwing some of them out. If the tones that were trashed happen to be “quiet-going” instead of “loud-going”, the production in that area will get louder. The mechanics of doing that will make your head hurt, but that does happen.
Never ever do production in MP3. MP3 has a bunch of nasty tricks. MP3 is designed to go in your music player while you’re out running on the beach.
Yes, ACX wants your audiobook chapters delivered in MP3, but they want it one-pass, at 192-Constant, nosebleed high quality.
MP3 can go over 0dB! Floating-point WAV files can also go over 0dB.
Audacity’s MP3 decoder can decode peaks over 0dB but decoders that convert to integer audio cannot, and the peaks will be clipped. Also, if you have an MP3 that goes over 0dB and you play it at “full digital volume”, your DAC will clip the peaks even if the decoder doesn’t.
Some encoders MAY also be limited to 0dB.
There does seem to be some amplitude limit but from what I can tell it’s not a fixed-hard limit.
And… The (lossy) MP3 compression makes some peaks higher and some lower. So even though CDs use 16-integers and are hard-limited to 0dBFS, if you rip the MP3 the new-highest peaks often go over 0dB and your DAC can clip. For that reason, some people normalize to -1 or -2dB before converting to MP3. But as far as I know that slight clipping isn’t audible and MP3 is lossy anyway so I don’t worry about it.
With regular integer PCM, 0dBFS is defined as the maximum you can “count to” with a given number of bits. So you can’t go over. But MP3 doesn’t store individual samples. With floating point, a value of 1.0 represents 0dB and for all practical purposes there are no upper (or lower) limits.
When you play the file, everything is scaled to match the bit-depth of the DAC so although a 24-bit file has bigger numbers than a 16-bit or8-bit file, it’s not louder.
I see, thank you for the useful insight! I would like to be able to read peaks above 0db in my project, so it looks like I’ll have to either find a decoder other than NAudio, or I’ll just have to write my own.