MP3 encoding questions

Writing software that inputs and/or outputs audio and performs DSP algorithms such as filters, new codecs or audio effects.
Post Reply
msat
Senior User
Posts: 33
Joined: Tue 2019-05-14 16:52

MP3 encoding questions

Post by msat »

I have a sort of high level understanding of how MP3 encoding/decoding works, but trying to understand some details that are relevant to my project from the MP3 specification and elsewhere seem to be beyond my comprehension. I'm hoping maybe someone here can help me out.

Using a VS1005, say I input a signal to the ADC at -50dBFS and route it to the MP3 encoder (with no software gain in between), will the values of each frame's global_gain side information field always be lower than if that same signal was input at -20dBFS?

While I haven't found anything definitive that states it, I believe that MP3s have dynamic range headroom higher than that of PCM. That is, MP3 has some equivalent of 0dBFS, but it is higher than the 0dBFS of PCM. If this is true, how much more headroom does it have?

Ultimately, the reason I am asking is this: My project may often need to apply gain to the MP3 encoded by the VS1005 at some point after recording, and I am expecting to do this by changing each frame's global_gain value similar to the software program MP3Gain. In order to be able to do that reliably, I need to make sure audio encoded from low signals has corresponding low values of global_gain so that there's margin to increase it's value. Is this plasuible?

Thanks,
Mark
User avatar
pasi
VLSI Staff
Posts: 2102
Joined: Thu 2010-07-15 16:04

Re: MP3 encoding questions

Post by pasi »

The determination of global_gain depends on the implementation.

In our case, the encoder does nothing drastic, it tries to keep the global gain as well-behaved as possible. So, excluding any transients and change of bitrate (or fill state of bit reservoir) that affect the quantization, there is a direct correlation between the signal level and the value in global_gain.

TLDR; mp3gain should work on the files created. But like mp3gain, you should check that you're within the valid values for global_gain.
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook
msat
Senior User
Posts: 33
Joined: Tue 2019-05-14 16:52

Re: MP3 encoding questions

Post by msat »

Excellent! Thanks, Pasi!
Hannu
VLSI Staff
Posts: 512
Joined: Mon 2016-05-30 11:54
Location: Finland
Contact:

Re: MP3 encoding questions

Post by Hannu »

what about ftidcbl and ftiagc drivers?

You are probably already using ftidcbl but with ftiagc you could try to control the dynamics. That way you get louder signal.

But there is at least one catch. If you feed agc silence it turns gain up and when real signal comes it is LOUD. So some kind of noise gate or similar is needed which tells agc not to turn volume up to 11.
Post Reply