To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Revision:

root / doChordID-simple-osx.sh @ 6:1e4233d4b3bb

History | View | Annotate | Download (1.55 KB)

1
#!/bin/bash
2

    
3
if [ $# -lt 2 ] ; then
4
echo "Usage: $0 [-s] LISTFILENAME OUTPUTDIR"
5
exit 1
6
fi
7

    
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
while read infile; do
23
	if [ "$infile" -a -f "$infile" ]; then
24
		before="$(date +%s)"
25
		echo "_____________________________________________________"
26
		echo " "
27
		echo Processing file "$infile"
28
		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
		
42
		echo "[sonic annotator] ..."
43
		helper=n		
44
		echo VAMP_PATH=. ./sonic-annotator -d vamp:matthiasm:nnls_chroma:simplechord -w csv --csv-stdout "$infile" 
45
		VAMP_PATH=. ./sonic-annotator -d vamp:matthiasm:nnls_chroma:simplechord -w csv --csv-stdout "$infile" | cut -d ',' -f 2- |
46
		while read line; do			
47
			# echo "$line"
48
			if [ $helper = y ]; then
49
				echo "$oldstart" `echo "$line" | cut -d ',' -f 1` "$oldchord"
50
			fi
51
			oldstart=`echo "$line" | cut -d ',' -f 1`
52
			oldchord=`echo "$line" | cut -d ',' -f 2 | sed 's/"//g'`
53
			helper=y
54
		done > "$outfile"
55
		after="$(date +%s)"
56
		elapsed_seconds="$(expr $after - $before)"
57
		echo "  -->" time elapsed: $elapsed_seconds seconds
58
		echo " "
59
	else if [ ! "$infile" ]; then echo ...; fi
60
	fi		
61
done < "$listfile"