annotate structural_segmentation/segmentino/segmentino.sh @ 86:01f69f1d5d3c tip

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