changeset 7:6e47105fa669

Review and fix some infelicities * Check enough arguments are supplied and print usage as appropriate * Run plugin from script directory, not random plugin from Vamp path * Use low strength ratio rather than high one and add comment about it * Don't need both cut and awk
author Chris Cannam
date Mon, 02 Sep 2013 10:00:56 +0100
parents 848d8b1ffc15
children 1f244a1da67a
files audio_tempo_estimation/qm-tempotracker/qm-tempotracker.sh
diffstat 1 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/audio_tempo_estimation/qm-tempotracker/qm-tempotracker.sh	Fri Aug 30 17:52:49 2013 +0100
+++ b/audio_tempo_estimation/qm-tempotracker/qm-tempotracker.sh	Mon Sep 02 10:00:56 2013 +0100
@@ -2,4 +2,33 @@
 #   input file: $1
 #   output file: $2
 
-sonic-annotator -t qm-tempotracker.ttl -w csv --csv-stdout --csv-separator ";" -S median --summary-only "$1" | cut -d';' -f5 | tr "\n" "\t" | awk 'BEGIN{FS=";"}{print $5/2, $5, 0.8}' > $2
+mydir=`dirname "$0"`
+infile="$1"
+outfile="$2"
+
+if [ t"$infile" = "t" ] || [ t"$outfile" = "t" ]; then
+    echo "Usage: $0 infile.wav outfile.txt"
+    exit 2
+fi
+
+# The task calls for three values -- a slower estimate T1, a faster
+# estimate T2, and "the strength of T1 relative to T2 (0-1)".
+#
+# So if our slower estimate is considered more likely, we should give
+# a higher ratio e.g. 0.9; if the faster one is considered more likely
+# we give a lower ratio e.g. 0.1. 
+#
+# We only actually have one estimate T, so we will supply T/2 as the
+# slower estimate. This means we need to give a strength parameter
+# that favours the higher estimate, e.g. 0.1.  I'm not sure whether
+# there's any real advantage here over simply giving T for both
+# estimates.
+
+VAMP_PATH="$mydir" sonic-annotator \
+    -t qm-tempotracker.ttl \
+    -w csv --csv-stdout --csv-separator ";" \
+    -S median --summary-only \
+    "$infile" \
+    | awk -F';' '{ print $5/2"\t"$5"\t0.1" }' \
+    > "$outfile"
+