annotate tests/test-jams-destinations/test-jams-destinations.sh @ 302:1e6cee321cc0

Added tag sonic-annotator-1.5 for changeset 929e37acf0d9
author Chris Cannam
date Thu, 25 May 2017 15:01:41 +0100
parents f35bbb3e4d41
children
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@200 26 mandatory="-w jams"
Chris@197 27
Chris@0 28
Chris@200 29 ctx="onsets transform, one audio file, default JAMS writer destination"
Chris@0 30
Chris@147 31 rm -f $audiopath/$outfile1
Chris@0 32
Chris@197 33 $r -t $transformdir/onsets.n3 $mandatory $infile1 2>/dev/null || \
Chris@0 34 fail "Fails to run with $ctx"
Chris@0 35
Chris@150 36 check_json $audiopath/$outfile1 "$ctx"
Chris@0 37
Chris@0 38
Chris@200 39 ctx="onsets transform, one audio file with dots in filename, default JAMS writer destination"
Chris@44 40
Chris@147 41 rm -f $audiopath/$outfile1
Chris@44 42
Chris@44 43 cp $infile1 $infile1dot
Chris@44 44
Chris@197 45 $r -t $transformdir/onsets.n3 $mandatory $infile1dot 2>/dev/null || \
Chris@44 46 fail "Fails to run with $ctx"
Chris@44 47
Chris@150 48 check_json $audiopath/$outfile1dot "$ctx"
Chris@44 49
Chris@147 50 rm -f $infile1dot $audiopath/$outfile1dot
Chris@44 51
Chris@44 52
Chris@200 53 ctx="onsets and df transforms, one audio file, default JAMS writer destination"
Chris@0 54
Chris@147 55 rm -f $audiopath/$outfile1
Chris@0 56
Chris@197 57 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 $mandatory $infile1 2>/dev/null || \
Chris@0 58 fail "Fails to run with $ctx"
Chris@0 59
Chris@150 60 check_json $audiopath/$outfile1 "$ctx"
Chris@0 61
Chris@0 62
Chris@200 63 ctx="onsets transform, two audio files, default JAMS writer destination"
Chris@0 64
Chris@147 65 rm -f $audiopath/$outfile1
Chris@147 66 rm -f $audiopath/$outfile2
Chris@0 67
Chris@197 68 $r -t $transformdir/onsets.n3 $mandatory $infile1 $infile2 2>/dev/null || \
Chris@0 69 fail "Fails to run with $ctx"
Chris@0 70
Chris@150 71 check_json $audiopath/$outfile1 "$ctx"
Chris@150 72 check_json $audiopath/$outfile2 "$ctx"
Chris@0 73
Chris@0 74
Chris@200 75 ctx="onsets transform, two audio files, one-file JAMS writer"
Chris@0 76
Chris@200 77 $r -t $transformdir/onsets.n3 $mandatory --jams-one-file $tmpjson $infile1 $infile2 2>/dev/null || \
Chris@152 78 fail "Fails to run with $ctx"
Chris@150 79
Chris@152 80 check_json $tmpjson "$ctx"
Chris@150 81
Chris@150 82
Chris@200 83 ctx="onsets transform, two audio files, stdout JAMS writer"
Chris@150 84
Chris@200 85 $r -t $transformdir/onsets.n3 $mandatory --jams-stdout $infile1 $infile2 2>/dev/null >$tmpjson || \
Chris@0 86 fail "Fails to run with $ctx"
Chris@0 87
Chris@150 88 check_json $tmpjson "$ctx"
Chris@0 89
Chris@0 90
Chris@200 91 ctx="onsets transform, one audio file, many-files JAMS writer"
Chris@0 92
Chris@147 93 rm -f $audiopath/$outfile3
Chris@0 94
Chris@200 95 $r -t $transformdir/onsets.n3 $mandatory --jams-many-files $infile1 2>/dev/null || \
Chris@0 96 fail "Fails to run with $ctx"
Chris@0 97
Chris@150 98 check_json $audiopath/$outfile3 "$ctx"
Chris@0 99
Chris@0 100
Chris@200 101 ctx="onsets transform, two audio files, many-files JAMS writer"
Chris@0 102
Chris@147 103 rm -f $audiopath/$outfile3
Chris@147 104 rm -f $audiopath/$outfile5
Chris@0 105
Chris@200 106 $r -t $transformdir/onsets.n3 $mandatory --jams-many-files $infile1 $infile2 2>/dev/null || \
Chris@0 107 fail "Fails to run with $ctx"
Chris@0 108
Chris@150 109 check_json $audiopath/$outfile3 "$ctx"
Chris@150 110 check_json $audiopath/$outfile5 "$ctx"
Chris@0 111
Chris@0 112
Chris@200 113 ctx="onsets and df transforms, two audio files, many-files JAMS writer"
Chris@0 114
Chris@147 115 rm -f $audiopath/$outfile3
Chris@147 116 rm -f $audiopath/$outfile4
Chris@147 117 rm -f $audiopath/$outfile5
Chris@147 118 rm -f $audiopath/$outfile6
Chris@0 119
Chris@200 120 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 $mandatory --jams-many-files $infile1 $infile2 2>/dev/null || \
Chris@0 121 fail "Fails to run with $ctx"
Chris@0 122
Chris@150 123 check_json $audiopath/$outfile3 "$ctx"
Chris@150 124 check_json $audiopath/$outfile4 "$ctx"
Chris@150 125 check_json $audiopath/$outfile5 "$ctx"
Chris@150 126 check_json $audiopath/$outfile6 "$ctx"
Chris@147 127
Chris@147 128
Chris@147 129 ctx="output base directory"
Chris@147 130
Chris@147 131 rm -f ./$outfile1
Chris@147 132
Chris@200 133 $r -t $transformdir/onsets.n3 -t $transformdir/detectionfunction.n3 $mandatory --jams-basedir . $infile1 2>/dev/null || \
Chris@147 134 fail "Fails to run with $ctx"
Chris@147 135
Chris@150 136 check_json ./$outfile1 "$ctx"
Chris@147 137
Chris@147 138
Chris@147 139 ctx="output base directory and many-files"
Chris@147 140
Chris@147 141 rm -f ./$outfile3
Chris@147 142 rm -f ./$outfile5
Chris@147 143
Chris@200 144 $r -t $transformdir/onsets.n3 $mandatory --jams-basedir . --jams-many-files $infile1 $infile2 2>/dev/null || \
Chris@147 145 fail "Fails to run with $ctx"
Chris@147 146
Chris@150 147 check_json ./$outfile3 "$ctx"
Chris@150 148 check_json ./$outfile5 "$ctx"
Chris@147 149
Chris@147 150
Chris@147 151 ctx="nonexistent output base directory"
Chris@147 152
Chris@200 153 $r -t $transformdir/onsets.n3 $mandatory --jams-basedir ./DOES_NOT_EXIST $infile1 2>/dev/null && \
Chris@147 154 fail "Fails with $ctx by completing successfully (should refuse and bail out)"
Chris@0 155
Chris@0 156
Chris@200 157 ctx="existing output file and no --jams-force"
Chris@0 158
Chris@147 159 touch $audiopath/$outfile1
Chris@0 160
Chris@197 161 $r -t $transformdir/onsets.n3 $mandatory $infile1 2>/dev/null && \
Chris@0 162 fail "Fails by completing successfully when output file already exists (should refuse and bail out)"
Chris@0 163
Chris@0 164
Chris@200 165 ctx="existing output file and --jams-force"
Chris@0 166
Chris@147 167 touch $audiopath/$outfile1
Chris@0 168
Chris@200 169 $r -t $transformdir/onsets.n3 $mandatory --jams-force $infile1 2>/dev/null || \
Chris@0 170 fail "Fails to run with $ctx"
Chris@0 171
Chris@150 172 check_json $audiopath/$outfile1 "$ctx"
Chris@0 173
Chris@0 174
Chris@0 175 exit 0