annotate tests/test-audioformat.sh @ 32:7dbf20549eea

* Remove audioio from externals
author Chris Cannam
date Tue, 16 Mar 2010 13:05:18 +0000
parents 102bb1729184
children 94d988cef54e
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@0 3 mypath=`dirname $0`
Chris@3 4 r=$mypath/../runner/sonic-annotator
Chris@0 5
Chris@0 6 inbase=$mypath/audio/3clicks
Chris@0 7 testplug=vamp:vamp-example-plugins:percussiononsets
Chris@0 8 tmpfile1=$mypath/tmp_1_$$
Chris@0 9 tmpfile2=$mypath/tmp_2_$$
Chris@0 10
Chris@0 11 trap "rm -f $tmpfile1 $tmpfile2" 0
Chris@0 12
Chris@28 13 . test-include.sh
Chris@0 14
Chris@0 15 for extension in wav ogg mp3 ; do
Chris@0 16
Chris@0 17 transform=$mypath/transforms/transforms-audioformat-percussiononsets.n3
Chris@0 18 expected=$mypath/expected/transforms-audioformat-percussiononsets-$extension.csv
Chris@0 19
Chris@0 20 test -f $transform || \
Chris@0 21 fail "Internal error: no transforms file for suffix $suffix"
Chris@0 22
Chris@0 23 test -f $expected || \
Chris@0 24 fail "Internal error: no expected output file for suffix $suffix"
Chris@0 25
Chris@0 26 infile=$inbase.$extension
Chris@0 27 if [ "$extension" = "wav" ]; then infile=${inbase}8.$extension; fi
Chris@0 28
Chris@0 29 test -f $infile || \
Chris@0 30 fail "Internal error: no input audio file for extension $extension"
Chris@0 31
Chris@0 32 $r -t $transform -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
Chris@0 33 fail "Fails to run transform $transform against audio file $infile"
Chris@0 34
Chris@0 35 if [ "$extension" = "wav" ]; then
Chris@28 36 csvcompare $tmpfile2 $expected || \
Chris@0 37 fail "Output mismatch for transform $transform with audio file $infile"
Chris@0 38 else
Chris@28 39 csvcompare $tmpfile2 $expected || \
Chris@0 40 ( echo "NOTE: Output mismatch for transform $transform with audio file $infile" ; \
Chris@0 41 echo "This may be the result of differences in the audio file decoder, so I am not" ; \
Chris@0 42 echo "failing the test, but I recommend that you check the results." )
Chris@0 43 fi
Chris@0 44 done
Chris@0 45
Chris@0 46 exit 0