annotate tests/test-multiple-audio/test-multiple-audio.sh @ 269:39fb206b1153 piper-nopiper

Filter out Xing/LAME info frames, rather than letting them go to the mp3 decoder as if they were audio frames. Fixes the 1152-sample zero pad at start of some decoded mp3 files (distinct from decoder delay). The logic here is based on the madplay code.
author Chris Cannam
date Thu, 24 Nov 2016 13:32:04 +0000
parents 090b26a4d050
children 5db279f1e0f8
rev   line source
Chris@103 1 #!/bin/bash
Chris@103 2
Chris@119 3 . ../include.sh
Chris@103 4
Chris@233 5 tmpfile1=$mypath/tmp_1_$$
Chris@233 6 tmpfile2=$mypath/tmp_2_$$
Chris@103 7
Chris@233 8 trap "rm -f $tmpfile1 $tmpfile2" 0
Chris@103 9
Chris@119 10 transform=$mypath/transforms/detectionfunction.n3
Chris@103 11
Chris@117 12 urlbase=http://vamp-plugins.org/sonic-annotator/testfiles
Chris@117 13
Chris@233 14 have_network=yes
Chris@234 15 if ! ping -c 1 8.8.8.8 2>/dev/null 1>&2 ; then
Chris@233 16 echo "(network appears unavailable, skipping networking tests)"
Chris@233 17 have_network=no
Chris@233 18 fi
Chris@233 19
Chris@117 20
Chris@117 21 # 1. Recursive local directory
Chris@117 22
Chris@103 23 # Note, the output here depends on all the audio files present -- we
Chris@111 24 # would have to regenerate it if we added more test audio files. Note
Chris@111 25 # that the -r flag is not supposed to pick up playlist files, only
Chris@111 26 # audio files
Chris@233 27 $r -t $transform -w csv --csv-stdout -r --summary-only $audiopath > $tmpfile1 2>/dev/null || \
Chris@103 28 fail "Fails to run transform $transform with recursive dir option"
Chris@103 29
Chris@119 30 expected=$mypath/expected/all-files
Chris@233 31 csvcompare $tmpfile1 $expected.csv || \
Chris@243 32 faildiff "Output mismatch for transform $transform with summaries and recursive dir option" $tmpfile1 $expected.csv
Chris@103 33
Chris@117 34
Chris@117 35 # 2. Local playlist file referring to local audio files
Chris@117 36
Chris@117 37 # Here we strip any leading path from the audio file in the output,
Chris@103 38 # because the playlist reader will have resolved files to absolute
Chris@103 39 # paths and those will differ between systems
Chris@233 40 $r -t $transform -w csv --csv-stdout $audiopath/playlist.m3u --summary-only 2>/dev/null > "$tmpfile2" || \
Chris@103 41 fail "Fails to run transform $transform with playlist input"
Chris@103 42
Chris@233 43 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
Chris@233 44
Chris@119 45 expected=$mypath/expected/playlist
Chris@233 46 csvcompare $tmpfile1 $expected.csv || \
Chris@233 47 faildiff "Output mismatch for transform $transform with summaries and playlist input" $tmpfile1 $expected.csv
Chris@103 48
Chris@117 49
Chris@117 50 # 3. Multiple files supplied directly on command line
Chris@117 51
Chris@117 52 # Strip paths again, just so we can use the same output comparison
Chris@117 53 # file as above
Chris@233 54 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
Chris@104 55 fail "Fails to run transform $transform with 2-file input"
Chris@103 56
Chris@233 57 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
Chris@233 58
Chris@119 59 expected=$mypath/expected/playlist
Chris@233 60 csvcompare $tmpfile1 $expected.csv || \
Chris@233 61 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile1 $expected.csv
Chris@103 62
Chris@104 63
Chris@125 64 # 4. Multiple files supplied directly on command line, with file: URL
Chris@125 65
Chris@233 66 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 file://`pwd`/$audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
Chris@125 67 fail "Fails to run transform $transform with 2-file input"
Chris@125 68
Chris@233 69 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
Chris@117 70
Chris@119 71 expected=$mypath/expected/playlist
Chris@233 72 csvcompare $tmpfile1 $expected.csv || \
Chris@233 73 faildiff "Output mismatch for transform $transform with summaries and 2-file input using file:// URL" $tmpfile1 $expected.csv
Chris@117 74
Chris@117 75
Chris@233 76 if [ "$have_network" = "yes" ]; then
Chris@117 77
Chris@233 78 # 5. Remote playlist file referring to remote audio files
Chris@117 79
Chris@233 80 $r -t $transform -w csv --csv-stdout $urlbase/playlist.m3u --summary-only 2>/dev/null > $tmpfile2 || \
Chris@233 81 fail "Fails to run transform $transform with remote playlist input"
Chris@117 82
Chris@233 83 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
Chris@117 84
Chris@233 85 expected=$mypath/expected/playlist
Chris@233 86 csvcompare $tmpfile1 $expected.csv || \
Chris@233 87 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile1 $expected.csv
Chris@117 88
Chris@117 89
Chris@233 90 # 6. Local playlist file referring to mixture of remote and local audio files
Chris@117 91
Chris@233 92 $r -t $transform -w csv --csv-stdout $audiopath/remote-playlist.m3u --summary-only 2>/dev/null > $tmpfile2 || \
Chris@233 93 fail "Fails to run transform $transform with playlist of remote files"
Chris@117 94
Chris@233 95 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
Chris@117 96
Chris@233 97 expected=$mypath/expected/playlist
Chris@233 98 csvcompare $tmpfile1 $expected.csv || \
Chris@233 99 faildiff "Output mismatch for transform $transform with summaries and remote playlist input" $tmpfile1 $expected.csv
Chris@117 100
Chris@117 101
Chris@233 102 # 7. Multiple remote files supplied directly on command line
Chris@233 103
Chris@233 104 $r -t $transform -w csv --csv-stdout $urlbase/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
Chris@233 105 fail "Fails to run transform $transform with 2-file remote input"
Chris@233 106
Chris@233 107 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
Chris@233 108
Chris@233 109 expected=$mypath/expected/playlist
Chris@233 110 csvcompare $tmpfile1 $expected.csv || \
Chris@233 111 faildiff "Output mismatch for transform $transform with summaries and 2-file input" $tmpfile1 $expected.csv
Chris@233 112
Chris@233 113
Chris@233 114 # 8. Mixture of remote and local files supplied on command line
Chris@233 115
Chris@233 116 $r -t $transform -w csv --csv-stdout $audiopath/3clicks.mp3 $urlbase/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
Chris@233 117 fail "Fails to run transform $transform with 2-file remote input"
Chris@233 118
Chris@233 119 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
Chris@233 120
Chris@233 121 expected=$mypath/expected/playlist
Chris@233 122 csvcompare $tmpfile1 $expected.csv || \
Chris@233 123 faildiff "Output mismatch for transform $transform with summaries and mixed local/remote 2-file input" $tmpfile1 $expected.csv
Chris@233 124
Chris@233 125 fi
Chris@218 126
Chris@218 127 # 9. As 3, but multiplexing rather than extracting separately from each file
Chris@218 128
Chris@233 129 $r -t $transform --multiplex -w csv --csv-stdout $audiopath/3clicks.mp3 $audiopath/6clicks.ogg --summary-only 2>/dev/null > $tmpfile2 || \
Chris@218 130 fail "Fails to run transform $transform with 2-file input"
Chris@218 131
Chris@233 132 cat "$tmpfile2" | sed 's,^"[^"]*/,",' > "$tmpfile1"
Chris@233 133
Chris@218 134 expected=$mypath/expected/multiplexed
Chris@233 135 csvcompare $tmpfile1 $expected.csv || \
Chris@233 136 faildiff "Output mismatch for transform $transform with summaries and 2-file multiplexed input" $tmpfile1 $expected.csv
Chris@218 137