annotate tests/test-audioformat/test-audioformat.sh @ 399:a3912193ce69 tip

Default branch is now named default on git as well as hg, in case we ever want to switch to mirroring in the other direction
author Chris Cannam
date Thu, 27 Aug 2020 15:57:37 +0100
parents ddcbbd85c1ea
children
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@119 3 . ../include.sh
Chris@0 4
Chris@119 5 inbase=$audiopath/3clicks
Chris@0 6 tmpfile1=$mypath/tmp_1_$$
Chris@0 7 tmpfile2=$mypath/tmp_2_$$
Chris@0 8
Chris@0 9 trap "rm -f $tmpfile1 $tmpfile2" 0
Chris@0 10
Chris@369 11 for extension in wav ogg mp3 opus ; do
Chris@0 12
Chris@119 13 transform=$mypath/transforms/percussiononsets.n3
Chris@119 14 expected=$mypath/expected/percussiononsets-$extension.csv
Chris@0 15
Chris@0 16 test -f $transform || \
Chris@119 17 fail "Internal error: no transforms file"
Chris@0 18
Chris@0 19 test -f $expected || \
Chris@119 20 fail "Internal error: no expected output file for extension $extension"
Chris@0 21
Chris@0 22 infile=$inbase.$extension
Chris@0 23 if [ "$extension" = "wav" ]; then infile=${inbase}8.$extension; fi
Chris@0 24
Chris@0 25 test -f $infile || \
Chris@0 26 fail "Internal error: no input audio file for extension $extension"
Chris@0 27
Chris@0 28 $r -t $transform -w csv --csv-stdout $infile > $tmpfile2 2>/dev/null || \
Chris@0 29 fail "Fails to run transform $transform against audio file $infile"
Chris@0 30
Chris@281 31 csvcompare $tmpfile2 $expected || \
Chris@281 32 faildiff "Output mismatch for transform $transform for format $extension with audio file $infile" $tmpfile2 $expected
Chris@0 33 done
Chris@0 34
Chris@126 35 # Check the normalise flag
Chris@126 36
Chris@126 37 $r -d $amplplug -w csv --csv-stdout ${inbase}8quiet.wav 2>/dev/null | head > $tmpfile1 || \
Chris@126 38 fail "Fails to run default transform for plugin $amplplug against audio file ${inbase}8quiet.wav"
Chris@126 39 csvcompare $tmpfile1 $mypath/expected/norm-off.csv || \
Chris@126 40 faildiff "Output mismatch for default transform for plugin $amplplug against audio file ${inbase}8quiet.wav without normalisation" $tmpfile1 $mypath/expected/norm-off.csv
Chris@126 41
Chris@126 42 $r -d $amplplug -n -w csv --csv-stdout ${inbase}8quiet.wav 2>/dev/null | head > $tmpfile1 || \
Chris@126 43 fail "Fails to run default transform for plugin $amplplug against audio file ${inbase}8quiet.wav with normalisation"
Chris@126 44 csvcompare $tmpfile1 $mypath/expected/norm-on.csv || \
Chris@126 45 faildiff "Output mismatch for default transform for plugin $amplplug against audio file ${inbase}8quiet.wav with normalisation" $tmpfile1 $mypath/expected/norm-on.csv
Chris@126 46
Chris@126 47 $r -d $amplplug --normalise -w csv --csv-stdout ${inbase}8quiet.wav 2>/dev/null | head > $tmpfile1 || \
Chris@126 48 fail "Fails to run default transform for plugin $amplplug against audio file ${inbase}8quiet.wav with normalisation"
Chris@126 49 csvcompare $tmpfile1 $mypath/expected/norm-on.csv || \
Chris@126 50 faildiff "Output mismatch for default transform for plugin $amplplug against audio file ${inbase}8quiet.wav with normalisation" $tmpfile1 $mypath/expected/norm-on.csv
Chris@126 51
Chris@0 52 exit 0