desbma / r128gain

Fast audio loudness scanner & tagger (ReplayGain v2 / R128)
GNU Lesser General Public License v2.1
170 stars 9 forks source link

Discrepancy between different tools #45

Open 239 opened 1 year ago

239 commented 1 year ago

While I was looking for a suitable tool for Linux, I made a small comparison with 4 flac/opus files. This resulted in some very different values, which I would like to share here. Could it be that I've overlooked something?

image host

image host

239 commented 1 year ago
FTVEP-flac Ex Falso foobar2000 loudgain metaflac r128gain rsgain
AG -5.71 dB -8.19 dB -8.19 dB -5.71 dB -8.20 dB -8.19 dB
AP 0.9923 0.992279 1.133981 0.99227905 1.00000000 0.992279
TG1 -4.67 dB -7.08 dB -7.08 dB -4.68 dB -7.10 dB -7.08 dB
TP1 0.9877 0.987732 0.989932 0.98773193 0.98922700 0.987732
TG2 -6.61 dB -9.29 dB -9.29 dB -6.61 dB -9.30 dB -9.29 dB
TP2 0.9883 0.988342 1.075565 0.98834229 1.00000000 0.988342
TG3 -5.46 dB -7.55 dB -7.55 dB -5.46 dB -7.50 dB -7.55 dB
TP3 0.9923 0.992279 1.133981 0.99227905 1.00000000 0.992279
TG4 -2.57 dB -8.82 dB -8.82 dB -2.57 dB -8.80 dB -8.82 dB
TP4 0.9844 0.984375 1.056995 0.98437500 1.00000000 0.984375
239 commented 1 year ago
FTVEP-opus Ex Falso foobar2000 loudgain opusenc r128gain rsgain
AG -5.62 dB -3375 -3375   -3379 -3375
TG1 -4.62 dB -3091 -3090 264 -3098 -3090
TG2 -6.48 dB -3658 -3658 -230 -3661 -3658
TG3 -5.39 dB -3212 -3212 64 -3200 -3212
TG4 -2.51 dB -3536 -3535 804 -3533 -3535
desbma commented 1 year ago

Yes this is expected.

r128gain has a bug because it systematically resamples audio to 48 KHz before analysis, which leads to small offset from the correct value, see also #44.

Ex falso and metaflac probably use the Replay Gain original algorithm which has a different weighting curve, that leads to the ~4 dB difference.

I don't have much time to fix and interest to maintain r128gain nowadays, when I first wrote it there was no alternative, now, as your comparison confirms, I can only recommend rsgain. loudgain's behavior to use true peak instead of sample peak is wrong in my opinion, because it breaks compatibility with previous Replay Gain implementations, and can lead to very important loudness difference if the playback software is set to avoid clipping.