# HG changeset patch # User Chris Cannam # Date 1456834240 0 # Node ID 6a804920b4a841d08bdb88fef7281628812a6044 # Parent cee5cab9c85dc2711667196e0c2716196f791eed Toward checking summary values diff -r cee5cab9c85d -r 6a804920b4a8 .hgsubstate --- a/.hgsubstate Mon Feb 29 13:47:24 2016 +0000 +++ b/.hgsubstate Tue Mar 01 12:10:40 2016 +0000 @@ -1,4 +1,4 @@ d16f0fd6db6104d87882bc43788a3bb1b0f8c528 dataquay 55ece8862b6d3a54aad271a53f9c1615e5d3bcf8 sv-dependency-builds 134ce7667256fb204f3bebd293c252bc57cbe07e svcore -632d90c185ecc8655f7a85ba58dc568351449dfd vamp-plugin-sdk +a13635e9c4407ac648ea6fe26aa41d2313b6398e vamp-plugin-sdk diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/expected/testplug-curve-vsr-count.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/expected/testplug-curve-vsr-count.csv Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,1 @@ +0.000000000,9.750000000,count,10,"(count)" diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/expected/testplug-curve-vsr-max.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/expected/testplug-curve-vsr-max.csv Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,1 @@ +0.000000000,9.750000000,max,0.9,"(maximum value)" diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/expected/testplug-curve-vsr-mean.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/expected/testplug-curve-vsr-mean.csv Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,20 @@ +# Sonic Annotator's summary method integrates the values across +# time. If an output lacks duration for its features, each feature is +# considered to extend until the timestamp of the following feature, +# and the final feature is considered to extend until the end of the +# input or the last-ending output, whichever is later. +# +# The curve-vsr output is therefore considered to have 9 values (0.0 +# to 0.8) that span 0.75 seconds each, followed by one value (0.9) +# that spans the 3 seconds from 6.75 to 9.75 where the final output of +# the plugin ends (that's the notes-regions output). +# +# The sum of 0.0..0.8 is 3.6, so the mean is (3.6 * 0.75 + 0.9 * 3.0) +# / 9.75 = 0.553846 approx. +# +# Equivalently we can consider the last feature the same as four +# features of 0.75 seconds each (i.e. the same durations as the first +# 9) each with the same value, 0.9. The mean is then the sum of +# 0.0..0.9 plus three more 0.9s, i.e. 7.2, divided by 13. +# +0.000000000,9.750000000,mean,0.553846,"(mean value, continuous-time average)" diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/expected/testplug-curve-vsr-median.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/expected/testplug-curve-vsr-median.csv Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,16 @@ +# Sonic Annotator's summary method integrates the values across +# time. If an output lacks duration for its features, each feature is +# considered to extend until the timestamp of the following feature, +# and the final feature is considered to extend until the end of the +# input or the last-ending output, whichever is later. +# +# The curve-vsr output is therefore considered to have 9 values (0.0 +# to 0.8) that span 0.75 seconds each, followed by one value (0.9) +# that spans the 3 seconds from 6.75 to 9.75 where the final output of +# the plugin ends (that's the notes-regions output). +# +# Since the values from this output are already sorted and are +# distinct, the integrated median is just whatever is in effect at +# time 9.75 / 2.0 = 4.875. This value is 0.6. +# +0.000000000,9.750000000,median,0.6,"(median value, continuous-time average)" diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/expected/testplug-curve-vsr-min.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/expected/testplug-curve-vsr-min.csv Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,1 @@ +0.000000000,9.750000000,min,0,"(minimum value)" diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/expected/testplug-curve-vsr-mode.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/expected/testplug-curve-vsr-mode.csv Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,15 @@ +# Sonic Annotator's summary method integrates the values across +# time. If an output lacks duration for its features, each feature is +# considered to extend until the timestamp of the following feature, +# and the final feature is considered to extend until the end of the +# input or the last-ending output, whichever is later. +# +# The curve-vsr output is therefore considered to have 9 values (0.0 +# to 0.8) that span 0.75 seconds each, followed by one value (0.9) +# that spans the 3 seconds from 6.75 to 9.75 where the final output of +# the plugin ends (that's the notes-regions output). +# +# The modal value is the one spanning the longest, which of course is +# that final one, 0.9. +# +0.000000000,9.750000000,mode,0.9,"(modal value, continuous-time average)" diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/expected/testplug-curve-vsr-sd.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/expected/testplug-curve-vsr-sd.csv Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,4 @@ +# Standard deviation is sqrt(variance), see the variance file for +# notes on that value. +# +0.000000000,9.750000000,sd,0.315291,"(standard deviation, continuous-time average)" diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/expected/testplug-curve-vsr-sum.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/expected/testplug-curve-vsr-sum.csv Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,1 @@ +0.000000000,9.750000000,sum,4.5,"(sum)" diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/expected/testplug-curve-vsr-variance.csv --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/expected/testplug-curve-vsr-variance.csv Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,20 @@ +# Sonic Annotator's summary method integrates the values across +# time. If an output lacks duration for its features, each feature is +# considered to extend until the timestamp of the following feature, +# and the final feature is considered to extend until the end of the +# input or the last-ending output, whichever is later. +# +# The curve-vsr output is therefore considered to have 9 values (0.0 +# to 0.8) that span 0.75 seconds each, followed by one value (0.9) +# that spans the 3 seconds from 6.75 to 9.75 where the final output of +# the plugin ends (that's the notes-regions output). +# +# We can consider the last feature the same as four features of 0.75 +# seconds each (i.e. the same durations as the first 9) each with the +# same value, 0.9. +# +# The mean m is then 7.2 / 13 = 0.553846 approx, and the variance is +# the sum for each of the 13 (partly fictitious) values v of (v-m)^2, +# divided by 13. This works out as 0.0994083 ish. +# +0.000000000,9.750000000,variance,0.0994083,"(variance, continuous-time average)" diff -r cee5cab9c85d -r 6a804920b4a8 tests/test-summaries/test-summaries-testplugin.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-summaries/test-summaries-testplugin.sh Tue Mar 01 12:10:40 2016 +0000 @@ -0,0 +1,27 @@ +#!/bin/bash + +. ../include.sh + +infile=$audiopath/3clicks8.wav +tmpfile=$mypath/tmp_1_$$ +tmpfile2=$mypath/tmp_2_$$ + +trap "rm -f $tmpfile $tmpfile2" 0 + +for output in curve-vsr grid-fsr notes-regions; do + + for summary in min max mean median mode sum variance sd count; do + + id="$testplug:$output" + expected="$mypath/expected/testplug-$output-$summary.csv" + + cat "$expected" | grep -v '^#' > "$tmpfile2" + + $r -d $id -w csv --csv-stdout -S $summary --summary-only --csv-omit-filename $infile > $tmpfile 2>/dev/null || \ + fail "Fails to run transform id $id with summary type $summary" + + csvcompare "$tmpfile" "$tmpfile2" || + faildiff "Output mismatch for output $output with summary type $summary" "$tmpfile" "$tmpfile2" + + done +done