Radio Novas laboratorium


EBU R128 library (fighting the loudness war)

UPDATE Version 0.2 is now available.

For many years the loudness war have been going strong.

As a broadcaster we both love and hate the war; we must admit we do quite extensive processing of our audio on the FM, DAB+ and webradio platforms. It gives us identity (the "Nova sound"), and also cover up minor mistakes in editing and program flow.

On the other side we're also depending on pre-recorded audio material (also known as music). Most of this arrives in some digital form, each one mastered with different levels of loudness. To simplify the work of the engineers, we prefer to have all our music to be normalized to a common level. Typically Replay Gain have been used.

EBU have been working hard for the last couple of years to provide a recommendation and guidelines for broadcasters, to assure that the listeners experience an even loudness level at all times. The work has resulted in the recently published EBU recommendation 128 (EBU R128). It includes both specification to calculate loudness, and recommendation for levels (-23 LUFS). LUFS is the new scale for representing "loudness levels".

For those interested in further details, On the way to Loudness nirvana by Florian Camerer is a good place to start.

The specification and various test files are available at the EBU website.

So, why this post? On our projects page you'll find our implementation of a r128 library available for download. It is released as C source, under the Open Source GPL license, and is tested on Linux with GCC. It should also be easily portable to other platforms. It can be used for live metering or off-line analyze of audio files (e.g. for normalizing).

We've also included a couple of example programs for analyzing pcm wave files and any file supported by ffmpeg / libavcodec. It supports up to 255 audio channels.

Please note: The library is not yet fully tested, most likely there are many bugs and there's certainly room for improvements in the implementation. Please feel welcome to report bugs and other suggestions to labs[a]

The testfiles available from the EBU website (and Tech 3341 pg 9) produce the following results:

Test case Test signal Minimum requirements Library results
1 Stereo sine wave, 1000 Hz, -23.0 dBFS (per-channel peak level); signal applied in phase to both channels simultaneous; 20 s duration
M, S, I =
-23.0 ±0.1 LUFS
M= -22.95 LUFS
S = -22.95 LUFS
I = -22.95 LUFS
2 As #1 at -33.0 dBFS
M, S, I =
-33.0 ±0.1 LUFS
M= -32.96 LUFS
S = -32.96 LUFS
I = -32.96 LUFS
3 As #1, preceded by 20 s of -40 dBFS stereo sine wave, and followed by 20 s of -40 dBFS stereo sine wave


I =
-23.0 ±0.1 LUFS
I = -22.95 LUFS
4 As #3, preceded by 20 s of -75 dBFS stereo sine wave, and followed by 20 s of -75 dBFS stereo sine wave
I =
-23.0 ±0.1 LUFS
I = -22.99 LUFS
5 As #3, but with the levels of the 3 tones at -26 dBFS, -20 dBFS and -26 dBFS, respectively
I =
-23.0 ±0.1 LUFS
I = -22.96 LUFS
6 5.0 channel sine wave, 1000 Hz, 20 s duration, with per-channel peak levels as follows:
-28.0 dBFS in L and R
-24.0 dBFS in C
-30.0 dBFS in Ls and Rs
I =
-23.0 ±0.1 LUFS
I = -23.01 LUFS
7 Authentic programme 1, stereo, narrow loudness range (NLR) programme segment; similar in genre to a commercial/promo
I =
-23.0 ±0.1 LUFS
I = -22.97 LUFS
8 Authentic programme 2, stereo, wide loudness range (WLR) programme segment; similar in genre to a movie/drama
I =
-23.0 ±0.1 LUFS
I = -23.01 LUFS

So... head over to our projects page and grab a copy!

Posted by staale

Comments (12) Trackbacks (1)
  1. Check out these other open source projects working on EBU R128 implementations:

    Maybe some cooperation is worthwhile?

    • Hi Lars,

      We’ve actually been keeping an eye on these, and are happy to see that more people are noticing this standard and developing open solutions :)

      It looks like all projects are involving in the correct direction, and hopefully we’ll benefit of each others code in the future.

  2. Hi,

    so far the only opensource implementation i found of EBU R128 that compile and runs on MacOSX 10.6.6.


    • Hi Rens,

      That’s good news, hope you enjoy the software. BTW; Did you have to do any changes, or did it compile “out of the box”?



  3. Hi Staale,

    just compile “out of the box”. Just make shure your ffmpeg is compiled with the configure option –enable-shared to create the neccesary dynamic loaded shared libraries to needed to create ffmpeg_analyze.



    • Cool!

      Please note that we’ve discovered a small bug in the multi-channel code (if used with >2 channels) in the ffmpeg_analyze example. We hope to have a new version ready in a few days.

  4. Hi Staale,

    any progress on the update ?

    • Hi Rens,

      Sorry for the delay. The bug has been fixed, but we’d like to also implement the changes in the new revision of EBU R128 before releasing the next version. It should be ready very soon.

      • Rens & others,

        Please note that a new version is released. It improves multichannel handling and allows changing the relative gain value.

        Have fun!

  5. Rens: Care to share some tips on how to compile this on OS X?

  6. staale: if one would want to:

    a. analize in 1st pass using ffmpeg and store the gain value
    b. encode the same file in 2nd pass using same ffmpeg, but with the gain value set

    what would be the most decent option cli wise? and the fastest as well?
    (what i’am talking about are video files with either 1ch, 2ch, 6ch or more audio)

    • Hi smok3,

      Sorry for the late reply.

      Not 100% sure, but you could try the following;

      Get the LU value from the analyzer (e.g. 8LU), this would mean that you need to lower the volume by 8dB to acheive the target level of -23LUFS.

      Calculate the amplification factor using the formula;

      ampl=10^(-LU / 20) , that is 10 power where the exponent is the fraction of -LU divided by 20
      so here, ampl=10^(-8/20) = 10^(-0,4) = 0.3981. This means that all audiosamples should be reduced to approx 40% of their current value.

      Now, you could to use the -vol option in ffmpeg. -vol seem to expects the value of 256 to be 100%, 512 to be 200% 128 to be 50% etc. So, do 256 * ampl to get the value to use; in this case it will be approx 101.915….

      ffmpeg -vol 102 … should do the trick. But note, I haven’t tested it :)

Leave a comment

Connect with Facebook


Switch to our mobile site