Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: global_gain and it's relationship to MP3's 0dB and 0dBFS points (Read 2117 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

global_gain and it's relationship to MP3's 0dB and 0dBFS points

Hello everyone,

I've been trying to research this topic including digging into the MP3 specification itself to the limits of my brain power, but unsurprisingly there's a lot I don't understand. If I boil it all down to what I really want to know, it's this: All things being equal, will a low level signal always be encoded with low global_gain values relative to those that would be encoded by a similar signal at higher levels? So for example, if I only encode a -50dB 1kHz sine, will the global_gain value always be lower than an encoded -10dB 1kHz sine? Is this inherent to the spec, or will different encoder vary wildly?

I figured this would also illuminate where the FS (Full Scale) point is for the format, but I've come across other pieces of info which just further confused me. My understanding is that global_gain is an 8-bit value which is multiplied by 1.5dB, giving a dynamic range of at least 384dB (plus whatever the max value of the scale factors are?). Though unless I'm mistaken, it doesn't seem that the max value of an MP3 is the same as the 0dBFS values of 16, 24, 32-bit, etc values (which should all be the same. Only difference is on the lower end of the dynamic range scale). Now, I've also read that "The max level of an signal in the mp3 file expressed is 100% or 103dB". 103dB related to what? Where is an MP3's 0dB point, and how does it relate to PCM-encoded signals?

Thanks,
Mark

Re: global_gain and it's relationship to MP3's 0dB and 0dBFS points

Reply #1
I'm not an MP3 expert...

Quote
Though unless I'm mistaken, it doesn't seem that the max value of an MP3 is the same as the 0dBFS values of 16, 24, 32-bit, etc values (which should all be the same
MP3 doesn't store individual sample values so there is no simple limit to the sample values.    

I've done a couple of experiments with Audacity and from what I remember it was limited to about +10dB.    And I DO remember that it goes below -100dB (more dynamic range than 16-bit PWM).    That's without manipulating the global gain.    Some encoders & decoders are integer based and they will be limited to 0dB.

Of course it's "bad practice" to intentionally make an MP3 that goes over 0dB because the listener's DAC will clip if it's played at "full digital volume".

Regardless of what's going-on "inside", the decoded PCM level-out should (approximately) match the PCM level-in except for variations related to the lossy nature of MP3.    It's not unusual to rip a CD to MP3 and end-up peaks slightly over 0dB.     Some peaks get higher and some lower but apparently if you go through many generations of MP3 compression the overall volume drops.

Re: global_gain and it's relationship to MP3's 0dB and 0dBFS points

Reply #2
Thanks, DVDdoug. Yeah, it's my understanding that the various scale factors along with global_gain is applied to the various frequency domain "samples", not to PCM-like time domain samples. Since MP3 is a lossy format, there's potential to generate errors (or distortions relative to the original source) during encoding, decoding, or more likely, both before it even makes it's way to the DAC. What's not clear to me is that if global_gain itself provides 384dB of dynamic range, how does it overlap PCM? I suspect the +10dB you've seen in Audacity is more of a limit of the software rather than the format. It seems unlikely that the dynamic range would be +10dB to -374dB(!).

The thing that I'm ultimately interested in knowing is how much "headroom" exists in the global_gain field, and is there more of it in quieter MP3s. I read somewhere (I think maybe from the MP3 gain developer) that the highest global_gain value he'd seen was something like 230 which left over +30dB of headroom.


Re: global_gain and it's relationship to MP3's 0dB and 0dBFS points

Reply #3
I'm pretty sure Audacity doesn't mess with the global gain.    

MP3directCut shows a level adjustment range of +48dB to -90dB.   That would HAVE to be the global gain adjustment since MP3directCut works without decoding.   I don't often use MP3directCut...  It's interface is a bit confusing and I don't always know what it's doing.

When I try to boost by +48dB I don't see any difference inside MP3directCut but when I save and then open it in Audacity it peaks at about +18dB.     And then when I lower the volume (in audacity) it's badly distorted.

BTW - When I was previously trying to see how quiet I could go with MP3 (using Audacity) it was also distorted when I re-boosted it to the point where I could hear it.


Re: global_gain and it's relationship to MP3's 0dB and 0dBFS points

Reply #4
To my understanding, global_gain is an integral component of encoding because it reduces the amount of branching required along the huffman tree for all the frequency samples in a frame. I don't think it was ever really intended to be used by tools to change the total gain of a file, but it works.

I wonder if the distortion you've experienced after setting gain really high or low has to do with something like integer overflow of the global_gain value, or just simply maxing/minning out those values for many of those frames, which if not done proportionally, would simply trash the file.