<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>The test is rather simple, and only compares the computed output values for a 1kHz signal</div><div>at the known filter table sampling frequencies with previously obained golden values.<br><br>As such, the test only verifies that the performance of the replay<br>gain analyser has not changed.<br><br>A better test would be to compare the computed value with an independently<br>obtain theorectical value. This is possible by more judicious use of<br>the loudness.sci script, combined with more modelling of filter<br>operation in scilab. Such a test would verify that the performance<br>of the replay gain analyser is actually correct.<br><br>There is only one test to verify handling of harmonics of the filter table<br>sampling frequencies.<br><br>Signed-off-by: Earl Chew
<earl_chew@yahoo.com><br>---<br> test/test_metaflac.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++++++<br> 1 files changed, 86 insertions(+), 0 deletions(-)<br><br>diff --git a/test/test_metaflac.sh b/test/test_metaflac.sh<br>index 19f5a00..5b82f11 100755<br>--- a/test/test_metaflac.sh<br>+++ b/test/test_metaflac.sh<br>@@ -392,6 +392,92 @@ run_metaflac --remove --block-type=VORBIS_COMMENT --dont-use-padding $flacfile<br> cmp $flacfile metaflac.flac.ok || die "ERROR, $flacfile and metaflac.flac.ok differ"<br> echo OK<br> <br>+# Replay gain tests - Test the rates which have specific filter table entries<br>+# and verify that harmonics can be processed correctly.<br>+<br>+tonegenerator ()<br>+{<br>+ awk -- '<br>+ BEGIN {<br>+ samplerate =
'$1';<br>+<br>+ tone = 1000;<br>+ duration = 1;<br>+ bitspersample = 24;<br>+<br>+ samplemidpoint = lshift(1, (bitspersample-1));<br>+ samplerange = samplemidpoint - 1;<br>+<br>+ pi = 4 * atan2(1,1);<br>+<br>+ for (ix = 0; ix < duration * samplerate; ++ix) {<br>+ sample = sin(2 * pi * tone * ix /
samplerate);<br>+ sample *= samplerange;<br>+ sample += samplemidpoint;<br>+ sample = int(sample);<br>+ for (bx = 0; bx < bitspersample/8; ++bx) {<br>+ byte[bx] = sample % 256;<br>+
sample /= 256;<br>+ }<br>+ while (bx--) {<br>+ printf("%c", byte[bx]);<br>+ }<br>+ }<br>+<br>+ }' /dev/null |<br>+ flac --silent \<br>+ --endian=big --channels=1 --bps=24 --sample-rate=$1 --sign=unsigned -<br>+}<br>+<br>+REPLAYGAIN_FREQ=<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ
8000/-12.73"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 11025/-12.93"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 11025/-12.93"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 12000/-12.98"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 16000/-13.27"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 18900/-13.41"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 22050/-13.77"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 24000/-13.82"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 28000/-14.06"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 32000/-14.08"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 36000/-14.12"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 37800/-14.18"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 44100/-14.17"<br>+REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 48000/-14.16:1:2:4"<br>+<br>+for ACTION in $REPLAYGAIN_FREQ ; do<br>+ if [ -n "${ACTION##*:*}" ] ; then<br>+ HARMONICS=1<br>+ else<br>+ HARMONICS="${ACTION#*:}"<br>+ fi<br>+ FREQ="${ACTION%%/*}"<br>+
GAIN="${ACTION#*/}"<br>+ GAIN="${GAIN%%:*}"<br>+ while [ -n "$HARMONICS" ] ; do<br>+ MULTIPLE="${HARMONICS%%:*}"<br>+ if [ x"$MULTIPLE" = x"$HARMONICS" ] ; then<br>+ HARMONICS=<br>+ else<br>+ HARMONICS="${HARMONICS#*:}"<br>+ fi<br>+ RATE=$(($MULTIPLE * FREQ))<br>+ [ $MULTIPLE -eq 1 -o -n "${REPLAYGAIN_FREQ##* $RATE/*}" ] || break<br>+ echo -n "Testing FLAC replaygain $RATE ($FREQ x $MULTIPLE) ... "<br>+ tonegenerator $RATE > $flacfile<br>+ run_metaflac --add-replay-gain $flacfile<br>+ run_metaflac --list $flacfile | grep REPLAYGAIN.*GAIN= |<br>+ while read -r REPLAYGAIN ; do<br>+ MEASUREDGAIN="${REPLAYGAIN##*=}"<br>+
MEASUREDGAIN="${MEASUREDGAIN%% *}"<br>+ if [ x"$MEASUREDGAIN" != x"$GAIN" ] ; then<br>+ die "ERROR, Expected $GAIN db instead of $REPLAYGAIN"<br>+ fi<br>+ done<br>+ echo OK<br>+ done<br>+done<br>+<br> rm -f $testdir/out.flac $testdir/out.meta<br> <br> exit 0<br>-- <br>1.6.5.2<br><br></div></div></body></html>