Debian Codegraph @

debian/tests/h2cli-convert

raw
1 #!/bin/sh
2
3 # Authors: Dennis Braun <[email protected]>
4 # Nicholas D Steeves <[email protected]>
5 #
6 # Test Hydrogen's h2song (xml) export-to-wav functionality, and test
7 # if the resulting wav file has the requested target bit depth and
8 # sampling rate. Note that a mediainfo tests extracts only metadata
9 # and does not actually analyse the file.
10
11 set -e
12
13 target_bit_depth=24
14 target_sampling_rate=96000
15
16 echo "Generate test.wav from GM_kit_Jazzy.h2song with a bit depth of
17 $target_bit_depth and a sampling rate of $target_sampling_rate Hz"
18 h2cli -s data/demo_songs/GM_kit_Jazzy.h2song \
19 -o test.wav -b $target_bit_depth -r $target_sampling_rate
20
21 echo 'Test the bit depth of test.wav...'
22 test_bit_depth=$(mediainfo --Inform="Audio;%BitDepth%" test.wav)
23 if [ "$test_bit_depth" -eq "$target_bit_depth" ]; then
24 echo "SUCCESS: Bit depth of $target_bit_depth confirmed."
25 else
26 echo "FAIL: Incorrect bit depth. ( wanted $target_bit_depth, got $test_bit_depth )"
27 exit 1;
28 fi
29 echo 'Test the sampling rate of test.wav...'
30 test_sampling_rate=$(mediainfo --Inform="Audio;%SamplingRate%" test.wav)
31 if [ "$test_sampling_rate" -eq "$target_sampling_rate" ]; then
32 echo "SUCCESS: Sampling rate of $target_sampling_rate confirmed"
33 exit 0;
34 else
35 echo "FAIL: Incorrect sampling rate. ( wanted $target_sampling_rate, got $test_sampling_rate )"
36 exit 1;
37 fi