#!/bin/sh # Rudimentary tests for audio utility programs # $Id: txxxAudio,v 1.9 1996/08/19 AFsp-V2R1 $ AUDIOPATH=audiofiles export AUDIOPATH CA=../bin/CompAudio CP=../bin/CopyAudio FA=../bin/FiltAudio RS=../bin/ResampAudio $CP --version $CA --version $FA --version $RS --version echo "" echo "========== CopyAudio: deliberate error:" $CP -s 10000 -D float --chanA="0.5*A +B" -cB "0.5A" 2>&1 echo "" echo "========== CopyAudio: scale by 2, scale by 0.5, expect File A = File B" # scale and cross channels $CP -Dfloat --chanA "0.5*B" -cB"2*A" addf8.au addf8.au xx.au echo "------" # test gain expression and channel extraction $CP --chanA="B - 0.5*B" xx.au yy.au echo "------" $CA addf8.au yy.au rm -rf xx.au yy.au echo "" echo "========== CopyAudio: apply mu-law, expect max diff 254" $CP -D mu-law addf8.au xx.au echo "------" $CA addf8.au xx.au echo "" echo "========== CopyAudio: apply mu-law again, expect File A = File B" $CP -D mu-law xx.au yy.au echo "------" $CA xx.au yy.au rm -rf xx.au yy.au echo "" echo "========== CopyAudio: headerless output, expect File A = File B" $CP -D float -F raw_big-endian addf8.au xx.au echo "------" $CA --param="float,0,,big-endian,," addf8.au xx.au rm -rf xx.au cat > fx5.cof << EoF !FIR - Nyquist Filter ! Zero crossing interval: 5 ! Stopband: Frequency Weight ! 0.11250 1.000 ! 0.50000 10.00 0.000000E+00 1.044477E-01 1.531728E-01 1.443447E-01 9.213434E-02 0.000000E+00 -1.049936E-01 -1.898603E-01 -2.155646E-01 -1.553697E-01 0.000000E+00 2.328272E-01 5.034337E-01 7.559171E-01 9.353607E-01 1.000000E+00 9.353607E-01 7.559171E-01 5.034337E-01 2.328272E-01 0.000000E+00 -1.553697E-01 -2.155646E-01 -1.898603E-01 -1.049936E-01 0.000000E+00 9.213434E-02 1.443447E-01 1.531728E-01 1.044477E-01 0.000000E+00 EoF echo "" echo "-------- ALL - FIR, expect File A = File B" cat > f.cof << EoF !FIR 2 1 .5 EoF cat > a.cof << EoF !ALL 2 1 .5 EoF $FA -D float -f f.cof addf8.au tx1.au rm -rf f.cof echo "" $FA -f a.cof tx1.au tx2.au rm -f tx1.au a.cof echo "" $CA addf8.au tx2.au rm -f tx2.au echo "-------- FIR x5 x1 x(1/5), expect File A = File B" cat > fx1.cof << EoF !FIR 0 1 0 EoF $FA -i5 -f fx1.cof addf8.au tx5.au echo "" $FA -f fx5.cof tx5.au tx5s1.au rm -rf tx5.au echo "" $FA -i 1/5 -f fx1.cof tx5s1.au tx5s5.au rm -rf tx5s1.au echo "" $CA addf8.au tx5s5.au rm -rf tx5s5.au fx1.cof echo "-------- FIR (5/5), expect File A = File B" $FA -i5/5 -f fx5.cof addf8.au tx5s5.au echo "" $CA addf8.au tx5s5.au rm -f tx5s5.au echo "-------- FIR x5 x1 x(1/5), expect File A = File B" cat > fx1.cof << EoF !FIR 0 1 0 EoF $FA -i5 -f fx1.cof addf8.au tx5.au echo "" $FA -f fx5.cof tx5.au tx5s1.au rm -rf tx5.au echo "" $FA -i 1/5 -f fx1.cof tx5s1.au tx5s5.au rm -rf tx5s1.au echo "" $CA addf8.au tx5s5.au rm -rf tx5s5.au fx1.cof echo "-------- FIR x5 x(1/5), expect File A = File B" cat > fs5.cof << EoF !FIR - Ideal filter, but shifted 0 0 0 1 0 0 0 EoF $FA --interpolate=5 -f fx5.cof addf8.au tx5.au rm -f fx5.cof echo "" $FA --interp=1/5 -f fs5.cof tx5.au tx1.au echo "" $CA addf8.au tx1.au rm -r fs5.cof tx5.au tx1.au echo "-------- IIR, expect File A = File B" cat > fi1.cof << EoF !IIR 1 .5 .25 0 0 EoF cat > fi2.cof << EoF !IIR 1 0 0 .5 .25 EoF $FA -D float -f fi1.cof addf8.au tx1.au echo "" rm -rf fi1.cof $FA -f fi2.cof tx1.au tx2.au rm -rf fi2.cof tx1.au echo "" $CA addf8.au tx2.au 2>&1 rm -rf tx2.au echo "" echo "========== ResampAudio: +Delay, then -Delay" $RS -i 1 -a -0.5 addf8.au xxx.au $RS -i 1 -a -0.5 -f ratio=11 addf8.au xxxa.au $CA xxx.au xxxa.au $RS -i 1 -a +0.5 xxx.au yyy.au $CA addf8.au yyy.au 2>&1 # Number of samples differ rm -f xxx.au xxxa.au yyy.au echo "" echo "========== ResampAudio: copy operation" $RS -i 1 addf8.au xxx.au $CA addf8.au xxx.au rm -f xxx.au echo "" echo "========== ResampAudio: 8000 -> 8001 -> 8000" $RS -s 8001 addf8.au xxx.au $RS -s 8000 xxx.au yyy.au $CA addf8.au yyy.au rm -f xxx.au yyy.au echo "" echo "========== ResampAudio: 8000 -> 48000 -> 8000" $RS -s 48000 -f write=temp.cof addf8.au xxxa.au cat temp.cof $RS -s 48000 -f file=temp.cof,ratio=6 addf8.au xxxb.au $CA xxxa.au xxxb.au $RS -s 8000 xxxa.au zzz.au $CA addf8.au zzz.au rm -f temp.cof xxxa.au xxxb.au zzz.au