#!/bin/bash INFILE=samples/bonjour.wav hr() { echo "$(printf "%0.s+" $(seq 80))" } hr echo "Running test_pyrnnoise.py" hr /usr/bin/env python3 test_pyrnnoise.py -vv || exit 1 out_orig=$(mktemp -t out_XXXXXXXX.wav) out_1=$(mktemp -t out_XXXXXXXX.wav) out_2=$(mktemp -t out_XXXXXXXX.wav) clean_exit() { rm $out_orig $out_1 $out_2 exit $1 } hr echo "Functionnal test of rnnoise module against Xiph demo program" hr if [ ! -f 'rnnoise_demo' ] then echo "Compiling rnnoise_demo" gcc -o rnnoise_demo rnnoise_demo.c -lrnnoise || clean_exit 12 fi echo "Running Xiph demo programm" python3 demo_orig.py "$INFILE" "$out_orig" || clean_exit 2 echo "Running demo.py" python3 demo.py "$INFILE" "$out_2" || clean_exit 3 if diff -rupN "$out_orig" "$out_2" then echo "demo.py [OK]" else echo "demo.py [fail]" fi echo "Running demo_iter.py" python3 demo_iter.py "$INFILE" "$out_1" || clean_exit 4 if diff -rupN "$out_orig" "$out_1" then echo "demo_iter.py [OK]" else echo "demo_iter.py [fail]" fi clean_exit 0