annotate testdata/TRIOS-mirex2012-matlab/calculate.sh @ 135:8db5e4ab56ce

Ground-truth data in CSV and lab format, converted from the MIDI using Sonic Visualiser and then to lab using the script here
author Chris Cannam
date Thu, 08 May 2014 12:59:09 +0100
parents 5f8b4d609b03
children
rev   line source
Chris@59 1 #!/bin/bash
Chris@59 2
Chris@59 3 # Run this from the directory that contains it
Chris@59 4
Chris@59 5 trios_path="/import/c4dm-datasets/TRIOS_dataset"
Chris@59 6
Chris@59 7 if [ ! -d "$trios_path" ]; then
Chris@59 8 echo "TRIOS dataset directory $trios_path not found, giving up"
Chris@59 9 exit 1
Chris@59 10 fi
Chris@59 11
Chris@59 12 matlab_path="../../mirex2012-matlab"
Chris@59 13
Chris@59 14 if [ ! -d "$matlab_path" ] || [ ! -f "$matlab_path/doMultiF0.m" ]; then
Chris@59 15 echo "Required MATLAB code not found in $matlab_path, giving up"
Chris@59 16 exit 1
Chris@59 17 fi
Chris@59 18
Chris@59 19 outbase="`pwd`"
Chris@59 20 echo "Will read TRIOS files from $trios_path"
Chris@59 21 echo "Will write output files below $outbase"
Chris@59 22 echo "If either of these is incorrect, hit ctrl-C now!"
Chris@59 23 sleep 8
Chris@59 24
Chris@59 25 if echo quit | matlab -nojvm ; then echo
Chris@59 26 else
Chris@59 27 echo "Failed to start MATLAB to check that it works, giving up"
Chris@59 28 exit 1
Chris@59 29 fi
Chris@59 30
Chris@59 31 for d in brahms lussier mozart schubert take_five; do
Chris@59 32 dir="$trios_path/$d"
Chris@59 33 outdir="$outbase/$d"
Chris@59 34 if [ ! -d "$dir" ]; then
Chris@59 35 echo "TRIOS subdir $dir not found, skipping it"
Chris@59 36 else
Chris@59 37 mkdir -p "$outdir"
Chris@59 38 for w in "$dir"/*.wav; do
Chris@59 39 wbase=`basename "$w" .wav`
Chris@59 40 out="$outdir/$wbase.lab"
Chris@67 41 if [ -f "$out" ]; then
Chris@67 42 echo "Output file $out (for wav file $w) already exists, skipping"
Chris@67 43 else
Chris@67 44 echo "Processing wav file $w, writing to lab file $out"
Chris@67 45 time ( cd "$matlab_path" ; echo "doMultiF0('$w','$out')" | matlab -nojvm )
Chris@67 46 echo "Done"
Chris@67 47 fi
Chris@59 48 done
Chris@59 49 fi
Chris@59 50 echo
Chris@59 51 done
Chris@59 52
Chris@59 53