Improved Loudness Correction With EBU R128

2011 January 18
by Simba
Mix by Niels Linneberg, on Flickr
Creative Commons Attribution-Noncommercial-Share Alike 2.0 Generic License by  Niels Linneberg

Music mastered at different levels can be a pain when you’re a dj, as well as when listening to music at home. The great differences in loudness levels is in part due to what is sometimes called the “Loudness War“, but sometimes it is just inconsistent between different issuers. As long as you listen to a CD/compilation as it was designed from the issuer, there is no problem, it is when you start mixing tracks from different sources that the volume starts jumping up and down…

I have used ReplayGain to adjust automatically to a target volume level, and it has served me well. It’s not perfect, though, so I read with great interest about efforts to create tools to implement the EBU R128 standard which is supposedly a better technology for achieving basically the same goal. ReplayGain works very well within music with more or less the same sonic spectrum in my experience, but tended to play modern recordings with lots of bass louder than older music like golden age tango music to pick a completely random example. This would even be noticeable between early and late Di Sarli for instance, not that I would play them together in the same tanda, but just to give you an idea. Much better than random jumping up and down, but with room for improvement.

Two projects were announced at approximately the same time, R128gain and libebur128. I did a little testing with libebur128, and the preliminary results are very promising. I now got my music collection basically converted to using R128 in place of ReplayGain. I also compared the gain values generated with ReplayGain and R128, and it verified my impression that typical pop music will be played back at lower volume, relatively, than before, and typical golden age tango material will be played louder.

To tag my main collection, which resides on a Linux box, I used a small bash script to recursively tag all flac files directory by directory:

#!/bin/bash
find . -type d|
while read dir; do
./r128-sndfile -t ./rgtag.py "$dir/"*.flac
done

This assumes you got the r128-sndfile executable in the directory you need to tag.

EDIT: There is now a foobar2000 scanner available as well.

EDIT: The new version of foobar2000 (1.1.6) incorporates the libebur128 library for scanning of replaygain values. Libebur128 is now hosted at github The new version (0.4) does not use the python script anymore, and supports recursive tagging natively.

2 Responses leave one →
  1. 2011 April 20
    Chris permalink

    Thanks for that.

    > This assumes you got the r128-sndfile executable in the directory you need to tag.

    I think there’s also an assumption about the Python script ./rgtag.py

  2. 2011 April 20

    Correct. If the executable and the python script is found in your path, just remove the “./” in front of both of these. This script is actually obsolete now, the new version doesn’t use a python script anymore.

    Also worth noting is that the most recent version of foobar2000 (1.1.6, currently in beta) uses this library for calculation of replaygain values, replacing the method used so far.

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS