annotate multiple_f0_estimation/silvet/doNoteTracking-piano.sh @ 86:01f69f1d5d3c tip

Add further archive versions
author Chris Cannam
date Thu, 01 Aug 2019 17:54:05 +0100
parents a33f5dd9656d
children
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-piano.ttl \
Chris@56 26 -w csv \
Chris@56 27 --csv-separator ' ' \
Chris@56 28 --csv-one-file "$mydir/out/$inbase.csv" \
Chris@62 29 --csv-omit-filename \
Chris@56 30 --csv-force \
Chris@56 31 "$infile" || exit 1
Chris@56 32
Chris@56 33 # 2. Check the output file exists
Chris@56 34
Chris@71 35 poutfile="$mydir/out/${inbase}.csv"
Chris@56 36 if [ ! -f "$poutfile" ]; then
Chris@56 37 echo "output file $poutfile not found! bailing out"; exit 1
Chris@56 38 fi
Chris@56 39
Chris@56 40 # 3. Convert the format. Sonic Annotator produced
Chris@56 41 #
Chris@56 42 # starttime duration freq note label
Chris@56 43 #
Chris@56 44 # while we want
Chris@56 45 #
Chris@56 46 # starttime endtime freq
Chris@56 47
Chris@56 48 cat "$poutfile" | awk '{ print $1, $1+$2, $3 }' > "$outfile"
Chris@56 49
Chris@56 50 echo "Done, output is in $outfile"