This plugin adds support for ReplayGain, a technique for normalizing audio playback levels.
This plugin can use one of many backends to compute the ReplayGain values: GStreamer, mp3gain (and its cousin, aacgain), Python Audio Tools or ffmpeg. ffmpeg and mp3gain can be easier to install. mp3gain supports less audio formats than the other backend.
Once installed, this plugin analyzes all files during the import process. This
can be a slow process; to instead analyze after the fact, disable automatic
analysis and use the
beet replaygain command (see below).
To speed up analysis with some of the avalaible backends, this plugin processes
tracks or albums (when using the
-a option) in parallel. By default,
a single thread is used per logical core of your CPU.
To use GStreamer for ReplayGain analysis, you will of course need to
install GStreamer and plugins for compatibility with your audio files.
You will need at least GStreamer 1.0 and PyGObject 3.x (a.k.a.
Then, enable the
replaygain plugin (see Using Plugins) and specify
the GStreamer backend by adding this to your configuration file:
replaygain: backend: gstreamer
The GStreamer backend does not support parallel analysis.
mp3gain and aacgain¶
In order to use this backend, you will need to install the mp3gain command-line tool or the aacgain fork thereof. Here are some hints:
- On Mac OS X, you can use Homebrew. Type
brew install aacgain.
- On Linux, mp3gain is probably in your repositories. On Debian or Ubuntu,
for example, you can run
apt-get install mp3gain.
- On Windows, download and install the original mp3gain.
Then, enable the plugin (see Using Plugins) and specify the “command” backend in your configuration file:
replaygain: backend: command
If beets doesn’t automatically find the
you can configure the path explicitly like so:
replaygain: command: /Applications/MacMP3Gain.app/Contents/Resources/aacgain
Python Audio Tools¶
This backend uses the Python Audio Tools package to compute ReplayGain for a range of different file formats. The package is not available via PyPI; it must be installed manually (only versions preceding 3.x are compatible).
On OS X, most of the dependencies can be installed with Homebrew:
brew install mpg123 mp3gain vorbisgain faad2 libvorbis
The Python Audio Tools backend does not support parallel analysis.
To configure the plugin, make a
replaygain: section in your
configuration file. The available options are:
- auto: Enable ReplayGain analysis during import.
- threads: The number of parallel threads to run the analysis in. Overridden
--threadsat the command line. Default: # of logical CPU cores
- parallel_on_import: Whether to enable parallel analysis during import.
As of now this ReplayGain data is not written to files properly, so this option
is disabled by default.
If you wish to enable it, remember to run
beet writeafter importing to actually write to the imported files. Default:
- backend: The analysis backend; either
- overwrite: Re-analyze files that already have ReplayGain tags.
- targetlevel: A number of decibels for the target loudness level for files
- r128_targetlevel: The target loudness level in decibels (i.e.
<loudness in LUFS> + 107) for files using
R128_tags. Default: 84 (Use
83for ATSC A/85,
84for EBU R128 or
89for ReplayGain 2.0.)
- r128: A space separated list of formats that will use
R128_tags with integer values instead of the common
REPLAYGAIN_tags with floating point values. Requires the “ffmpeg” backend. Default:
- per_disc: Calculate album ReplayGain on disc level instead of album level.
These options only work with the “command” backend:
- command: The path to the
aacgainexecutable (if beets cannot find it by itself). For example:
/Applications/MacMP3Gain.app/Contents/Resources/aacgain. Default: Search in your
- noclip: Reduce the amount of ReplayGain adjustment to whatever amount
would keep clipping from occurring.
This option only works with the “ffmpeg” backend:
- peak: Either
true(the default) or
trueis more accurate but slower.
By default, the plugin will analyze all items an albums as they are implemented.
However, you can also manually analyze files that are already in your library.
beet replaygain command:
$ beet replaygain [-Waf] [QUERY]
-a flag analyzes whole albums instead of individual tracks. Provide a
query (see Queries) to indicate which items or albums to
analyze. Files that already have ReplayGain values are skipped unless
-w (write tags) or
-W (don’t write tags) to control
whether ReplayGain tags are written into the music files, or stored in the
beets database only (the default is to use the importer’s configuration).
To execute with a different number of threads, call
beet replaygain --threads N:
$ beet replaygain --threads N [-Waf] [QUERY]
with N any integer. To disable parallelism, use
ReplayGain analysis is not fast, so you may want to disable it during import.
auto config option to control this:
replaygain: auto: no