Mercurial > hg > mirex2013
annotate audio_chord_estimation/chordino/chordino.sh @ 86:01f69f1d5d3c tip
Add further archive versions
author | Chris Cannam |
---|---|
date | Thu, 01 Aug 2019 17:54:05 +0100 |
parents | 96ae0dd9c50d |
children |
rev | line source |
---|---|
Chris@22 | 1 #!/bin/bash |
Chris@16 | 2 |
Chris@16 | 3 mydir=`dirname "$0"` |
Chris@16 | 4 infile="$1" |
Chris@16 | 5 outfile="$2" |
Chris@16 | 6 |
Chris@16 | 7 if [ t"$infile" = "t" ] || [ t"$outfile" = "t" ]; then |
Chris@16 | 8 echo "Usage: $0 infile.wav outfile.txt" |
Chris@16 | 9 exit 2 |
Chris@16 | 10 fi |
Chris@16 | 11 |
Chris@67 | 12 set -eu |
Chris@67 | 13 |
Chris@67 | 14 touch "$outfile" |
Chris@16 | 15 |
Chris@16 | 16 echo "Processing input WAV file $infile, writing results to $outfile..." 1>&2 |
Chris@16 | 17 |
Chris@16 | 18 # Convert |
Chris@16 | 19 # |
Chris@16 | 20 # ;time;"label" |
Chris@16 | 21 # |
Chris@16 | 22 # to |
Chris@16 | 23 # |
Chris@16 | 24 # starttime<TAB>endtime<TAB>label |
Chris@16 | 25 # |
Chris@16 | 26 # NB this omits the final chord! In practice the final one will almost |
Chris@16 | 27 # certainly be an N rather than a chord but this will surely be a |
Chris@16 | 28 # problem sometimes. What to do about it? |
Chris@16 | 29 |
Chris@77 | 30 VAMP_PATH="$mydir" sonic-annotator \ |
Chris@16 | 31 -t "$mydir"/chordino.ttl \ |
Chris@16 | 32 -w csv --csv-stdout --csv-separator ";" \ |
Chris@16 | 33 "$infile" \ |
Chris@22 | 34 | perl -e 'while (<>) { chomp; @a = split /;/; if (defined $p) { print "$p\t$a[1]\t$pl\n"; }; $p = $a[1]; $pl = $a[2]; $pl =~ s/"//g; }; $pp = $p + 1; print "$p\t$pp\t$pl\n";' \ |
Chris@16 | 35 > "$outfile" |
Chris@16 | 36 |