<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>The extended gain analysis tables in Foobar2000 (and the derivatives that copied it) are wrong.</span></div><div><br><span></span></div><div><span>Here is how to show that it's wrong. Use &lt;http://www.daniweb.com/software-development/python/code/263775&gt; to create</span></div><div><span>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.</span></div><div><br><span></span></div><div><span>Because the underlying signal is the same (1kHz with a fixed amplitude) the perceived loudness should be identical,</span></div><div><span>independent of the sampling rate. However, using the Foobar2000 tables, the computed values for the 48 kSamples/sec case is:<br></span></div><div><span><br>REPLAYGAIN_REFERENCE_LOUDNESS=89.0
 dB<br>REPLAYGAIN_TRACK_GAIN=+4.11 dB<br>REPLAYGAIN_TRACK_PEAK=0.12207031<br>REPLAYGAIN_ALBUM_GAIN=+4.11 dB<br>REPLAYGAIN_ALBUM_PEAK=0.12207031<br></span></div><div><br><span></span></div><div><span>while the values for the 192 kSamples/sec case is:</span></div><div><span><br>REPLAYGAIN_REFERENCE_LOUDNESS=89.0 dB<br>REPLAYGAIN_TRACK_GAIN=+1.40 dB<br>REPLAYGAIN_TRACK_PEAK=0.12207031<br>REPLAYGAIN_ALBUM_GAIN=+1.40 dB<br>REPLAYGAIN_ALBUM_PEAK=0.12207031<br></span></div><div><br></div><div>The difference between the +4.11dB and +1.40dB gains is surprising for essentially the same underlying signal.<br></div><div><br><span></span></div><div><span>The problem is that the number of taps in the filters is insufficient at the higher sampling rates (192 kSamples/sec) to produce</span></div><div><span>a good result for the comparatively low frequencies at which the filter operates.</span></div><div><br><span></span></div><div><span>Rather than generating a more
 complex filter with more taps, use the fact that most of the higher sampling</span></div><div><span>rates are either multiples of 2 or multiples of 4 of the sampling rates already determined:</span></div><div><br><span></span></div><div><span>192000 = 4 x 48000<br>176400 = 4 x 44100<br>144000 = 4 x 36000<br>128000 = 4 x 32000<br>96000 = 2 x 48000<br>88200 = 2 x 44100<br>64000 = 2 x 32000</span></div><div><br></div><div>This is likely to be perfectly acceptable since the ReplayGain adjustment is purely an estimate of loudness.<br></div><div><br></div><div>The only values in the Foobar2000 table that are not accounted for are:<br></div><div><br><span></span><span></span></div><div><span>112000 = 4 x 28000<br>
</span><span>56000 = 2 x 28000<br></span></div><div><br><span></span></div><div><span>To accommodate this, a 28 kSamples/sec entry is required in the base table.&nbsp; I'll save this for a</span></div><span>separate patch.</span><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Earl Chew &lt;earl_chew@yahoo.com&gt;<br> <b><span style="font-weight: bold;">To:</span></b> "Flac-dev@xiph.org" &lt;Flac-dev@xiph.org&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Saturday, January 7, 2012 9:23:35 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [Flac-dev] Support 56kHz to 19.2kHz gain analysis (Patch v2)<br> </font> <br><div id="yiv1328771919"><div><div
 style="color:#000;background-color:#fff;font-family:times new roman, new york, times, serif;font-size:12pt;"><div><span>Revise patch to correctly allocate enough buffer for gain analysis.<br></span></div><div><br></div>  <div style="font-family:times new roman, new york, times, serif;font-size:12pt;"> <div style="font-family:times new roman, new york, times, serif;font-size:12pt;"> <font size="2" face="Arial"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> Earl Chew &lt;earl_chew@yahoo.com&gt;<br> <b><span style="font-weight:bold;">To:</span></b> "Flac-dev@xiph.org" &lt;Flac-dev@xiph.org&gt; <br> <b><span style="font-weight:bold;">Sent:</span></b> Saturday, January 7, 2012 11:12:17 AM<br> <b><span style="font-weight:bold;">Subject:</span></b> [Flac-dev] Support 56kHz to 19.2kHz gain analysis<br> </font> <br><div id="yiv1328771919"><div><div style="color:#000;background-color:#fff;font-family:times new roman, new york, times,
 serif;font-size:12pt;"><div>Copy additional filter values from Foobar2000 as found in</div><div><br></div><div>&lt;http://code.google.com/p/sirens2/source/browse/trunk/libwavpack-4.32.psp/wvgain.c?r=32&gt;</div><div><br></div><div>to allow metaflac to perform gain analysis on high sample rate audio.</div><div><br></div></div></div></div><br>_______________________________________________<br>Flac-dev mailing list<br><a rel="nofollow" ymailto="mailto:Flac-dev@xiph.org" target="_blank" href="mailto:Flac-dev@xiph.org">Flac-dev@xiph.org</a><br><a rel="nofollow" target="_blank" href="http://lists.xiph.org/mailman/listinfo/flac-dev">http://lists.xiph.org/mailman/listinfo/flac-dev</a><br><br><br> </div> </div>  </div></div></div><br>_______________________________________________<br>Flac-dev mailing list<br><a ymailto="mailto:Flac-dev@xiph.org" href="mailto:Flac-dev@xiph.org">Flac-dev@xiph.org</a><br><a href="http://lists.xiph.org/mailman/listinfo/flac-dev"
 target="_blank">http://lists.xiph.org/mailman/listinfo/flac-dev</a><br><br><br> </div> </div>  </div></body></html>