Chris@191: #!/bin/bash Chris@191: Chris@191: . ../include.sh Chris@191: Chris@191: tmpjson=$mypath/tmp_1_$$.json Chris@191: Chris@191: silentfile=$audiopath/20sec-silence.wav Chris@204: infile=$audiopath/3clicks8.wav Chris@191: Chris@191: trap "rm -f $tmpjson" 0 Chris@191: Chris@191: transformdir=$mypath/transforms Chris@191: Chris@200: mandatory="-w jams" Chris@197: Chris@204: # First check that the JSON is valid for all outputs Chris@191: Chris@191: for output in instants curve-oss curve-fsr curve-fsr-timed curve-vsr grid-oss grid-fsr notes-regions; do Chris@191: Chris@200: $r -d "$testplug:$output" $mandatory --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \ Chris@191: fail "Failed to run for plugin $testplug with output $output" Chris@191: Chris@191: check_json "$tmpjson" "test plugin output $output" Chris@204: Chris@191: done Chris@191: Chris@208: # If JAMS is installed, we can report on whether the outputs are valid Chris@208: # JAMS schema files or not -- unfortunately we can't comply with the Chris@208: # schema for most real plugins, so we can only make indicative reports Chris@208: # for most. This is such a limited test that we make it optional; it's Chris@208: # a bit much to expect everyone to have JAMS installed just for Chris@208: # this. Also the JAMS verifier doesn't currently always work for me Chris@208: # (e.g. it doesn't seem to work correctly with Python 3 at the moment) Chris@208: # so let's not make this fatal either. Chris@208: Chris@208: if jams_to_lab.py --help >/dev/null 2>&1; then Chris@208: Chris@208: $r -t "$transformdir/onsets.n3" $mandatory --jams-one-file "$tmpjson" --jams-force "$infile" 2>/dev/null || \ Chris@208: fail "Failed to run for onsets" Chris@208: Chris@208: if ! jams_to_lab.py "$tmpjson" test; then Chris@208: echo "WARNING: JAMS schema verification failed for onsets" Chris@208: fi Chris@208: fi Chris@208: Chris@208: # Now check against expected output, for a subset Chris@204: Chris@204: for output in instants curve-fsr grid-oss notes-regions; do Chris@204: Chris@204: $r -d "$testplug:$output" $mandatory --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \ Chris@204: fail "Failed to run for plugin $testplug with output $output" Chris@204: Chris@204: expected="$mypath/expected/$output.json" Chris@204: jsoncompare "$tmpjson" "$expected" || \ Chris@204: faildiff "Output differs from expected for $output" "$tmpjson" "$expected" Chris@204: Chris@204: done Chris@204: Chris@204: # Test digits option, with an output that has lots of digits to round Chris@204: Chris@204: for digits in 0 6 2; do Chris@204: cannam@299: $r -d "$testplug:grid-oss" $mandatory --jams-digits "$digits" --jams-one-file "$tmpjson" --jams-force "$silentfile" 2>/dev/null || \ Chris@204: fail "Failed to run for af with digits = $digits" Chris@204: cannam@299: expected="$mypath/expected/grid-oss-$digits.json" Chris@204: jsoncompare "$tmpjson" "$expected" || \ Chris@204: faildiff "Output differs from expected for af with digits = $digits" "$tmpjson" "$expected" Chris@204: Chris@204: done Chris@204: