[flac-dev] Support 56kHz to 19.2kHz gain analysis (Patch v3)

Earl Chew earl_chew at yahoo.com
Sun Jan 8 16:00:57 PST 2012


The extended gain analysis tables in Foobar2000 (and the derivatives that copied it) are wrong.

Here is how to show that it's wrong. Use <http://www.daniweb.com/software-development/python/code/263775> to create
a 1 kHz signal using a 48 kSamples/sec rate (48.wav) and and a 192 kSamples/sec rate (192.wav). I modified the script to generate 2s of samples.

Because the underlying signal is the same (1kHz with a fixed amplitude) the perceived loudness should be identical,
independent of the sampling rate. However, using the Foobar2000 tables, the computed values for the 48 kSamples/sec case is:


REPLAYGAIN_REFERENCE_LOUDNESS=89.0 dB
REPLAYGAIN_TRACK_GAIN=+4.11 dB
REPLAYGAIN_TRACK_PEAK=0.12207031
REPLAYGAIN_ALBUM_GAIN=+4.11 dB
REPLAYGAIN_ALBUM_PEAK=0.12207031


while the values for the 192 kSamples/sec case is:

REPLAYGAIN_REFERENCE_LOUDNESS=89.0 dB
REPLAYGAIN_TRACK_GAIN=+1.40 dB
REPLAYGAIN_TRACK_PEAK=0.12207031
REPLAYGAIN_ALBUM_GAIN=+1.40 dB
REPLAYGAIN_ALBUM_PEAK=0.12207031


The difference between the +4.11dB and +1.40dB gains is surprising for essentially the same underlying signal.


The problem is that the number of taps in the filters is insufficient at the higher sampling rates (192 kSamples/sec) to produce
a good result for the comparatively low frequencies at which the filter operates.

Rather than generating a more complex filter with more taps, use the fact that most of the higher sampling
rates are either multiples of 2 or multiples of 4 of the sampling rates already determined:

192000 = 4 x 48000
176400 = 4 x 44100
144000 = 4 x 36000
128000 = 4 x 32000
96000 = 2 x 48000
88200 = 2 x 44100
64000 = 2 x 32000

This is likely to be perfectly acceptable since the ReplayGain adjustment is purely an estimate of loudness.


The only values in the Foobar2000 table that are not accounted for are:


112000 = 4 x 28000
56000 = 2 x 28000


To accommodate this, a 28 kSamples/sec entry is required in the base table.  I'll save this for a
separate patch.



________________________________
 From: Earl Chew <earl_chew at yahoo.com>
To: "Flac-dev at xiph.org" <Flac-dev at xiph.org> 
Sent: Saturday, January 7, 2012 9:23:35 PM
Subject: [Flac-dev] Support 56kHz to 19.2kHz gain analysis (Patch v2)
 

Revise patch to correctly allocate enough buffer for gain analysis.



________________________________
 From: Earl Chew <earl_chew at yahoo.com>
To: "Flac-dev at xiph.org" <Flac-dev at xiph.org> 
Sent: Saturday, January 7, 2012 11:12:17 AM
Subject: [Flac-dev] Support 56kHz to 19.2kHz gain analysis
 

Copy additional filter values from Foobar2000 as found in

<http://code.google.com/p/sirens2/source/browse/trunk/libwavpack-4.32.psp/wvgain.c?r=32>

to allow metaflac to perform gain analysis on high sample rate audio.

_______________________________________________
Flac-dev mailing list
Flac-dev at xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev



_______________________________________________
Flac-dev mailing list
Flac-dev at xiph.org
http://lists.xiph.org/mailman/listinfo/flac-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/flac-dev/attachments/20120108/88504f97/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: flac.diff
Type: application/octet-stream
Size: 26635 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/flac-dev/attachments/20120108/88504f97/attachment-0001.obj 


More information about the flac-dev mailing list