Chris@0: #!/bin/bash Chris@0: Chris@119: . ../include.sh Chris@0: Chris@119: infile1=$audiopath/3clicks8.wav Chris@119: infile2=$audiopath/6clicks8.wav Chris@0: Chris@119: outfile1=$audiopath/3clicks8.n3 Chris@119: outfile2=$audiopath/6clicks8.n3 Chris@0: Chris@119: infile1dot=$audiopath/3.clicks.8.wav Chris@119: outfile1dot=$audiopath/3.clicks.8.n3 Chris@44: Chris@119: outfile3=$audiopath/3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 Chris@119: outfile4=$audiopath/3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 Chris@119: outfile5=$audiopath/6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.n3 Chris@119: outfile6=$audiopath/6clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.n3 Chris@0: Chris@0: tmpttl=$mypath/tmp_1_$$.ttl Chris@0: Chris@44: trap "rm -f $tmpttl $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6 $infile1dot $outfile1dot" 0 Chris@0: Chris@119: transformdir=$mypath/transforms Chris@0: Chris@0: check_rdf() { Chris@0: test -f $1 || \ Chris@0: fail "Fails to write output to expected location $1 for $2" Chris@0: rapper -i turtle $1 >/dev/null 2>&1 || \ Chris@0: fail "Fails to produce parseable RDF/TTL for $2" Chris@0: rapper -i turtle -c $1 2>&1 | egrep -q 'Parsing returned [1-9][0-9]+ triples' || \ Chris@0: fail "RDF output contains no triples (?) for $2" Chris@0: rm -f $1 Chris@0: } Chris@0: Chris@0: Chris@0: ctx="onsets transform, one audio file, default RDF writer destination" Chris@0: Chris@0: rm -f $outfile1 Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -w rdf $infile1 2>/dev/null || \ Chris@0: fail "Fails to run with $ctx" Chris@0: Chris@0: check_rdf $outfile1 "$ctx" Chris@0: Chris@0: Chris@44: ctx="onsets transform, one audio file with dots in filename, default RDF writer destination" Chris@44: Chris@44: rm -f $outfile1 Chris@44: Chris@44: cp $infile1 $infile1dot Chris@44: Chris@119: $r -t $transformdir/onsets.n3 -w rdf $infile1dot 2>/dev/null || \ Chris@44: fail "Fails to run with $ctx" Chris@44: Chris@44: check_rdf $outfile1dot "$ctx" Chris@44: Chris@44: rm -f $infile1dot $outfile1dot Chris@44: Chris@44: Chris@0: ctx="onsets and df transforms, one audio file, default RDF writer destination" Chris@0: Chris@0: rm -f $outfile1 Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf $infile1 2>/dev/null || \ Chris@0: fail "Fails to run with $ctx" Chris@0: Chris@0: check_rdf $outfile1 "$ctx" Chris@0: Chris@0: Chris@0: ctx="onsets transform, two audio files, default RDF writer destination" Chris@0: Chris@0: rm -f $outfile1 Chris@0: rm -f $outfile2 Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -w rdf $infile1 $infile2 2>/dev/null || \ Chris@0: fail "Fails to run with $ctx" Chris@0: Chris@0: check_rdf $outfile1 "$ctx" Chris@0: check_rdf $outfile2 "$ctx" Chris@0: Chris@0: Chris@0: ctx="onsets transform, two audio files, one-file RDF writer" Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -w rdf --rdf-one-file $tmpttl $infile1 $infile2 2>/dev/null || \ Chris@0: fail "Fails to run with $ctx" Chris@0: Chris@0: check_rdf $tmpttl "$ctx" Chris@0: Chris@0: Chris@0: ctx="onsets transform, two audio files, stdout RDF writer" Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -w rdf --rdf-stdout $infile1 $infile2 2>/dev/null >$tmpttl || \ Chris@0: fail "Fails to run with $ctx" Chris@0: Chris@0: check_rdf $tmpttl "$ctx" Chris@0: Chris@0: Chris@0: ctx="onsets transform, one audio file, many-files RDF writer" Chris@0: Chris@0: rm -f $outfile3 Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 2>/dev/null || \ Chris@0: fail "Fails to run with $ctx" Chris@0: Chris@0: check_rdf $outfile3 "$ctx" Chris@0: Chris@0: Chris@0: ctx="onsets transform, two audio files, many-files RDF writer" Chris@0: Chris@0: rm -f $outfile3 Chris@0: rm -f $outfile5 Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \ Chris@0: fail "Fails to run with $ctx" Chris@0: Chris@0: check_rdf $outfile3 "$ctx" Chris@0: check_rdf $outfile5 "$ctx" Chris@0: Chris@0: Chris@0: ctx="onsets and df transforms, two audio files, many-files RDF writer" Chris@0: Chris@0: rm -f $outfile3 Chris@0: rm -f $outfile4 Chris@0: rm -f $outfile5 Chris@0: rm -f $outfile6 Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w rdf --rdf-many-files $infile1 $infile2 2>/dev/null || \ Chris@0: fail "Fails to run with $ctx" Chris@0: Chris@0: check_rdf $outfile3 "$ctx" Chris@0: check_rdf $outfile4 "$ctx" Chris@0: check_rdf $outfile5 "$ctx" Chris@0: check_rdf $outfile6 "$ctx" Chris@0: Chris@0: Chris@0: ctx="existing output file and no --rdf-force" Chris@0: Chris@0: touch $outfile1 Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -w rdf $infile1 2>/dev/null && \ Chris@0: fail "Fails by completing successfully when output file already exists (should refuse and bail out)" Chris@0: Chris@0: Chris@0: ctx="existing output file and --rdf-force" Chris@0: Chris@0: touch $outfile1 Chris@0: Chris@119: $r -t $transformdir/onsets.n3 -w rdf --rdf-force $infile1 2>/dev/null || \ Chris@0: fail "Fails to run with $ctx" Chris@0: Chris@0: check_rdf $outfile1 "$ctx" Chris@0: Chris@0: Chris@0: exit 0