Revision 6:1e4233d4b3bb

View differences:

doChordID-osx.sh
1 1
#!/bin/bash
2 2

  
3
if [ $# -lt 2 ] ; then
4
echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR"
5
exit 1
3
listfile="$1"
4
if [ $# -gt 2 ]; then
5
	outputdir="$3"
6
else
7
	outputdir="$2"
6 8
fi
7 9

  
8
retainstructure=0
9

  
10
while [ $# -gt 2 ] ; do
11
case $1 in
12
-d) retainstructure=1 ; shift 1 ; echo here;;
13
*) shift 1 ;;
14
esac
15
done
16

  
17
listfile="$1"
18
echo listfile "$listfile"
19
outputdir="$2"
20

  
21

  
22 10
while read infile; do
23 11
	if [ "$infile" -a -f "$infile" ]; then
24 12
		before="$(date +%s)"
......
26 14
		echo " "
27 15
		echo Processing file "$infile"
28 16
		echo " "
29
		if [ $retainstructure -eq 0 ]; then
30
			pathandfile=`basename "$infile"`
31
		else
32
			pathandfile="`echo "$infile" | egrep -o '[^/]*/[^/]*/[^/]*$'`"
33
			echo pathandfile "$pathandfile"
34
		fi
35
		outfile="$outputdir"/"$pathandfile".txt
36
		
37
		logfile=_logfiles/"$pathandfile".log
38
		chromafile=_chromadata/"$pathandfile".csv
39
		
40
		mkdir -p "`dirname "$outfile"`"
41
		
17
		outfile="$outputdir"/"`basename "$infile"`".txt
18
		logfile=_logfiles/"`basename "$infile"`".log
19
		chromafile=_chromadata/"`basename "$infile"`".csv
42 20
		echo "[sonic annotator] ..."
43 21
		VAMP_PATH=. ./sonic-annotator -d vamp:matthiasm:nnls_chroma:bothchroma -w csv --csv-stdout "$infile" 2> "$logfile" | cut -d ',' -f 2-  > "$chromafile" 
44 22
		matlab -nodisplay -nojvm -r run_mirex\(\'"$infile"\',\'"$outfile"\'\,\'"$chromafile"\'\) >> $logfile
doChordID-simple-osx.sh
41 41
		
42 42
		echo "[sonic annotator] ..."
43 43
		helper=n		
44
		echo VAMP_PATH=. ./sonic-annotator -d vamp:matthiasm:nnls_chroma:simplechord -w csv --csv-stdout "$infile" 
44 45
		VAMP_PATH=. ./sonic-annotator -d vamp:matthiasm:nnls_chroma:simplechord -w csv --csv-stdout "$infile" | cut -d ',' -f 2- |
45 46
		while read line; do			
46 47
			# echo "$line"
doChordID.sh
1 1
#!/bin/bash
2 2

  
3
if [ $# -lt 2 ] ; then
4
echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR"
5
exit 1
3
listfile="$1"
4
if [ $# -gt 2 ]; then
5
	outputdir="$3"
6
else
7
	outputdir="$2"
6 8
fi
7 9

  
8
retainstructure=0
9

  
10
while [ $# -gt 2 ] ; do
11
case $1 in
12
-d) retainstructure=1 ; shift 1 ; echo here;;
13
*) shift 1 ;;
14
esac
15
done
16

  
17
listfile="$1"
18
echo listfile "$listfile"
19
outputdir="$2"
20

  
21

  
22 10
while read infile; do
23 11
	if [ "$infile" -a -f "$infile" ]; then
24 12
		before="$(date +%s)"
......
26 14
		echo " "
27 15
		echo Processing file "$infile"
28 16
		echo " "
29
		if [ $retainstructure -eq 0 ]; then
30
			pathandfile=`basename "$infile"`
31
		else
32
			pathandfile="`echo "$infile" | egrep -o '[^/]*/[^/]*/[^/]*$'`"
33
			echo pathandfile "$pathandfile"
34
		fi
35
		outfile="$outputdir"/"$pathandfile".txt
36
		
37
		logfile=_logfiles/"$pathandfile".log
38
		chromafile=_chromadata/"$pathandfile".csv
39
		
40
		mkdir -p "`dirname "$outfile"`"
41
		
17
		outfile="$outputdir"/`basename "$infile"`.txt
18
		logfile=_logfiles/`basename "$infile"`.log
19
		chromafile=_chromadata/`basename "$infile"`.csv
42 20
		echo "[sonic annotator] ..."
43 21
		VAMP_PATH=. ./sonic-annotator-unix -d vamp:matthiasm:nnls_chroma:bothchroma -w csv --csv-stdout "$infile" 2> "$logfile" | cut -d ',' -f 2-  > "$chromafile" 
44
		infile="`echo "$infile" | sed "s/'/''/g"`"
45
		outfile="`echo "$outfile" | sed "s/'/''/g"`"
46
		chromafile="`echo "$chromafile" | sed "s/'/''/g"`"		
47
		matlab -nodisplay -nojvm -r run_mirex\(\'"$infile"\',\'"$outfile"\'\,\'"$chromafile"\'\) >> "$logfile"
22
		matlab -nodisplay -nojvm -r run_mirex\(\'"$infile"\',\'"$outfile"\'\,\'"$chromafile"\'\) >> $logfile
48 23
		after="$(date +%s)"
49 24
		elapsed_seconds="$(expr $after - $before)"
50 25
		echo "  -->" time elapsed: $elapsed_seconds seconds
mauch-MIREX-chord.tmproj
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
<plist version="1.0">
4
<dict>
5
	<key>currentDocument</key>
6
	<string>doChordID.sh</string>
7
	<key>documents</key>
8
	<array>
9
		<dict>
10
			<key>filename</key>
11
			<string>testFileList.txt</string>
12
			<key>lastUsed</key>
13
			<date>2010-06-16T11:52:32Z</date>
14
		</dict>
15
		<dict>
16
			<key>filename</key>
17
			<string>run_extraction.m</string>
18
			<key>lastUsed</key>
19
			<date>2010-06-16T07:27:21Z</date>
20
		</dict>
21
		<dict>
22
			<key>filename</key>
23
			<string>bothchroma.n3</string>
24
			<key>lastUsed</key>
25
			<date>2010-06-27T09:21:06Z</date>
26
		</dict>
27
		<dict>
28
			<key>filename</key>
29
			<string>doChordID.sh</string>
30
			<key>lastUsed</key>
31
			<date>2010-06-28T00:51:27Z</date>
32
			<key>selected</key>
33
			<true/>
34
		</dict>
35
		<dict>
36
			<key>filename</key>
37
			<string>run_extraction_seg.m</string>
38
			<key>lastUsed</key>
39
			<date>2010-06-16T06:36:47Z</date>
40
		</dict>
41
		<dict>
42
			<key>filename</key>
43
			<string>run_extraction.sh</string>
44
			<key>lastUsed</key>
45
			<date>2010-06-16T06:21:39Z</date>
46
		</dict>
47
		<dict>
48
			<key>filename</key>
49
			<string>parameters/param_mirex.m</string>
50
			<key>lastUsed</key>
51
			<date>2010-06-16T08:49:23Z</date>
52
		</dict>
53
		<dict>
54
			<key>filename</key>
55
			<string>parameters/param_thesis_mbk24bx.m</string>
56
			<key>lastUsed</key>
57
			<date>2010-06-16T06:26:10Z</date>
58
		</dict>
59
		<dict>
60
			<key>filename</key>
61
			<string>parameters/param_ismir10_std06.m</string>
62
			<key>lastUsed</key>
63
			<date>2010-06-16T06:27:31Z</date>
64
		</dict>
65
		<dict>
66
			<key>filename</key>
67
			<string>run/run_ismir10_std06.m</string>
68
			<key>lastUsed</key>
69
			<date>2010-06-16T07:44:58Z</date>
70
		</dict>
71
		<dict>
72
			<key>filename</key>
73
			<string>dbn/inference.m</string>
74
			<key>lastUsed</key>
75
			<date>2010-06-16T08:46:05Z</date>
76
		</dict>
77
		<dict>
78
			<key>filename</key>
79
			<string>run_mirex.m</string>
80
			<key>lastUsed</key>
81
			<date>2010-06-16T08:44:54Z</date>
82
		</dict>
83
		<dict>
84
			<key>filename</key>
85
			<string>song/song_segment.m</string>
86
			<key>lastUsed</key>
87
			<date>2010-06-27T09:21:00Z</date>
88
		</dict>
89
		<dict>
90
			<key>filename</key>
91
			<string>song/song_syncchroma.m</string>
92
			<key>lastUsed</key>
93
			<date>2010-06-16T08:40:14Z</date>
94
		</dict>
95
		<dict>
96
			<key>filename</key>
97
			<string>song/song_segchroma.m</string>
98
			<key>lastUsed</key>
99
			<date>2010-06-16T08:51:07Z</date>
100
		</dict>
101
		<dict>
102
			<key>filename</key>
103
			<string>segmentation/segmentation_auto.m</string>
104
			<key>lastUsed</key>
105
			<date>2010-06-16T08:52:31Z</date>
106
		</dict>
107
	</array>
108
	<key>fileHierarchyDrawerWidth</key>
109
	<integer>200</integer>
110
	<key>metaData</key>
111
	<dict>
112
		<key>bothchroma.n3</key>
113
		<dict>
114
			<key>caret</key>
115
			<dict>
116
				<key>column</key>
117
				<integer>26</integer>
118
				<key>line</key>
119
				<integer>11</integer>
120
			</dict>
121
			<key>firstVisibleColumn</key>
122
			<integer>0</integer>
123
			<key>firstVisibleLine</key>
124
			<integer>0</integer>
125
		</dict>
126
		<key>dbn/inference.m</key>
127
		<dict>
128
			<key>caret</key>
129
			<dict>
130
				<key>column</key>
131
				<integer>0</integer>
132
				<key>line</key>
133
				<integer>0</integer>
134
			</dict>
135
			<key>firstVisibleColumn</key>
136
			<integer>0</integer>
137
			<key>firstVisibleLine</key>
138
			<integer>0</integer>
139
		</dict>
140
		<key>doChordID.sh</key>
141
		<dict>
142
			<key>caret</key>
143
			<dict>
144
				<key>column</key>
145
				<integer>0</integer>
146
				<key>line</key>
147
				<integer>21</integer>
148
			</dict>
149
			<key>firstVisibleColumn</key>
150
			<integer>0</integer>
151
			<key>firstVisibleLine</key>
152
			<integer>0</integer>
153
		</dict>
154
		<key>parameters/param_ismir10_std06.m</key>
155
		<dict>
156
			<key>caret</key>
157
			<dict>
158
				<key>column</key>
159
				<integer>0</integer>
160
				<key>line</key>
161
				<integer>3</integer>
162
			</dict>
163
			<key>columnSelection</key>
164
			<false/>
165
			<key>firstVisibleColumn</key>
166
			<integer>0</integer>
167
			<key>firstVisibleLine</key>
168
			<integer>0</integer>
169
			<key>selectFrom</key>
170
			<dict>
171
				<key>column</key>
172
				<integer>94</integer>
173
				<key>line</key>
174
				<integer>42</integer>
175
			</dict>
176
			<key>selectTo</key>
177
			<dict>
178
				<key>column</key>
179
				<integer>0</integer>
180
				<key>line</key>
181
				<integer>3</integer>
182
			</dict>
183
		</dict>
184
		<key>parameters/param_mirex.m</key>
185
		<dict>
186
			<key>caret</key>
187
			<dict>
188
				<key>column</key>
189
				<integer>13</integer>
190
				<key>line</key>
191
				<integer>36</integer>
192
			</dict>
193
			<key>firstVisibleColumn</key>
194
			<integer>0</integer>
195
			<key>firstVisibleLine</key>
196
			<integer>0</integer>
197
		</dict>
198
		<key>parameters/param_thesis_mbk24bx.m</key>
199
		<dict>
200
			<key>caret</key>
201
			<dict>
202
				<key>column</key>
203
				<integer>7</integer>
204
				<key>line</key>
205
				<integer>22</integer>
206
			</dict>
207
			<key>firstVisibleColumn</key>
208
			<integer>0</integer>
209
			<key>firstVisibleLine</key>
210
			<integer>0</integer>
211
		</dict>
212
		<key>run_extraction.sh</key>
213
		<dict>
214
			<key>caret</key>
215
			<dict>
216
				<key>column</key>
217
				<integer>0</integer>
218
				<key>line</key>
219
				<integer>0</integer>
220
			</dict>
221
			<key>firstVisibleColumn</key>
222
			<integer>0</integer>
223
			<key>firstVisibleLine</key>
224
			<integer>0</integer>
225
		</dict>
226
		<key>run_mirex.m</key>
227
		<dict>
228
			<key>caret</key>
229
			<dict>
230
				<key>column</key>
231
				<integer>0</integer>
232
				<key>line</key>
233
				<integer>0</integer>
234
			</dict>
235
			<key>firstVisibleColumn</key>
236
			<integer>0</integer>
237
			<key>firstVisibleLine</key>
238
			<integer>0</integer>
239
		</dict>
240
		<key>segmentation/segmentation_auto.m</key>
241
		<dict>
242
			<key>caret</key>
243
			<dict>
244
				<key>column</key>
245
				<integer>53</integer>
246
				<key>line</key>
247
				<integer>38</integer>
248
			</dict>
249
			<key>columnSelection</key>
250
			<false/>
251
			<key>firstVisibleColumn</key>
252
			<integer>0</integer>
253
			<key>firstVisibleLine</key>
254
			<integer>0</integer>
255
			<key>selectFrom</key>
256
			<dict>
257
				<key>column</key>
258
				<integer>44</integer>
259
				<key>line</key>
260
				<integer>38</integer>
261
			</dict>
262
			<key>selectTo</key>
263
			<dict>
264
				<key>column</key>
265
				<integer>53</integer>
266
				<key>line</key>
267
				<integer>38</integer>
268
			</dict>
269
		</dict>
270
		<key>song/song_segchroma.m</key>
271
		<dict>
272
			<key>caret</key>
273
			<dict>
274
				<key>column</key>
275
				<integer>0</integer>
276
				<key>line</key>
277
				<integer>0</integer>
278
			</dict>
279
			<key>firstVisibleColumn</key>
280
			<integer>0</integer>
281
			<key>firstVisibleLine</key>
282
			<integer>0</integer>
283
		</dict>
284
		<key>testFileList.txt</key>
285
		<dict>
286
			<key>caret</key>
287
			<dict>
288
				<key>column</key>
289
				<integer>0</integer>
290
				<key>line</key>
291
				<integer>1</integer>
292
			</dict>
293
			<key>firstVisibleColumn</key>
294
			<integer>0</integer>
295
			<key>firstVisibleLine</key>
296
			<integer>0</integer>
297
		</dict>
298
	</dict>
299
	<key>openDocuments</key>
300
	<array>
301
		<string>doChordID.sh</string>
302
		<string>testFileList.txt</string>
303
	</array>
304
	<key>showFileHierarchyDrawer</key>
305
	<true/>
306
	<key>windowFrame</key>
307
	<string>{{663, 56}, {936, 1099}}</string>
308
</dict>
309
</plist>
run_mirex.m
37 37
fprintf(2,'[MATLAB] writing output files...');
38 38
% fprintf(1,'writing to %s\n', outfilename)
39 39
write_song(song, bnet, param, outfilename, 'chordlab', 1);
40
% write_song(song, bnet, param, [outfilename(1:end-3) 'keylab'], 'keylab', 1);
40
write_song(song, bnet, param, [outfilename(1:end-3) 'keylab'], 'keylab', 1);
41 41
% parts2csv(song, [outfilename(1:end-3) 'csv']);
42
% parts2csv(song, [outfilename(1:end-3) 'intcsv'],'integrated');
42
parts2csv(song, [outfilename(1:end-3) 'intcsv'],'integrated');
43 43
fprintf(2,'done.\n');
44
exit
44
exit
testdata/filelist.txt
1
testdata/show.wav
2

  

Also available in: Unified diff