Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: ReplayGain and dB calculations (Read 2898 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

ReplayGain and dB calculations

Hi,

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?

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.

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?