Replay Gain

From Hydrogenaudio Knowledgebase
Revision as of 19:39, 16 August 2009 by CiTay (talk | contribs) (→‎Linux)

Replay Gain is the name of a technique invented to achieve the same playback volume of audio files. It specifies the reference level of 89dB and an algorithm to measure the perceived loudness of audio data.

Replay Gain is different from peak normalization. In peak normalization, you merely ensure that the peak amplitude reaches a certain level. This does not ensure equal loudness. The Replay Gain technique measures the effective power (i.e. taking RMS after an Equal Loudness contour) of the waveform, and amplifies the waveform accordingly. The result is that Replay Gained waveforms are usually more uniformly amplified then peak-normalized waveforms.

Implementations

There are different Replay Gain implementations, each with its own uses and strength. Most of them use metadata to indicate the level of the volume change (Volume is adjusted on playback; needs player/decoder support) others modify the audio data itself. Generally it is recommended to use an implementation which uses the metadata and does not touch the audio itself.

In a metadata based solution, information on both types of Replay Gain can be stored, and the desired playback effect can be switched back and forth in the appropriate player. However, if the audio data is permanently modified, only one type of Replay Gain can be chosen. Furthermore, if the audio data is modified, you may not be able to restore the original data, especially if the Replay Gain technique produces a negative amplification.

Replay Gain has significant advantages over normalizing. It allows the loudness of a song to be consistant over an entire collection of audio, similar to (but more accurate than) RMS normalizing (this is called 'Track Gain', or 'Radio Gain' in earlier parlance). However, it also allows the loudness of an album to be consistant over a entire music collection, allowing the dynamics of album to remain (This is called 'Album Gain', or 'Audiophile Gain' in earlier parlance). This is usually very important in classical CDs, as there may be quiet segments and loud segments written into different tracks.

MP3Gain

MP3Gain is an implementation of Replay Gain. It either modifies target data reversibly, or attaches metadata.

AACGain

AACGain is a modified version of MP3Gain that works on both MP3 and AAC files.

LAME

Musepack Replay Gain

  • Method: Header (similar to Meta data method)
  • Notes: Replay Gain values are stored in the header and Replay Gain is part of the Musepack specifications; therefore any Musepack decoder that does not support Replay Gain can be considered broken.
  • http://www.musepack.net/

VorbisGain

Note: Andavari has provided a very useful script to integrate VorbisGain, which is a CLI tool, into Windows Explorer. Please (Ogg) check this section.

FLAC / METAFLAC

WavPack / WVGAIN

Wavegain

foobar2000 Replay Gain scanner

MediaMonkey

  • Format:
  • In addition to tags, all Replay Gain values are also stored in MediaMonkey's MDB database
  • Does not support Album/Audiophile Replay Gain (Added to new MediaMonkey version 3
  • Also capable of (irreversibly) changing the volume of MP3 tracks, similar to MP3Gain
  • http://www.mediamonkey.com

Winamp Replay Gain scanner

Players support

Replay Gain being present in the specs of FLAC, Musepack, and APE formats, any player that support those formats usually support Replay Gain.

The situation with MP3 is rather different, as it was not part of the MP3 specs. The APEv2 tags metadata implementation is somewhat becoming the de-facto standard.

Windows

  • foobar2000 supports Replay Gain in all possible aspects.
  • Winamp supports Replay Gain in album or track mode.
  • MediaMonkey supports track Replay Gain only
  • XMPlay recently implemented Replay Gain

...and probably others.

Linux

For MP3, use the CVS version of the xmms-mad mp3 plugin (it's not yet released as binary, furthermore not available in distribs' versions for now. Meanwhile binaries are available here: custom binaries)
And possibly others, since TagLib added support for APEv2 tags in MP3 files, players using this library (like amaroK and JuK) might support that kind of Replay Gain tags in the near future.
Requires support to be enabled (via the appropriate python bindings and libraries) for the above formats. Does not support Replay Gain values stored in APEv2 tags in MP3s. Replay Gain values are stored in RVA2 id3v2.4 frames. See the Quod Libet RVA2 / Replay Gain notes.
foobar2000-style TXXX frames in MP3s are also supported in the latest development releases.
  • MPlayer. Mplayer support for Replay Gain is codec dependent.
Codecs that are known to support Replay Gain: vorbis
Because of this, you need to prioritize the codecs that support it, or choose it individually on the command line. To add it to the command line, add an -ac [codec] option after each file that you want to choose the codec for, or at the beginning to make it apply to all files listed. To prioritize the codecs by default, list them in a line in mplayer.conf:
ac=[codec],[othercodec],vorbis,mad,

Portable devices

Rockbox supports Replay Gain (in album or track mode) for most formats, including WMA, MP1/2/3, AAC, ALAC, Musepack, Monkey's Audio, Wavpack, FLAC and Vorbis.
Note that Replay Gain is only supported when using the respective codec's native tagging format. For example: Replay Gain stored in APEv2 tags is not supported for MP3, rather ID3v2.x tags are expected.

There are no other portable players known to support Replay Gain.

The iPod features Soundcheck, which seems to produce roughly the same normalization gains as Replay Gain, but doesn't provide an Album Gain.

Hi-Fi

Slim Devices a company owned by Logitech Inc, supports Replay Gain on both of their hi-end audiophile players, known as the Transporter and the Squeezebox.

External links