annotate tests/test-jams-writer/test-jams-writer.sh @ 271:7b3a80021b7c piper-nopiper

Add MAD_BUFFER_GUARD padding at end of mp3 buffer, in order to ensure last frame is decoded successfully (otherwise the decoded audio is truncated). Another thing learned from madplay.
author Chris Cannam
date Thu, 24 Nov 2016 17:06:31 +0000
parents c17b184c16db
children c9be1a6f7d74
rev   line source
Chris@191 1 #!/bin/bash
Chris@191 2
Chris@191 3 . ../include.sh
Chris@191 4
Chris@191 5 tmpjson=$mypath/tmp_1_$$.json
Chris@191 6
Chris@191 7 silentfile=$audiopath/20sec-silence.wav
Chris@204 8 infile=$audiopath/3clicks8.wav
Chris@191 9
Chris@191 10 trap "rm -f $tmpjson" 0
Chris@191 11
Chris@191 12 transformdir=$mypath/transforms
Chris@191 13
Chris@200 14 mandatory="-w jams"
Chris@197 15
Chris@204 16 # First check that the JSON is valid for all outputs
Chris@191 17
Chris@191 18 for output in instants curve-oss curve-fsr curve-fsr-timed curve-vsr grid-oss grid-fsr notes-regions; do
Chris@191 19
Chris@200 20 $r -d "$testplug:$output" $mandatory --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \
Chris@191 21 fail "Failed to run for plugin $testplug with output $output"
Chris@191 22
Chris@191 23 check_json "$tmpjson" "test plugin output $output"
Chris@204 24
Chris@191 25 done
Chris@191 26
Chris@208 27 # If JAMS is installed, we can report on whether the outputs are valid
Chris@208 28 # JAMS schema files or not -- unfortunately we can't comply with the
Chris@208 29 # schema for most real plugins, so we can only make indicative reports
Chris@208 30 # for most. This is such a limited test that we make it optional; it's
Chris@208 31 # a bit much to expect everyone to have JAMS installed just for
Chris@208 32 # this. Also the JAMS verifier doesn't currently always work for me
Chris@208 33 # (e.g. it doesn't seem to work correctly with Python 3 at the moment)
Chris@208 34 # so let's not make this fatal either.
Chris@208 35
Chris@208 36 if jams_to_lab.py --help >/dev/null 2>&1; then
Chris@208 37
Chris@208 38 $r -t "$transformdir/onsets.n3" $mandatory --jams-one-file "$tmpjson" --jams-force "$infile" 2>/dev/null || \
Chris@208 39 fail "Failed to run for onsets"
Chris@208 40
Chris@208 41 if ! jams_to_lab.py "$tmpjson" test; then
Chris@208 42 echo "WARNING: JAMS schema verification failed for onsets"
Chris@208 43 fi
Chris@208 44 fi
Chris@208 45
Chris@208 46 # Now check against expected output, for a subset
Chris@204 47
Chris@204 48 for output in instants curve-fsr grid-oss notes-regions; do
Chris@204 49
Chris@204 50 $r -d "$testplug:$output" $mandatory --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \
Chris@204 51 fail "Failed to run for plugin $testplug with output $output"
Chris@204 52
Chris@204 53 expected="$mypath/expected/$output.json"
Chris@204 54 jsoncompare "$tmpjson" "$expected" || \
Chris@204 55 faildiff "Output differs from expected for $output" "$tmpjson" "$expected"
Chris@204 56
Chris@204 57 done
Chris@204 58
Chris@204 59 # Test digits option, with an output that has lots of digits to round
Chris@204 60
Chris@204 61 for digits in 0 6 2; do
Chris@204 62
Chris@204 63 $r -t "$transformdir/af.n3" $mandatory --jams-digits "$digits" --jams-one-file "$tmpjson" --jams-force "$infile" 2>/dev/null || \
Chris@204 64 fail "Failed to run for af with digits = $digits"
Chris@204 65
Chris@204 66 expected="$mypath/expected/af-$digits.json"
Chris@204 67 jsoncompare "$tmpjson" "$expected" || \
Chris@204 68 faildiff "Output differs from expected for af with digits = $digits" "$tmpjson" "$expected"
Chris@204 69
Chris@204 70 done
Chris@204 71