annotate 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
rev   line source
c@142 1 #!/bin/bash
c@142 2 mydir=`dirname "$0"`
c@142 3 process="$mydir/processfile"
c@142 4 if [ ! -x "$process" ]; then
c@142 5 echo "ERROR: $mydir/processfile not found or not executable"
c@142 6 exit 1
c@142 7 fi
c@142 8 infile="$mydir/data/filtered-whitenoise-480-14600.wav"
c@142 9 if [ ! -f "$infile" ]; then
c@142 10 echo "ERROR: Test file $infile not found"
c@142 11 exit 1
c@142 12 fi
c@142 13 outfile="/tmp/$$.out.wav"
c@142 14 difffile="/tmp/$$.diff.wav"
c@142 15 logfile="/tmp/$$.log.txt"
c@142 16 trap "rm -f ${outfile} ${difffile} ${logfile}" 0
c@142 17 "$process" -x 14700 -n 465 -b 36 "$infile" "$outfile" "$difffile" 2>&1 | tee "$logfile" || exit 1
c@142 18 int_db=`grep 'max diff' "$logfile" | sed 's/^[^(]*(//' | sed 's/[^0-9-].*//'`
c@142 19 good=`expr "$int_db" "<" "-20"`
c@142 20 if [ "$good" == "1" ]; then
c@142 21 echo "Forward-inverse process is satisfactory"
c@142 22 exit 0
c@142 23 else
c@142 24 echo "Forward-inverse not OK: Rounded dB value $int_db is too high -- should be < -20"
c@142 25 exit 1
c@142 26 fi
c@142 27