Mercurial > hg > sonic-annotator
changeset 103:344d5982bbf8
Add simple test for multiple audio file input and playlists
author | Chris Cannam |
---|---|
date | Wed, 01 Oct 2014 15:18:45 +0100 |
parents | fae326c22df5 |
children | 4852625eb62b |
files | tests/audio/playlist.m3u tests/expected/transforms-summaries-percussiononsets-all-files.csv tests/expected/transforms-summaries-percussiononsets-from-rdf-summaries-only.csv tests/expected/transforms-summaries-percussiononsets-playlist.csv tests/test-multiple-audio.sh tests/test.sh |
diffstat | 6 files changed, 69 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/audio/playlist.m3u Wed Oct 01 15:18:45 2014 +0100 @@ -0,0 +1,2 @@ +3clicks8.wav +6clicks8.wav
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/expected/transforms-summaries-percussiononsets-all-files.csv Wed Oct 01 15:18:45 2014 +0100 @@ -0,0 +1,20 @@ +"./audio/20sec-silence.wav",0.000000000,20.062040815,mean,61.6562,"(mean value, continuous-time average)" +,0.000000000,20.062040815,median,0,"(median value, continuous-time average)" +,0.000000000,20.062040815,mode,0,"(modal value, continuous-time average)" +,0.000000000,20.062040815,mean,895.898,"(mean value, continuous-time average)" +"./audio/3clicks.mp3",0.000000000,5.201269840,mean,164.674,"(mean value, continuous-time average)" +,0.000000000,5.201269840,median,169,"(median value, continuous-time average)" +,0.000000000,5.201269840,mode,0,"(modal value, continuous-time average)" +,0.000000000,5.201269840,mean,680.411,"(mean value, continuous-time average)" +"./audio/3clicks.ogg",0.000000000,5.201269840,mean,162.694,"(mean value, continuous-time average)" +,0.000000000,5.201269840,median,169,"(median value, continuous-time average)" +,0.000000000,5.201269840,mode,174,"(modal value, continuous-time average)" +,0.000000000,5.201269840,mean,697.732,"(mean value, continuous-time average)" +"./audio/3clicks8.wav",0.000000000,5.201269840,mean,162.585,"(mean value, continuous-time average)" +,0.000000000,5.201269840,median,168,"(median value, continuous-time average)" +,0.000000000,5.201269840,mode,0,"(modal value, continuous-time average)" +,0.000000000,5.201269840,mean,677.241,"(mean value, continuous-time average)" +"./audio/6clicks8.wav",0.000000000,10.031020407,mean,169.079,"(mean value, continuous-time average)" +,0.000000000,10.031020407,median,169,"(median value, continuous-time average)" +,0.000000000,10.031020407,mode,164,"(modal value, continuous-time average)" +,0.000000000,10.031020407,mean,695.759,"(mean value, continuous-time average)"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/expected/transforms-summaries-percussiononsets-from-rdf-summaries-only.csv Wed Oct 01 15:18:45 2014 +0100 @@ -0,0 +1,4 @@ +"./audio/3clicks8.wav",0.000000000,5.201269840,mean,162.585,"(mean value, continuous-time average)" +,0.000000000,5.201269840,median,168,"(median value, continuous-time average)" +,0.000000000,5.201269840,mode,0,"(modal value, continuous-time average)" +,0.000000000,5.201269840,mean,677.241,"(mean value, continuous-time average)"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/expected/transforms-summaries-percussiononsets-playlist.csv Wed Oct 01 15:18:45 2014 +0100 @@ -0,0 +1,8 @@ +"3clicks8.wav",0.000000000,5.201269840,mean,162.585,"(mean value, continuous-time average)" +,0.000000000,5.201269840,median,168,"(median value, continuous-time average)" +,0.000000000,5.201269840,mode,0,"(modal value, continuous-time average)" +,0.000000000,5.201269840,mean,677.241,"(mean value, continuous-time average)" +"6clicks8.wav",0.000000000,10.031020407,mean,169.079,"(mean value, continuous-time average)" +,0.000000000,10.031020407,median,169,"(median value, continuous-time average)" +,0.000000000,10.031020407,mode,164,"(modal value, continuous-time average)" +,0.000000000,10.031020407,mean,695.759,"(mean value, continuous-time average)"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-multiple-audio.sh Wed Oct 01 15:18:45 2014 +0100 @@ -0,0 +1,34 @@ +#!/bin/bash + +mypath=`dirname $0` +r=$mypath/../sonic-annotator + +tmpfile=$mypath/tmp_1_$$ + +trap "rm -f $tmpfile" 0 + +. test-include.sh + +transform=$mypath/transforms/transforms-summaries-percussiononsets-detectionfunction.n3 + +# Note, the output here depends on all the audio files present -- we +# would have to regenerate it if we added more test audio files +$r -t $transform -w csv --csv-stdout $mypath -r --summary-only > $tmpfile 2>/dev/null || \ + fail "Fails to run transform $transform with recursive dir option" + +expected=$mypath/expected/transforms-summaries-percussiononsets-all-files +csvcompare $tmpfile $expected.csv || \ + fail "Output mismatch for transform $transform with summaries and recursive dir option" + +# Here we remove any leading path from the audio file in the output, +# because the playlist reader will have resolved files to absolute +# paths and those will differ between systems +$r -t $transform -w csv --csv-stdout $mypath/audio/playlist.m3u --summary-only 2>/dev/null | sed 's,^"\.*/[^"]*/,",' > $tmpfile || \ + fail "Fails to run transform $transform with playlist input" + +expected=$mypath/expected/transforms-summaries-percussiononsets-playlist +csvcompare $tmpfile $expected.csv || \ + fail "Output mismatch for transform $transform with summaries and playlist input" + + +