# HG changeset patch # User Chris Cannam # Date 1398686490 -3600 # Node ID 3e7e3c610fae1785573cdb67d73e2a54f28dadad # Parent 3af587be9b8a45cb34c48703b030c0ad4b56eca2 Test code diff -r 3af587be9b8a -r 3e7e3c610fae src/EM.cpp --- a/src/EM.cpp Mon Apr 28 12:45:06 2014 +0100 +++ b/src/EM.cpp Mon Apr 28 13:01:30 2014 +0100 @@ -132,7 +132,7 @@ void EM::expectation(const V &column) { - cerr << "."; +// cerr << "."; for (int i = 0; i < m_binCount; ++i) { m_estimate[i] = epsilon; diff -r 3af587be9b8a -r 3e7e3c610fae src/Silvet.cpp --- a/src/Silvet.cpp Mon Apr 28 12:45:06 2014 +0100 +++ b/src/Silvet.cpp Mon Apr 28 13:01:30 2014 +0100 @@ -576,7 +576,7 @@ ++start; int duration = width - start; - cerr << "duration " << duration << " for just-ended note " << note << endl; +// cerr << "duration " << duration << " for just-ended note " << note << endl; if (duration < durationThreshold) { // spurious continue; @@ -585,6 +585,8 @@ int velocity = maxStrength * 2; if (velocity > 127) velocity = 127; + cerr << "Found a genuine note, starting at " << columnDuration * start << " with duration " << columnDuration * duration << endl; + Feature nf; nf.hasTimestamp = true; nf.timestamp = RealTime::fromSeconds(columnDuration * start); @@ -598,7 +600,7 @@ m_pianoRoll.push_back(active); - cerr << "returning " << noteFeatures.size() << " complete notes" << endl; +// cerr << "returning " << noteFeatures.size() << " complete note(s) " << endl; return noteFeatures; } diff -r 3af587be9b8a -r 3e7e3c610fae testdata/TRIOS-silvet/calculate.sh --- a/testdata/TRIOS-silvet/calculate.sh Mon Apr 28 12:45:06 2014 +0100 +++ b/testdata/TRIOS-silvet/calculate.sh Mon Apr 28 13:01:30 2014 +0100 @@ -20,9 +20,28 @@ exit 1 fi -VAMP_PATH=../.. sonic-annotator \ - -w csv \ - --csv-basedir "$outbase" \ - -d vamp:silvet:silvet:notes \ - -r "$trios_path" +for d in brahms lussier mozart schubert take_five; do + dir="$trios_path/$d" + outdir="$outbase/$d" + if [ ! -d "$dir" ]; then + echo "TRIOS subdir $dir not found, skipping it" + else + mkdir -p "$outdir" + VAMP_PATH=../.. sonic-annotator \ + --writer csv \ + --csv-basedir "$outdir" \ + --csv-force \ + --default vamp:silvet:silvet:notes \ + --recursive \ + "$dir" + fi + echo "Converting to lab files..." + for csv in "$outdir"/*.csv; do + cbase=`basename "$csv" .csv` + cat "$csv" | while IFS=, read start duration frequency level label; do + end=`echo "$start $duration + p" | dc` + echo -e "$start\t$end\t$frequency" + done > "$outdir/$cbase.lab" + done +done