Apply ReplayGain to a FLAC Tree

Overview

Recent versions of SlimServer and the SqueezeBox2 support Replay Gain, a technology to remove the annoying difference in recording levels between different albums. Replay Gain for FLAC is completely non-destructive - you can always choose whether or not to make use of the Replay Gain tags when playing, and if you choose not to the original data is preserved completely unchanged.

This is great, but by default most rippers/encoders don't apply replay gain and so you won't feel the benefit. To help with this, I've written FLACulance, a script which will walk a tree of FLAC-encoded albums, computing and store Replay Gain tags in each file.

Prerequisites:

  • Perl. On Windows, I recommend ActiveState ActivePerl;
  • FLAC. You need to have the "metaflac" executable in your path for this to work (you could hardwire it in the Perl script if you don't want to change your PATH on Windows).

I'm also assuming that, on Windows, this script (flaculance.pl) is in your path and a file association exists to execute ".pl" files with the Perl interpreter. This script makes the assumption that there is one album per directory (ie you don't mix FLAC files from multiple albums in the same directory). It doesn't matter if you have an "artist/album/track" or "artist/album - track" naming convention, however.

Usage

It's easy to use:

  • Get a command prompt;
  • Type: flaculance.pl --directory="<music directory root>".

For example, on Windows, I could run:

flaculance.pl --directory="C:\Documents and Settings\Stuart Hickinbottom\My Documents\My Music"

or, on Linux I could run:

flaculance.pl --directory=/mnt/music

And it would start working.

The "--directory" is optional and if you leave it out it will use a default path - edit the script to change that path. You can also get help with "flaculance.pl --help", which will give a full description of the arguments.

Recommended Workflow

Because processing a whole music tree takes a very long time, I would recommend creating a ripping and encoding workflow that will avoid re-computing the Replay Gain tags unnecessarily:

  1. Configure your ripper to encode to a directory separate to your main music tree;
  2. Edit this script to process that separate directory by default;
  3. After each album rip (or after ripping several in a sesssion), run FLACulance;
  4. Add folder images (or whatever else you normally do for new music), then move the newly Replay Gain'd directories into your main music tree.

History

  • 28/9/2005. Initial version.

Download

You can download the FLACulance.pl script below.

AttachmentSize
FLACulance.pl3.53 KB

Comments

HI

Used to use the script alot it's great and work very well. Alas I had a hardrive failier and I dont have it anymore......

But where has the download gone?

Should be there...

It should be there - at the bottom of the page as an attached file. Ah - I see it's not visible if you're not logged in because I've messed up the permissions.

I've fixed that now and so you should now be able to see the downloads. Thanks for letting me know and sorry for the mistake.