Mercurial > hg > mirex2013
diff multiple_f0_estimation/silvet/doNoteTracking.sh @ 56:674fb672aa76
Add multi-F0 provisional entry
author | Chris Cannam |
---|---|
date | Wed, 03 Sep 2014 14:18:23 +0100 |
parents | |
children | 63213c3d2889 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/multiple_f0_estimation/silvet/doNoteTracking.sh Wed Sep 03 14:18:23 2014 +0100 @@ -0,0 +1,49 @@ +#!/bin/sh + +mydir=`dirname "$0"` +infile="$1" +outfile="$2" + +if [ t"$infile" = "t" ] || [ t"$outfile" = "t" ]; then + echo "Usage: $0 infile.wav outfile.txt" + exit 2 +fi + +mkdir -p "$mydir"/out || exit 1 + +inbase=`basename "$infile"` +inbase=${inbase%.*} + +echo "Processing input WAV file $infile, writing results to $outfile..." 1>&2 + +# Run the Silvet plugin. +# +# 1. Run the plugin. This will produce an output file +# out/${inbase}.csv + +VAMP_PATH="$mydir" sonic-annotator \ + -t "$mydir"/silvet.ttl \ + -w csv \ + --csv-separator ' ' \ + --csv-one-file "$mydir/out/$inbase.csv" \ + --csv-force \ + "$infile" || exit 1 + +# 2. Check the output file exists + +poutfile="out/${inbase}.csv" +if [ ! -f "$poutfile" ]; then + echo "output file $poutfile not found! bailing out"; exit 1 +fi + +# 3. Convert the format. Sonic Annotator produced +# +# starttime duration freq note label +# +# while we want +# +# starttime endtime freq + +cat "$poutfile" | awk '{ print $1, $1+$2, $3 }' > "$outfile" + +echo "Done, output is in $outfile"