[flac-dev] Regain play analysis patches

Earl Chew earl_chew at yahoo.com
Fri Feb 10 11:49:30 PST 2012



Erik, Nathan,


Some background to my patch.

Please also refer to my analysis in my earlier post:

http://lists.xiph.org/pipermail/flac-dev/2012-January/003067.html

The key issue that I discovered is that simply adding new coefficients will not get the right answer because the number of taps needs to increase commensurately.

The acid test is to generate a fixed amplitude 1kHz tone (at the various sample rates) and ask metaflac to generate the gain settings. Since the amplitude is fixed, metaflac should give exactly the same answer in all cases.

When I used the Foobar2000 gain filter settings (http://tinyurl.com/7pxy92x) I found that metaflac generated different gain settings for the same amplitude input at higher sampling rates.

This is the reason I changed the approach from my original patch set from:

http://lists.xiph.org/pipermail/flac-dev/2012-January/003063.html

to the final one:

http://lists.xiph.org/pipermail/flac-dev/2012-January/003067.html



I believe the underlying issue is that the number of filter taps required for a good result tends to increase as the fractional bandwidth decreases. The case we have here is that the filter response is fixed, so as the sampling frequency increases, the filter fractional bandwidth will decrease.


To avoid doing this I used the decimation technique to effectively reduce the sampling rate to something that could be accommodated by the filters in the table. I think this is a reasonable approach because we only need an estimate of the gain, and I think this estimate is good enough.

An alternate approach would be to regenerate the filter table with many more taps. This would also have the effect of slowing down the computation of the gain estimate because the filters become much longer.



Incidentally, this patch also addresses the fact that the sampling frequencies are needlessly duplicated in:


    FLAC__bool grabbag__replaygain_is_valid_sample_frequency(unsigned sample_frequency)


Earl





________________________________
From: Erik de Castro Lopo <mle+la at mega-nerd.com>
To: flac-dev at xiph.org 
Cc: Nathan Rennie-Waldock <nathan.renniewaldock at gmail.com>; Earl Chew <earl_chew at yahoo.com> 
Sent: Friday, February 10, 2012 1:30:09 AM
Subject: Regain play analysis patches

Hi all,

In the last couple of months, there have been two proposed patches for
the regain play analysis code.

The first by Nathan Rennie-Waldock:

http://lists.xiph.org/pipermail/flac-dev/2011-December/003070.html

simply adds some more higher sample rates.

The second by Earl Chew:

http://lists.xiph.org/pipermail/flac-dev/2012-January/003067.html

is more comprehensive. Neither of the patches currently apply to 
the code that is currently in git [0], so now is probably a good time
to discuss these patches and come up with the best approach. Currently
I lean slightly toward Earl Chew's patch because it seems a little more
thought out.

Once we have decided on the best solution, I would appreciate it if
either Earl or Nathan could prepare a new patch.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/              


More information about the flac-dev mailing list