-> Home

Port of mp3gain to ANSI C/C++, extension for RIFF Wave and Ogg Vorbis files

Release: 1.3.1/3c (based on mp3gain 1.3.1)

→ introduction → usage → download → history → changes → todo → contact


Mp3gain is a powerful utility to modify the real loudness of MPEG audio files automatically to one common level. It utilizes the psychoacoustic model of ReplayGain to do the loudness analysis. The modifications to the MPEG files are lossless (i.e. without any additional losses) and reversible. See the original home pages for further details.

The modification of the MPEG files is done in place and lossless.
The utility can operate on MPEG 1, MPEG 2 and MPEG 2.5 Layer 1, 2 and 3 files.

WAVgain does the same on RIFF wave files.
Due to the nature of the PCM files this procedure is in contrast to MPEG audio files neither lossless nor exactly reversible. However, the losses are small.

vorbisgain is based on the vorbisgain 0.36 source that writes the replay gain tags as Vorbis comments. But options to apply the gain changes directly and lossless to the Vorbis stream are added. This enables player software or hardware that is not aware of the ReplayGain tags to play at reasonable loudness.
Due to the Vorbis file format only floor 1 files that do not use floor multiplier 3 are supported. This probably applies to the majority of Vorbis files.


Installation of the binaries (OS/2)

Copy the executable files somewhere to your hard drive. You probably want to use a folder which is listed in your PATH environment. You must have the libc063 runtime installed (search at Hobbes).

Installation of the binaries (Linux i386)

Copy the executable files somewhere to your hard drive, e.g. /usr/local/bin or ~/bin. You probably want to use a folder which is listed in your PATH environment.
Libvorbis is not required for execution and cannot be used because it does not support lossless gain manipulation.

Instruction for other platforms

Compile your own binaries using gcc or a gcc-compatible compiler like Cygwin. The source should not contain any platform specific stuff. You can use the included Makefile. However, it is most likely that you have to modify the first few lines to match your environment and platform.


Use mp3gain to adjust the loudness of MPEG audio files and wavgain for wave files.

See command line help for details:
mp3gain /? or
wavgain /? or
vorbisgain respectively

Note that vorbisgain uses an entirely different command line syntax.


To adjust one file with manual control use something like
mp3gain /a /Ia /d2 filename
/a and /r are the same for one file. /d2 tweaks the very "safe" default setting by +2dB. A good choice for pop music.
To adjust a whole album with manual control
mp3gain /a /Ia /d2 track1_file track2_file track3_file ...
On platforms where the command shell expands wildcards (like Unix) you may simply use the following statement to treat all files in the current directory as one album
mp3gain /a /Ia /d2 *.mp3
If you have to process a very large number of files you may not like the interactive mode. However, you will need a shell script for the iteration over the files.
mp3gain /a /Ca /d2 current_file


This program is distributed under the terms of the GNU LESSER GENERAL PUBLIC LICENSE. Except for libogg/libvorbis which is a BSD license.

ZIP file with C source and this guide

OS/2 binaries

Linux i386 (x86) binaries


Version 1.3.1/3c (May. 19, 2015)

Version 1.3.1/3b (Aug. 21, 2009)

Version 1.3.1/3a (Jan. 2, 2004)

Version 1.3.1/3 (Dec. 16, 2003)

Version 1.3.1/2a (Dec. 07, 2002)

Version 1.3.1/2 (Dec. 04, 2002)

Version 1.0.5 (pre) first public release

Changes and extension to the original distribution



Suggestions, help, complaints (but not too much:-): Mail address: mueller (at) maazl (dot) de

Original location of this page: http://www.maazl.de/project/mp3/mp3gain.html