comparison tests/test-jams-destinations/test-jams-destinations.sh @ 200:f35bbb3e4d41 sonic-annotator-1.2

Change of tack: rename the JSON writer to JAMS. It's simpler than having a JSON writer with a mandatory flag to tell it what sort of JSON to write.
author Chris Cannam
date Tue, 01 Sep 2015 17:51:03 +0100
parents tests/test-json-destinations/test-json-destinations.sh@3b7ec45abd1c
children
comparison
equal deleted inserted replaced
199:c8b934ed4ddd 200:f35bbb3e4d41
1 #!/bin/bash
2
3 . ../include.sh
4
5 infile1=$audiopath/3clicks8.wav
6 infile2=$audiopath/6clicks8.wav
7
8 infile1dot=$audiopath/3.clicks.8.wav
9
10 outfile1=3clicks8.json
11 outfile2=6clicks8.json
12
13 outfile3=3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.json
14 outfile4=3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.json
15 outfile5=6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.json
16 outfile6=6clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.json
17
18 outfile1dot=3.clicks.8.json
19
20 tmpjson=$mypath/tmp_1_$$.json
21
22 trap "rm -f $tmpjson $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6 $infile1dot $outfile1dot $audiopath/$outfile1 $audiopath/$outfile2 $audiopath/$outfile3 $audiopath/$outfile4 $audiopath/$outfile5 $audiopath/$outfile6 $audiopath/$outfile1dot" 0
23
24 transformdir=$mypath/transforms
25
26 mandatory="-w jams"
27
28
29 ctx="onsets transform, one audio file, default JAMS writer destination"
30
31 rm -f $audiopath/$outfile1
32
33 $r -t $transformdir/onsets.n3 $mandatory $infile1 2>/dev/null || \
34 fail "Fails to run with $ctx"
35
36 check_json $audiopath/$outfile1 "$ctx"
37
38
39 ctx="onsets transform, one audio file with dots in filename, default JAMS writer destination"
40
41 rm -f $audiopath/$outfile1
42
43 cp $infile1 $infile1dot
44
45 $r -t $transformdir/onsets.n3 $mandatory $infile1dot 2>/dev/null || \
46 fail "Fails to run with $ctx"
47
48 check_json $audiopath/$outfile1dot "$ctx"
49
50 rm -f $infile1dot $audiopath/$outfile1dot
51
52
53 ctx="onsets and df transforms, one audio file, default JAMS writer destination"
54
55 rm -f $audiopath/$outfile1
56
57 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 $mandatory $infile1 2>/dev/null || \
58 fail "Fails to run with $ctx"
59
60 check_json $audiopath/$outfile1 "$ctx"
61
62
63 ctx="onsets transform, two audio files, default JAMS writer destination"
64
65 rm -f $audiopath/$outfile1
66 rm -f $audiopath/$outfile2
67
68 $r -t $transformdir/onsets.n3 $mandatory $infile1 $infile2 2>/dev/null || \
69 fail "Fails to run with $ctx"
70
71 check_json $audiopath/$outfile1 "$ctx"
72 check_json $audiopath/$outfile2 "$ctx"
73
74
75 ctx="onsets transform, two audio files, one-file JAMS writer"
76
77 $r -t $transformdir/onsets.n3 $mandatory --jams-one-file $tmpjson $infile1 $infile2 2>/dev/null || \
78 fail "Fails to run with $ctx"
79
80 check_json $tmpjson "$ctx"
81
82
83 ctx="onsets transform, two audio files, stdout JAMS writer"
84
85 $r -t $transformdir/onsets.n3 $mandatory --jams-stdout $infile1 $infile2 2>/dev/null >$tmpjson || \
86 fail "Fails to run with $ctx"
87
88 check_json $tmpjson "$ctx"
89
90
91 ctx="onsets transform, one audio file, many-files JAMS writer"
92
93 rm -f $audiopath/$outfile3
94
95 $r -t $transformdir/onsets.n3 $mandatory --jams-many-files $infile1 2>/dev/null || \
96 fail "Fails to run with $ctx"
97
98 check_json $audiopath/$outfile3 "$ctx"
99
100
101 ctx="onsets transform, two audio files, many-files JAMS writer"
102
103 rm -f $audiopath/$outfile3
104 rm -f $audiopath/$outfile5
105
106 $r -t $transformdir/onsets.n3 $mandatory --jams-many-files $infile1 $infile2 2>/dev/null || \
107 fail "Fails to run with $ctx"
108
109 check_json $audiopath/$outfile3 "$ctx"
110 check_json $audiopath/$outfile5 "$ctx"
111
112
113 ctx="onsets and df transforms, two audio files, many-files JAMS writer"
114
115 rm -f $audiopath/$outfile3
116 rm -f $audiopath/$outfile4
117 rm -f $audiopath/$outfile5
118 rm -f $audiopath/$outfile6
119
120 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 $mandatory --jams-many-files $infile1 $infile2 2>/dev/null || \
121 fail "Fails to run with $ctx"
122
123 check_json $audiopath/$outfile3 "$ctx"
124 check_json $audiopath/$outfile4 "$ctx"
125 check_json $audiopath/$outfile5 "$ctx"
126 check_json $audiopath/$outfile6 "$ctx"
127
128
129 ctx="output base directory"
130
131 rm -f ./$outfile1
132
133 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 $mandatory --jams-basedir . $infile1 2>/dev/null || \
134 fail "Fails to run with $ctx"
135
136 check_json ./$outfile1 "$ctx"
137
138
139 ctx="output base directory and many-files"
140
141 rm -f ./$outfile3
142 rm -f ./$outfile5
143
144 $r -t $transformdir/onsets.n3 $mandatory --jams-basedir . --jams-many-files $infile1 $infile2 2>/dev/null || \
145 fail "Fails to run with $ctx"
146
147 check_json ./$outfile3 "$ctx"
148 check_json ./$outfile5 "$ctx"
149
150
151 ctx="nonexistent output base directory"
152
153 $r -t $transformdir/onsets.n3 $mandatory --jams-basedir ./DOES_NOT_EXIST $infile1 2>/dev/null && \
154 fail "Fails with $ctx by completing successfully (should refuse and bail out)"
155
156
157 ctx="existing output file and no --jams-force"
158
159 touch $audiopath/$outfile1
160
161 $r -t $transformdir/onsets.n3 $mandatory $infile1 2>/dev/null && \
162 fail "Fails by completing successfully when output file already exists (should refuse and bail out)"
163
164
165 ctx="existing output file and --jams-force"
166
167 touch $audiopath/$outfile1
168
169 $r -t $transformdir/onsets.n3 $mandatory --jams-force $infile1 2>/dev/null || \
170 fail "Fails to run with $ctx"
171
172 check_json $audiopath/$outfile1 "$ctx"
173
174
175 exit 0