Head-Fi.org › Forums › Equipment Forums › Sound Science › ReplayGain
New Posts  All Forums:Forum Nav:


post #1 of 3
Thread Starter 
Can someone tell me how replay gain works?
Does add negative gain/reduce gain based on peaks and how close it is to 0 dbfs or average loudness to 0 dbfs etc. Specifically for foobar, if it makes any difference
post #2 of 3
It's actually a bit more involved than I realized. Here's what I found, and hopefully it's mostly accurate:

1) At a given SPL, certain frequencies sound softer to humans than others. Replaygain applies a custom IIR filter to the track/album, which lowers the levels of the frequencies that sound softer for the scan (roughly an inverted Fletcher-Munson curve). This way the frequencies that sound softer, will be calculated as being softer.

2) RMS (average) energy levels are calculated for each small period of time on the track/album. From the original specs, each period of time is 50 ms.

3) All of these RMS values are ordered, loudest to softest. One of them must be chosen to represent the entire track. According to the original spec, they go with the one at 95% (5% of the values are louder than it, and 95% are softer).

4) Pink noise in both channels with RMS at -20dbFS is defined as 83 db. Every song's result gets calibrated based on that. Actually now the default value is "89 db", or making everything sound as loud as pink noise in both channels with -14dbFS RMS.

Foobar2000 playback processing:

Track/Album: In album gain, gain would be applied to each album to equalize their values from the steps above. In track gain, each track is taken separately. You can actually edit either set of RG tags manually to make certain tracks actually play louder or softer if you feel they need it.

Pre-amp with RG info: This raises or lowers the gain of all files that are being processed by the same amount, relative to that default "89db". Really it's no different from f2k's volume control, except it applies specifically to files being processed with RG, and also it comes before this clipping prevention step:

Prevent clipping according to peak: If this option is on, after the RG and preamp gain have been applied to the track, it will check to see if the highest peak on the track is going to be above 0dbFS. If it does, it will lower the gain of that track so that it peaks right at 0dbFS. I also note that this option can be turned on, even if RG processing is off. Presumably this lowers the gain of compressed files which have peaks above 0dbFS (this does happen with lossy compression on hot tracks quite often).

Since f2k uses floating point processing, you can prevent clipping at any stage in the chain. One might choose to use a limiter at the end of the DSP chain, lower the f2k volume control, lower the pre-amp controls, or use the clipping prevention feature.
post #3 of 3
Thread Starter 
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Sound Science
Head-Fi.org › Forums › Equipment Forums › Sound Science › ReplayGain