MP3Gain

From Hydrogenaudio Knowledgebase
Revision as of 23:03, 6 September 2006 by Pepoluan (talk | contribs) (Category:Software)

MP3Gain is a program that analyzes MP3 files to determine how loud they sound to the human ear. It can then adjust the MP3 files so that they all have the same loudness without any quality loss. This way, you don't have to keep reaching for the volume dial on your MP3 player every time it switches to a new song.

MP3Gain is an implementation of Replaygain, supporting Track mode and Album mode. However, with most other formats, the necessary loudness adjustment of Replaygain is stored as metadata, thus leaving the encoded results alone. With MP3Gain, the loudness adjustment is done on the data itself, albeit in a lossless/reversible way. Another difference with MP3Gain is the fact that it can only adjust physical volume in 1.5 dB steps.

Technical Explanation

Here's the technical reason on why it's lossless (despite operating on the data itself), and also why the smallest change possible is 1.5 dB:

The MP3 format stores the sound information in small chunks called "frames". Each frame represents a fraction of a second of sound. In each frame there is a "global gain" field. This field holds an 8-bit integer which can represent values from 0 to 255.

When an MP3 player decodes the sound in the frame, it uses the global gain field to multiply the decoded sound samples by 2^(gain/4).

  • If you add 1 to this field in all the MP3 frames, you effectively multiply the amplitude of the whole file by 2^(1/4) = 119% = +1.5 dB.
  • Likewise, if you subtract 1 from this field, you multiply the amplitude by 2^(-1/4) = 84% = -1.5 dB.

The way MP3Gain works actually has a very strong benefit: Since it is the data itself that is modified, MP3Gain does not require special support from players.


Links