Chris@9: # runs sonic annotator using the specified transform file (-t) Chris@9: # input file: $1 Chris@9: # output file: $2 Chris@9: Chris@9: mydir=`dirname "$0"` Chris@9: infile="$1" Chris@9: outfile="$2" Chris@9: Chris@9: if [ t"$infile" = "t" ] || [ t"$outfile" = "t" ]; then Chris@9: echo "Usage: $0 infile.wav outfile.txt" Chris@9: exit 2 Chris@9: fi Chris@9: Chris@9: echo "Processing input WAV file $infile, writing results to $outfile..." 1>&2 Chris@9: Chris@9: # Convert the Sonic Annotator format Chris@9: # Chris@9: # filename;starttime;duration;value;"label" Chris@9: # Chris@9: # to the lab format Chris@9: # Chris@9: # starttimeendtimelabel Chris@9: # Chris@9: # To ensure both start and end times have the same number of Chris@9: # significant digits, we'll do an addition in awk for both (hence Chris@9: # the $2+0 for start time) Chris@9: Chris@9: VAMP_PATH="$mydir" sonic-annotator \ Chris@11: -t "$mydir"/segmentino.ttl \ Chris@9: -w csv --csv-stdout --csv-separator ";" \ Chris@9: "$infile" \ Chris@9: | awk -F';' '{ gsub(/\"/, ""); print $2+0"\t"$2+$3"\t"$5 }' \ Chris@9: > "$outfile" Chris@9: