Chris@0: #!/bin/bash Chris@0: Chris@119: . ../include.sh Chris@0: Chris@119: infile=$audiopath/3clicks8.wav Chris@0: tmpdir=$mypath/tmp_1_$$.dir Chris@0: tmpwav=$tmpdir/test.wav Chris@0: Chris@0: trap "rm -rf $tmpdir" 0 Chris@0: Chris@144: types=`$r --list-writers` Chris@0: [ -n "$types" ] || \ Chris@144: fail "Fails to report list of writers" Chris@0: Chris@119: onsets=$mypath/transforms/percussiononsets-onsets.n3 Chris@119: df=$mypath/transforms/percussiononsets-detectionfunction.n3 Chris@0: Chris@0: adbdir=$tmpdir/audiodb-test Chris@0: Chris@0: for type in $types; do Chris@0: Chris@0: mkdir -p $tmpdir Chris@0: cp $infile $tmpwav Chris@0: Chris@0: # Some of these are special cases: Chris@0: # Chris@0: # * The "default" writer type always prints to stdout instead of Chris@0: # to a file. Chris@0: # Chris@0: # * The "audiodb" writer will not print any output for features Chris@0: # that have no values (but are only point events). I don't know Chris@0: # how reasonable that is, but it's clearly intentional. It also Chris@0: # writes to a subdirectory $basedir/$catid/$trackid.$output Chris@0: Chris@0: case $type in Chris@0: audiodb) Chris@144: mkdir -p $adbdir Chris@0: $r -t $df -w $type $tmpwav --audiodb-basedir $tmpdir --audiodb-catid `basename $adbdir` 2>/dev/null || \ Chris@0: fail "Fails to run with reader type \"$type\" and default options" Chris@0: ;; Chris@0: default) Chris@0: $r -t $onsets -w $type $tmpwav > $tmpdir/test.out 2>/dev/null || \ Chris@0: fail "Fails to run with reader type \"$type\" and default options" Chris@0: ;; Chris@0: *) Chris@0: $r -t $onsets -w $type $tmpwav 2>/dev/null || \ Chris@0: fail "Fails to run with reader type \"$type\" and default options" Chris@0: ;; Chris@0: esac Chris@0: newfiles=`ls $tmpdir | fgrep -v .wav` Chris@0: if [ "$type" = audiodb ]; then newfiles=`ls $adbdir`; fi Chris@0: Chris@0: [ -n "$newfiles" ] || \ Chris@0: fail "Fails to create output file for reader \"$type\" with default options" Chris@0: Chris@0: case `echo $newfiles | wc -w` in Chris@0: [2-9]) Chris@0: if [ "$type" != audiodb ]; then Chris@0: fail "Produces more than one output file for reader \"$type\" with default options" Chris@0: fi Chris@0: ;; Chris@0: 1) Chris@0: if [ "$type" = audiodb ]; then Chris@0: fail "Produces only one output file for reader \"$type\" with default options (expected two)" Chris@0: fi Chris@0: ;; Chris@0: esac Chris@0: Chris@0: rm -r $tmpdir Chris@0: done Chris@0: Chris@119: exit 0 Chris@119: