annotate tests/test-json-destinations/test-json-destinations.sh @ 193:f9723275ba4c

Remove unused dependency on Rubber Band
author Chris Cannam
date Wed, 19 Aug 2015 16:36:21 +0100
parents 4ef452f5fefc
children 3b7ec45abd1c
rev   line source
Chris@0 1 #!/bin/bash
Chris@0 2
Chris@119 3 . ../include.sh
Chris@0 4
Chris@119 5 infile1=$audiopath/3clicks8.wav
Chris@119 6 infile2=$audiopath/6clicks8.wav
Chris@0 7
Chris@147 8 infile1dot=$audiopath/3.clicks.8.wav
Chris@0 9
Chris@150 10 outfile1=3clicks8.json
Chris@150 11 outfile2=6clicks8.json
Chris@44 12
Chris@150 13 outfile3=3clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.json
Chris@150 14 outfile4=3clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.json
Chris@150 15 outfile5=6clicks8_vamp_vamp-example-plugins_percussiononsets_onsets.json
Chris@150 16 outfile6=6clicks8_vamp_vamp-example-plugins_percussiononsets_detectionfunction.json
Chris@147 17
Chris@150 18 outfile1dot=3.clicks.8.json
Chris@0 19
Chris@150 20 tmpjson=$mypath/tmp_1_$$.json
Chris@0 21
Chris@150 22 trap "rm -f $tmpjson $outfile1 $outfile2 $outfile3 $outfile4 $outfile5 $outfile6 $infile1dot $outfile1dot $audiopath/$outfile1 $audiopath/$outfile2 $audiopath/$outfile3 $audiopath/$outfile4 $audiopath/$outfile5 $audiopath/$outfile6 $audiopath/$outfile1dot" 0
Chris@0 23
Chris@119 24 transformdir=$mypath/transforms
Chris@0 25
Chris@0 26
Chris@150 27 ctx="onsets transform, one audio file, default JSON writer destination"
Chris@0 28
Chris@147 29 rm -f $audiopath/$outfile1
Chris@0 30
Chris@150 31 $r -t $transformdir/onsets.n3 -w json $infile1 2>/dev/null || \
Chris@0 32 fail "Fails to run with $ctx"
Chris@0 33
Chris@150 34 check_json $audiopath/$outfile1 "$ctx"
Chris@0 35
Chris@0 36
Chris@150 37 ctx="onsets transform, one audio file with dots in filename, default JSON writer destination"
Chris@44 38
Chris@147 39 rm -f $audiopath/$outfile1
Chris@44 40
Chris@44 41 cp $infile1 $infile1dot
Chris@44 42
Chris@150 43 $r -t $transformdir/onsets.n3 -w json $infile1dot 2>/dev/null || \
Chris@44 44 fail "Fails to run with $ctx"
Chris@44 45
Chris@150 46 check_json $audiopath/$outfile1dot "$ctx"
Chris@44 47
Chris@147 48 rm -f $infile1dot $audiopath/$outfile1dot
Chris@44 49
Chris@44 50
Chris@150 51 ctx="onsets and df transforms, one audio file, default JSON writer destination"
Chris@0 52
Chris@147 53 rm -f $audiopath/$outfile1
Chris@0 54
Chris@150 55 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w json $infile1 2>/dev/null || \
Chris@0 56 fail "Fails to run with $ctx"
Chris@0 57
Chris@150 58 check_json $audiopath/$outfile1 "$ctx"
Chris@0 59
Chris@0 60
Chris@150 61 ctx="onsets transform, two audio files, default JSON writer destination"
Chris@0 62
Chris@147 63 rm -f $audiopath/$outfile1
Chris@147 64 rm -f $audiopath/$outfile2
Chris@0 65
Chris@150 66 $r -t $transformdir/onsets.n3 -w json $infile1 $infile2 2>/dev/null || \
Chris@0 67 fail "Fails to run with $ctx"
Chris@0 68
Chris@150 69 check_json $audiopath/$outfile1 "$ctx"
Chris@150 70 check_json $audiopath/$outfile2 "$ctx"
Chris@0 71
Chris@0 72
Chris@150 73 ctx="onsets transform, two audio files, one-file JSON writer"
Chris@0 74
Chris@152 75 $r -t $transformdir/onsets.n3 -w json --json-one-file $tmpjson $infile1 $infile2 2>/dev/null || \
Chris@152 76 fail "Fails to run with $ctx"
Chris@150 77
Chris@152 78 check_json $tmpjson "$ctx"
Chris@150 79
Chris@150 80
Chris@150 81 ctx="onsets transform, two audio files, stdout JSON writer"
Chris@150 82
Chris@150 83 $r -t $transformdir/onsets.n3 -w json --json-stdout $infile1 $infile2 2>/dev/null >$tmpjson || \
Chris@0 84 fail "Fails to run with $ctx"
Chris@0 85
Chris@150 86 check_json $tmpjson "$ctx"
Chris@0 87
Chris@0 88
Chris@150 89 ctx="onsets transform, one audio file, many-files JSON writer"
Chris@0 90
Chris@147 91 rm -f $audiopath/$outfile3
Chris@0 92
Chris@150 93 $r -t $transformdir/onsets.n3 -w json --json-many-files $infile1 2>/dev/null || \
Chris@0 94 fail "Fails to run with $ctx"
Chris@0 95
Chris@150 96 check_json $audiopath/$outfile3 "$ctx"
Chris@0 97
Chris@0 98
Chris@150 99 ctx="onsets transform, two audio files, many-files JSON writer"
Chris@0 100
Chris@147 101 rm -f $audiopath/$outfile3
Chris@147 102 rm -f $audiopath/$outfile5
Chris@0 103
Chris@150 104 $r -t $transformdir/onsets.n3 -w json --json-many-files $infile1 $infile2 2>/dev/null || \
Chris@0 105 fail "Fails to run with $ctx"
Chris@0 106
Chris@150 107 check_json $audiopath/$outfile3 "$ctx"
Chris@150 108 check_json $audiopath/$outfile5 "$ctx"
Chris@0 109
Chris@0 110
Chris@150 111 ctx="onsets and df transforms, two audio files, many-files JSON writer"
Chris@0 112
Chris@147 113 rm -f $audiopath/$outfile3
Chris@147 114 rm -f $audiopath/$outfile4
Chris@147 115 rm -f $audiopath/$outfile5
Chris@147 116 rm -f $audiopath/$outfile6
Chris@0 117
Chris@150 118 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w json --json-many-files $infile1 $infile2 2>/dev/null || \
Chris@0 119 fail "Fails to run with $ctx"
Chris@0 120
Chris@150 121 check_json $audiopath/$outfile3 "$ctx"
Chris@150 122 check_json $audiopath/$outfile4 "$ctx"
Chris@150 123 check_json $audiopath/$outfile5 "$ctx"
Chris@150 124 check_json $audiopath/$outfile6 "$ctx"
Chris@147 125
Chris@147 126
Chris@147 127 ctx="output base directory"
Chris@147 128
Chris@147 129 rm -f ./$outfile1
Chris@147 130
Chris@150 131 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 -w json --json-basedir . $infile1 2>/dev/null || \
Chris@147 132 fail "Fails to run with $ctx"
Chris@147 133
Chris@150 134 check_json ./$outfile1 "$ctx"
Chris@147 135
Chris@147 136
Chris@147 137 ctx="output base directory and many-files"
Chris@147 138
Chris@147 139 rm -f ./$outfile3
Chris@147 140 rm -f ./$outfile5
Chris@147 141
Chris@150 142 $r -t $transformdir/onsets.n3 -w json --json-basedir . --json-many-files $infile1 $infile2 2>/dev/null || \
Chris@147 143 fail "Fails to run with $ctx"
Chris@147 144
Chris@150 145 check_json ./$outfile3 "$ctx"
Chris@150 146 check_json ./$outfile5 "$ctx"
Chris@147 147
Chris@147 148
Chris@147 149 ctx="nonexistent output base directory"
Chris@147 150
Chris@150 151 $r -t $transformdir/onsets.n3 -w json --json-basedir ./DOES_NOT_EXIST $infile1 2>/dev/null && \
Chris@147 152 fail "Fails with $ctx by completing successfully (should refuse and bail out)"
Chris@0 153
Chris@0 154
Chris@150 155 ctx="existing output file and no --json-force"
Chris@0 156
Chris@147 157 touch $audiopath/$outfile1
Chris@0 158
Chris@150 159 $r -t $transformdir/onsets.n3 -w json $infile1 2>/dev/null && \
Chris@0 160 fail "Fails by completing successfully when output file already exists (should refuse and bail out)"
Chris@0 161
Chris@0 162
Chris@150 163 ctx="existing output file and --json-force"
Chris@0 164
Chris@147 165 touch $audiopath/$outfile1
Chris@0 166
Chris@150 167 $r -t $transformdir/onsets.n3 -w json --json-force $infile1 2>/dev/null || \
Chris@0 168 fail "Fails to run with $ctx"
Chris@0 169
Chris@150 170 check_json $audiopath/$outfile1 "$ctx"
Chris@0 171
Chris@0 172
Chris@0 173 exit 0