Mercurial > hg > silvet
comparison testdata/evaluation/run.sh @ 194:72a9696f7caa
Fixes to script
author | Chris Cannam |
---|---|
date | Wed, 04 Jun 2014 11:07:34 +0100 |
parents | 1b7b31aab82a |
children | 4259005def86 |
comparison
equal
deleted
inserted
replaced
193:1b7b31aab82a | 194:72a9696f7caa |
---|---|
15 if ! sonic-annotator -v ; then | 15 if ! sonic-annotator -v ; then |
16 echo "Failed to run sonic-annotator (not in PATH?), giving up" | 16 echo "Failed to run sonic-annotator (not in PATH?), giving up" |
17 exit 1 | 17 exit 1 |
18 fi | 18 fi |
19 | 19 |
20 rdffile="../silvet.n3" | 20 rdffile="../../silvet.n3" |
21 if [ ! -f "$rdffile" ] ; then | 21 if [ ! -f "$rdffile" ] ; then |
22 | 22 echo "Failed to find plugin RDF file at $rdffile, giving up" |
23 exit 1 | |
24 fi | |
23 | 25 |
24 case "$trios_path" in | 26 case "$trios_path" in |
25 *\ *) echo "TRIOS dataset path $trios_path has a space in it, this script won't handle that!"; exit 1;; | 27 *\ *) echo "TRIOS dataset path $trios_path has a space in it, this script won't handle that"; exit 1;; |
26 esac | 28 esac |
27 | 29 |
28 VAMP_PATH=../.. | 30 VAMP_PATH=../.. |
29 export VAMP_PATH | 31 export VAMP_PATH |
30 | 32 |
41 infiles=`find "$trios_path" -name \*.wav -print | egrep '(mozart|lussier|take_five)' | grep -v _syn` | 43 infiles=`find "$trios_path" -name \*.wav -print | egrep '(mozart|lussier|take_five)' | grep -v _syn` |
42 | 44 |
43 grep Piano "$rdffile" | sed 's/^.*( *//' | sed 's/ *).*$//' | sed 's/ "/\n/g' | sed 's/"//g' | tr '[A-Z]' '[a-z]' | tail -n +2 | cat -n > "$instfile" | 45 grep Piano "$rdffile" | sed 's/^.*( *//' | sed 's/ *).*$//' | sed 's/ "/\n/g' | sed 's/"//g' | tr '[A-Z]' '[a-z]' | tail -n +2 | cat -n > "$instfile" |
44 | 46 |
45 instrument_for() { | 47 instrument_for() { |
46 filename="$0" | 48 filename="$1" |
47 base=`basename "$filename" .wav` | 49 base=`basename "$filename" .wav` |
48 instrument_no=`grep "$base" "$instfile" | awk '{ print $1; }'` | 50 instrument_no=`grep "$base" "$instfile" | awk '{ print $1; }'` |
49 if [ -z "$instrument_no" ]; | 51 if [ -z "$instrument_no" ] || [ -z "$base" ]; |
50 then echo 0 | 52 then echo 0 |
51 else echo "$instrument_no" | 53 else echo "$instrument_no" |
52 fi | 54 fi |
53 } | 55 } |
56 | |
57 echo | |
58 echo "Input files are:" | |
59 echo $infiles | fmt -1 | |
54 | 60 |
55 for infile in $infiles; do | 61 for infile in $infiles; do |
56 | 62 |
57 echo | 63 echo |
58 echo "Evaluating for file $infile..." | 64 echo "Evaluating for file $infile..." |
60 instrument=`instrument_for "$infile"` | 66 instrument=`instrument_for "$infile"` |
61 case "$instrument" in | 67 case "$instrument" in |
62 [0-9]*) ;; | 68 [0-9]*) ;; |
63 *) echo "Instrument extraction failed for infile $infile -- not even default multi-instrument setting returned?"; exit 1;; | 69 *) echo "Instrument extraction failed for infile $infile -- not even default multi-instrument setting returned?"; exit 1;; |
64 esac | 70 esac |
71 | |
72 piece=`basename \`dirname "$infile" \`` | |
73 arrangement=`basename "$infile" .wav` | |
65 | 74 |
66 echo | 75 echo |
67 echo "For file $infile, using instrument setting $instrument..." | 76 echo "For piece $piece, arrangement $arrangement, using instrument $instrument..." |
68 | 77 |
69 sox "$infile" "$tmpwav" gain -n -6.020599913279624 | 78 sox "$infile" "$tmpwav" gain -n -6.020599913279624 |
70 | 79 |
71 ##!!! todo: actually apply the instrument setting! | 80 ##!!! todo: actually apply the instrument setting! |
72 | 81 |
73 time sonic-annotator \ | 82 sonic-annotator \ |
74 --writer csv \ | 83 --writer csv \ |
75 --csv-one-file "$outfile" \ | 84 --csv-one-file "$outfile" \ |
76 --csv-force \ | 85 --csv-force \ |
77 --default vamp:silvet:silvet:notes \ | 86 --default vamp:silvet:silvet:notes \ |
78 "$tmpwav" | 87 "$tmpwav" |
81 sed 's/^[^,]*,//' | \ | 90 sed 's/^[^,]*,//' | \ |
82 while IFS=, read start duration frequency level label; do | 91 while IFS=, read start duration frequency level label; do |
83 end=`echo "$start $duration + p" | dc` | 92 end=`echo "$start $duration + p" | dc` |
84 echo -e "$start\t$end\t$frequency" | 93 echo -e "$start\t$end\t$frequency" |
85 done > "$outfile.lab" | 94 done > "$outfile.lab" |
86 | |
87 piece=`basename \`dirname "$infile" \`` | |
88 arrangement=`basename "$infile" .wav` | |
89 | 95 |
90 for ms in 50 100; do | 96 for ms in 50 100; do |
91 echo | 97 echo |
92 echo "Validating against ground truth at $ms ms:" | 98 echo "Validating against ground truth at $ms ms:" |
93 "$yc" ./evaluate_lab.yeti "$ms" "../TRIOS-groundtruth/$piece/$arrangement.lab" "$outfile.lab" | 99 "$yc" ./evaluate_lab.yeti "$ms" "../TRIOS-groundtruth/$piece/$arrangement.lab" "$outfile.lab" |