Mercurial > hg > sonic-annotator
comparison tests/test-audioformat.sh @ 0:581b1b150a4d
* copy to sonic-annotator
author | Chris Cannam |
---|---|
date | Thu, 11 Dec 2008 10:22:33 +0000 |
parents | |
children | 03a02c1f0a9f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:581b1b150a4d |
---|---|
1 #!/bin/bash | |
2 | |
3 mypath=`dirname $0` | |
4 r=$mypath/../sonic-annotator | |
5 | |
6 inbase=$mypath/audio/3clicks | |
7 testplug=vamp:vamp-example-plugins:percussiononsets | |
8 tmpfile1=$mypath/tmp_1_$$ | |
9 tmpfile2=$mypath/tmp_2_$$ | |
10 | |
11 trap "rm -f $tmpfile1 $tmpfile2" 0 | |
12 | |
13 fail() { | |
14 echo "Test failed: $1" | |
15 exit 1 | |
16 } | |
17 | |
18 for extension in wav ogg mp3 ; do | |
19 | |
20 transform=$mypath/transforms/transforms-audioformat-percussiononsets.n3 | |
21 expected=$mypath/expected/transforms-audioformat-percussiononsets-$extension.csv | |
22 | |
23 test -f $transform || \ | |
24 fail "Internal error: no transforms file for suffix $suffix" | |
25 | |
26 test -f $expected || \ | |
27 fail "Internal error: no expected output file for suffix $suffix" | |
28 | |
29 infile=$inbase.$extension | |
30 if [ "$extension" = "wav" ]; then infile=${inbase}8.$extension; fi | |
31 | |
32 test -f $infile || \ | |
33 fail "Internal error: no input audio file for extension $extension" | |
34 | |
35 $r -t $transform -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \ | |
36 fail "Fails to run transform $transform against audio file $infile" | |
37 | |
38 if [ "$extension" = "wav" ]; then | |
39 cmp -s $tmpfile2 $expected || \ | |
40 fail "Output mismatch for transform $transform with audio file $infile" | |
41 else | |
42 cmp -s $tmpfile2 $expected || \ | |
43 ( echo "NOTE: Output mismatch for transform $transform with audio file $infile" ; \ | |
44 echo "This may be the result of differences in the audio file decoder, so I am not" ; \ | |
45 echo "failing the test, but I recommend that you check the results." ) | |
46 fi | |
47 done | |
48 | |
49 exit 0 |