annotate multiple_f0_estimation/silvet/doNoteTracking.sh @ 59:63213c3d2889

Path fix
author Chris Cannam
date Thu, 04 Sep 2014 15:51:08 +0100
parents 674fb672aa76
children 2b1e48b14423
rev   line source
Chris@56 1 #!/bin/sh
Chris@56 2
Chris@56 3 mydir=`dirname "$0"`
Chris@56 4 infile="$1"
Chris@56 5 outfile="$2"
Chris@56 6
Chris@56 7 if [ t"$infile" = "t" ] || [ t"$outfile" = "t" ]; then
Chris@56 8 echo "Usage: $0 infile.wav outfile.txt"
Chris@56 9 exit 2
Chris@56 10 fi
Chris@56 11
Chris@56 12 mkdir -p "$mydir"/out || exit 1
Chris@56 13
Chris@56 14 inbase=`basename "$infile"`
Chris@56 15 inbase=${inbase%.*}
Chris@56 16
Chris@56 17 echo "Processing input WAV file $infile, writing results to $outfile..." 1>&2
Chris@56 18
Chris@56 19 # Run the Silvet plugin.
Chris@56 20 #
Chris@56 21 # 1. Run the plugin. This will produce an output file
Chris@56 22 # out/${inbase}.csv
Chris@56 23
Chris@56 24 VAMP_PATH="$mydir" sonic-annotator \
Chris@56 25 -t "$mydir"/silvet.ttl \
Chris@56 26 -w csv \
Chris@56 27 --csv-separator ' ' \
Chris@56 28 --csv-one-file "$mydir/out/$inbase.csv" \
Chris@56 29 --csv-force \
Chris@56 30 "$infile" || exit 1
Chris@56 31
Chris@56 32 # 2. Check the output file exists
Chris@56 33
Chris@59 34 poutfile="$mydir/out/$inbase.csv"
Chris@56 35 if [ ! -f "$poutfile" ]; then
Chris@56 36 echo "output file $poutfile not found! bailing out"; exit 1
Chris@56 37 fi
Chris@56 38
Chris@56 39 # 3. Convert the format. Sonic Annotator produced
Chris@56 40 #
Chris@56 41 # starttime duration freq note label
Chris@56 42 #
Chris@56 43 # while we want
Chris@56 44 #
Chris@56 45 # starttime endtime freq
Chris@56 46
Chris@56 47 cat "$poutfile" | awk '{ print $1, $1+$2, $3 }' > "$outfile"
Chris@56 48
Chris@56 49 echo "Done, output is in $outfile"