annotate structural_segmentation/segmentino/segmentino.sh @ 11:14844597d4d7

Add key detector task; use explicit directory for ttl files
author Chris Cannam
date Mon, 02 Sep 2013 15:45:15 +0100
parents e5970597e220
children
rev   line source
Chris@9 1 # runs sonic annotator using the specified transform file (-t)
Chris@9 2 # input file: $1
Chris@9 3 # output file: $2
Chris@9 4
Chris@9 5 mydir=`dirname "$0"`
Chris@9 6 infile="$1"
Chris@9 7 outfile="$2"
Chris@9 8
Chris@9 9 if [ t"$infile" = "t" ] || [ t"$outfile" = "t" ]; then
Chris@9 10 echo "Usage: $0 infile.wav outfile.txt"
Chris@9 11 exit 2
Chris@9 12 fi
Chris@9 13
Chris@9 14 echo "Processing input WAV file $infile, writing results to $outfile..." 1>&2
Chris@9 15
Chris@9 16 # Convert the Sonic Annotator format
Chris@9 17 #
Chris@9 18 # filename;starttime;duration;value;"label"
Chris@9 19 #
Chris@9 20 # to the lab format
Chris@9 21 #
Chris@9 22 # starttime<TAB>endtime<TAB>label
Chris@9 23 #
Chris@9 24 # To ensure both start and end times have the same number of
Chris@9 25 # significant digits, we'll do an addition in awk for both (hence
Chris@9 26 # the $2+0 for start time)
Chris@9 27
Chris@9 28 VAMP_PATH="$mydir" sonic-annotator \
Chris@11 29 -t "$mydir"/segmentino.ttl \
Chris@9 30 -w csv --csv-stdout --csv-separator ";" \
Chris@9 31 "$infile" \
Chris@9 32 | awk -F';' '{ gsub(/\"/, ""); print $2+0"\t"$2+$3"\t"$5 }' \
Chris@9 33 > "$outfile"
Chris@9 34