Replay Gain

How to play your digital music collection without volume fluctuations.

What is Replay Gain?

Replay Gain is one suggested way of smoothing out volume fluctuations when you play your digital music files, without affecting the audio information stored in the files.

Simply put, a Replay Gain tool analyses the audio in a digital music file and then decides how much louder or quieter that music file ought to be to achieve a standard volume. Then it writes this value, the gain, as a small piece of metadata to the music file. Meta data is just text that gets attached to the file alongside the audio, such as the metadata that describes the artist and track name.

Then a music player that supports Replay Gain can read the relevant piece of metadata and alter the volume of playback for that track. This means that you don't need to be constantly reaching for the volume dial on your speakers every time a loud album follows a quiet album, and vice-versa.

Can I use Replay Gain with my music collection?

Very probably, yes. In theory, any audio format that supports arbitrary metadata can support Replay Gain.

What's less convenient is finding a tool that adds Replay Gain meta tags to digital music files, and finding a digital music player that understands what to do with this Replay Gain data.

For people who are prepared to switch to another digital music player, and who have their digital music files well organised on their hard drive, I recommend the free foobar2000. I use foobar2000 to add Replay Gain data to my music files which are in MP3 and FLAC formats. Foobar2000 can also use Replay Gain with music files in the following formats: Ogg Vorbis, AAC, Monkey's Audio, MPC, WAV, WavPack.

Using Replay Gain in foobar2000

Foobar2000 is able to analyse your music files and add Replay Gain data to their metadata sections, then playback those files so that there are no volume fluctuations between tracks tagged with Replay Gain data.

Foobar2000 doesn't offer beautiful skins or visualisation effects, but for people who just want to play back their music while on their PC without volume changes, it works just great.

Installing foobar2000 for Replay Gain use

Go to the foobar2000 website and download the installer for the latest version of the software. Once you have the file downloaded to your machine, double-click the file to run the installer.

When you are asked which options you want installed, click the plus signs in the options tree to expand the branches fully, and make sure that the options "Album list" and "ReplayGain scanner" have a tick by them. Then continue with the installation.

Adding your music to your foobar2000 Media Library

When foobar2000 is running, go to the File menu and click Preferences. Once the preferences dialogue appears, click the branch labelled "Media Library" in the tree on the left of the dialogue. A window labelled "Music Folders" ought to be visible in the top-right of the dialogue. Click the Add button and browse your hard drive to locate the folder that acts as home to your music files. Note that foobar2000 will find all the music files inside the folder you add, so you don't need to add every individual folder that contains an album or an artist.

screenshot: A view of the preferences dialogue in foobar2000.

After you've added the folder or folders that contain your audio files, click the button that says "Scan All". Foobar2000 will search through the folder(s) you added to the Media Library, and find the music files contained within. Once it's finished, click "Save All" at the bottom of the preferences dialogue, and then click Close.

Tagging your music files with Replay Gain meta tags

Back at the main window, go to the Library menu and click "Album List". The Album List window should contain a tree that lists all of the music that you added to the Media Library. You can alter the way the music is arranged in the Album List window by using the View option at the bottom-left of the window. What you want is for each album to appear as a single branch on the tree, so that you can select a whole album with one click. If your music files are tagged with the right album names, then "View... by album" should work. A better option, if your music is arranged into folders so that each artist has its own folder which contains a folder for each album by that artist, then try "View... by directory structure".

Once you are able to select a single album, right click a branch that represents an album. A context menu should appear with a sub-menu called ReplayGain. In the ReplayGain sub-menu, click "Scan Selection As Single Album". The tracks belonging to that album will then be analysed, and a summary will show you what volume adjustment each track on the album, and the album itself, need to reach a standard volume. By clicking "Update File Tags", you tell foobar2000 to write this Replay Gain data to the audio files' metadata area. The audio in the file will be affected in no way, so don't worry about damaging the sound of the file.

screenshot: A view of the Album List window in foobar2000.

There you go. One album tagged with Replay Gain metadata. For Replay Gain to offer a real benefit, you need all of the music files you listen to regularly to be tagged with Replay Gain data. If your music files are all tagged with album and artist metadata, and if all the tracks on each album share exactly the same album name and artist name, then you should just be able to select the "All music" branch at the top of the Album List tree, then open the ReplayGain sub-menu and click the option "Scan Selection As Albums (by tags)". Foobar2000 should then use the tags to work out which tracks belong to which album, and it can analyse and tag all of your music files in one go. Proceed to the next section.

If you're a fussy audiophile and you've given the tracks on some albums (such as compilation albums) different artist names depending on who performs on each track, then the "Scan Selection As Albums (by tags)" option will get confused. The simplest solution is to do that anyway, and then rescan these quirky albums individually by selecting the branch for each quirky album one at a time.

Replay Gain playback in foobar2000

When you've tagged your music files with Replay Gain data, you need to enable Replay Gain playback in foobar2000. Go to the File menu and open the preferences dialogue again. This time select the Playback branch from the tree on the left.

Under the main volume control should be a section labelled "Replaygain". Make sure that source mode says either album or track. Processing should be set to "apply gain". Under that, the slider labelled "With RG info" should be set to 0.0, and I recommend setting the slider labelled "Without RG info" to -8.0 (that's minus eight) or less. Then click "Save All" at the bottom of the dialogue, then Close. And that's it. All your music files tagged with Replay Gain data should play without fluctuations in volume. Just remember to tag new albums with Replay Gain data when you add them to your collection.

If you're wondering what the different settings for the source option do:

track
This mode only pays attention to the track gain value recommended by Replay Gain. Each track will have its own peak and average volume, and this mode adjusts the gain so that every track plays back at the same volume. Possibly the best option if you always use shuffle mode across your entire audio collection.
album
This mode uses the album gain value recommended by Replay Gain data, so that a loud track on a particular album still sounds louder than a quiet track from the same album. This mode is probably best if you like to listen to albums in track-order, otherwise the volume may jump or fall slightly between a quiet track and a loud track on the same album.

Replay Gain alternatives to foobar2000

I have grown to like foobar2000's no-nonsense but effective approach to playing digital music. It may not be to everyone's taste, though. If you crave skins and visualisation, then it is possible to use Winamp's FLAC plug-in to playback FLAC files that have Replay Gain data tagged onto them. But Winamp offers no way of calculating Replay Gain data for FLAC files, and it only offers a gain adjustment slider for files tagged with Replay Gain, not for files without. But it could still work for you if all your music files are in FLAC format, and they've all been tagged with Replay Gain data by another tool (such as foobar2000).

Version 5.3 of Winamp offers a built-in Replay Gain analyzer, which works for MP3 files but not FLAC files, and it pops open a new window for each album being analyzed, which would make scanning your entire collection in one go pretty painful. It also seems very slow compared to foobar2000, taking four minutes to analyze an album of twelve tracks, where foobar2000 completed the analysis in about a minute. So this added feature is a step forward for Winamp, but it needs a lot more work before it compares to the flexibility of foobar2000's Replay Gain scanner.

If you want other options, take a look at HydrogenAudio's list of software music players that support Replaygain.

As for me, I'll stick with foobar2000 for now.

Linux users

I've created a page about Replay Gain in Linux which tells you how to install foobar2000 in Ubuntu, how to use a command-line script to tag all of your FLAC files, and which Linux audio players actually make use of Replay Gain data.

See also

If you found this article useful, you may also be interested in my big comparison of audio formats for ripping and encoding CD albums.

FeedBack

Post a comment about Replay Gain.