sox.1: fix example for mcompand
[sox.git] / src / test-srcs
blob59fe1b3797229940597b9905bcd6f0e1bf4d028e
1 #!/bin/sh
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
11 RANGE=180
13 # Temporary files
14 BASE=`basename $0`
15 IN=/tmp/$BASE-in-$$.wav
16 OUT=/tmp/$BASE-out-$$.wav
17 TIME=/tmp/$BASE-time-$$.wav
19 test_converters () {
20 # Create input file
21 max=`expr $1 / 2`
22 $SOX -r $1 -n -twavpcm $IN synth 20 sin 0:$max sin $max:0 gain -2
23 for src in \
24 "rate -h" \
25 "rate -v" \
26 "ssrc" \
27 "ssrc_hp" \
28 ; do
29 echo $src
30 case "$src" in
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;;
33 esac
34 t=`cat $TIME`
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"
39 done
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