MP3Gain

From Hydrogenaudio Knowledgebase
Jump to: navigation, search
MP3Gain
MP3Gain.png
MP3Gain 1.2.5 main window
Developer(s) Glen Sawyer
Release information
Initial release
Stable release 1.2.5 (January 9, 2005; 19 years ago)
Preview release 1.3.4 / September 24, 2018; 6 years ago
Compatibility
Operating system Windows
Additional information
Use ReplayGain
License TBC
Website {{{website}}}

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.

Tags

MP3Gain writes the following APEv2 tags, which is what allows the tool to reverse the changes:

  • MP3GAIN_MINMAX
  • MP3GAIN_ALBUM_MINMAX
  • MP3GAIN_UNDO

Modifying the file's tags in another program, such as foobar2000, may cause any MP3Gain-specific tags to be stripped from the file.[1]

References

  1. Remove ReplayGain tags without removing MP3Gain tags on hydrogenaudio

External links