Skip to main content

Topic: ReplayGain and dB calculations (Read 1717 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • Kyopaxa
  • [*]
ReplayGain and dB calculations

I've been trying to create my own implementation of ReplayGain to gather some personalized statistics over thousands of OGG files.
For that I used the source code of VorbisGain 0.37, just doing some small modifications to get the numbers I need, but now I'm totally confused about how ReplayGain calculates the audio levels. I read the wiki documentation, read a lot of articles about dBFS, dB SPL and RMS, but I am still lost with what's currently implemented in the C code of ReplayGain...

In the wiki, it states that RG tries to normalize the tracks to SMPTE-sanctioned 89 dB SPL, but in the code, the reference number used is actually 64.82:

Code: [Select]
#define PINK_REF                64.82 //298640883795                              // calibration value

Now, this is where I'm totally lost. What does this 64.82 stands for? Maybe is because ReplayGain C implementation calculates the values in a different dB scale? What scale is that?

  • Notat
  • [*][*][*][*][*]
ReplayGain and dB calculations
Reply #1
The 89 dB SPL is a bit difficult to explain without unspooling the whole ball of yarn. ReplayGain operates by comparing the measured loudness of an audio file with the measured loudness of a reference signal. The reference signal is pink noise at -14 dB RMS. The constant in the code represents the measured loudness of this reference. If a measured file is found to be louder than this, ReplayGain will attenuate it.

  • Kyopaxa
  • [*]
ReplayGain and dB calculations
Reply #2
Wow, I think I finally understood the whole thing! Thanks a lot.

So, to put this with other words:

The calibration value of 64.82 is the result of processing a -14dbFS pink noise signal with ReplayGain loudness algorithm.

I only have a question left.

Is this 64.82 still measured in dbSPL (According to SMPTE)? After all, the loudness value is the RMS value of a particular 0.05 sec chunk selected after cropping the first 5% higher level 0.05 sec chunks of the processed file, isn't it?
  • Last Edit: 18 January, 2012, 07:41:57 PM by Kyopaxa