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