Debian Codegraph @

debian/tests/beats-stretch

raw symbols SCIP
1 #!/bin/sh
2
3 # Author: Dennis Braun <[email protected]>
4 #
5 # This test stretches a beat from 119.9 BPM to 97 BPM
6 # and the BPM of the output file is tested by sox and bpm-tools.
7
8 set -e
9
10 bpm=97
11 regex="($bpm\.[0-4]{1,3})"
12
13 echo '(1/3) Copy beats.wav.gz from csound-doc and unpack the wav file'
14 cp /usr/share/doc/csound-doc/html/examples/beats.wav.gz .
15 gunzip -f beats.wav.gz
16
17 echo '(2/3) Stretch beats.wav from 119.9 BPM to' $bpm 'BPM'
18 soundstretch beats.wav beats_stretched.wav -bpm=$bpm
19
20 result=$(sox -V1 'beats_stretched.wav' -r 44100 -e float -c 1 -t raw - | bpm)
21
22 # Test the result
23 echo '(3/3) Check with sox and bpm-tools if the BPM is correct'
24 if echo "$result" | grep -Eq "$regex"; then
25 echo 'Successfully detected' "$result" 'BPM'
26 exit 0
27 else
28 echo 'Failed :( The result is' "$result" 'BPM, but it should be around' "$bpm" 'BPM'
29 exit 1
30 fi