view test/test-inverse.sh @ 142:b043b6cee17a

Start kernel test file, add inverse test script
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 20 May 2014 11:30:55 +0100
parents
children c66f0f78b315
line wrap: on
line source
#!/bin/bash
mydir=`dirname "$0"`
process="$mydir/processfile"
if [ ! -x "$process" ]; then
    echo "ERROR: $mydir/processfile not found or not executable"
    exit 1
fi
infile="$mydir/data/filtered-whitenoise-480-14600.wav"
if [ ! -f "$infile" ]; then
    echo "ERROR: Test file $infile not found"
    exit 1
fi
outfile="/tmp/$$.out.wav"
difffile="/tmp/$$.diff.wav"
logfile="/tmp/$$.log.txt"
trap "rm -f ${outfile} ${difffile} ${logfile}" 0
"$process" -x 14700 -n 465 -b 36 "$infile" "$outfile" "$difffile" 2>&1 | tee "$logfile" || exit 1
int_db=`grep 'max diff' "$logfile" | sed 's/^[^(]*(//' | sed 's/[^0-9-].*//'`
good=`expr "$int_db" "<" "-20"`
if [ "$good" == "1" ]; then
    echo "Forward-inverse process is satisfactory"
    exit 0
else
    echo "Forward-inverse not OK: Rounded dB value $int_db is too high -- should be < -20"
    exit 1
fi