3 # Sample rate conversion tests. Create a 20s sweep at the input sampling rate,
4 # then use each resampler to convert it to the output rate. Display the results
5 # in a PNG file for each conversion.
7 # Set up the following two before running the script:
8 SOX
=.
/sox
# The actual sox executable
9 SSRC_PATH
=/usr
/local
/bin
# Path to the two ssrc executables
15 IN
=/tmp
/$BASE-in-$$.wav
16 OUT
=/tmp
/$BASE-out-$$.wav
17 TIME
=/tmp
/$BASE-time-$$.wav
22 $SOX -r $1 -n -twavpcm $IN synth
20 sin
0:$max sin
$max:0 gain
-2
31 ssrc
*) time -f %U
-o $TIME $SSRC_PATH/$src --quiet --rate $2 $IN $OUT;;
32 *) time -f %U
-o $TIME $SOX $IN -r $2 $OUT $src;;
35 $SOX $OUT -n spectrogram \
36 -X 30 -z $RANGE -w kaiser \
37 -t "$1->$2: $src" -c "${t}s user time" \
38 -o "$1_$2_`echo $src | tr ' ' '_'`.png"
41 rm -f $IN $OUT $TIME # Clean up
44 test_converters
11025 48000
45 test_converters
22000 96100
46 test_converters
44100 96000
47 test_converters
96000 44100
48 test_converters
96000 8000 # rabbit 0.1.3 hangs, 0.1.4 is okay