2022-08-03 22:10:19 +00:00
|
|
|
#!/usr/bin/env bash
|
2016-03-23 05:33:14 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# SoX Resampler Library Copyright (c) 2007-15 robs@users.sourceforge.net
|
|
|
|
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
|
|
|
|
|
|
|
# Tests rate conversion time for qualities 0..7 & variable-rate.
|
|
|
|
|
|
|
|
tool=./3-options-input-fn
|
|
|
|
ext=f32; e=0
|
2022-08-03 22:10:19 +00:00
|
|
|
test z"$1" != z && c="$1" || c=2
|
|
|
|
test z"$2" != z && qs="$2" || qs="`seq 0 7` v"
|
2016-03-23 05:33:14 +00:00
|
|
|
rates="48000 77773 96000"
|
2022-08-03 22:10:19 +00:00
|
|
|
time=`which time`
|
|
|
|
BASE=`basename $0`
|
|
|
|
TIME=/tmp/$BASE-time-$$
|
|
|
|
ERR=/tmp/$BASE-err-$$
|
|
|
|
uname -m |grep -q ^arm && len=60 || len=600
|
|
|
|
export OMP_NUM_THREADS=2
|
2016-03-23 05:33:14 +00:00
|
|
|
|
|
|
|
for rate0 in $rates; do
|
2022-08-03 22:10:19 +00:00
|
|
|
rate1=44100
|
|
|
|
rate2=$rate0
|
2016-03-23 05:33:14 +00:00
|
|
|
for n in 1 2; do
|
2022-08-03 22:10:19 +00:00
|
|
|
sox -R -r $rate1 -n -c $c 0.$ext synth $len noise; sync
|
|
|
|
for q in $qs; do
|
|
|
|
test $q = v && Q="4 20" || Q=$q
|
|
|
|
$time -f %e -o $TIME $tool $rate1 $rate2 $c $e $e $Q < 0.$ext > /dev/null 2> $ERR
|
|
|
|
echo $rate1 '-->' $rate2 c=$c q=$q t=`cat $TIME` `cat $ERR | sed 's/.*(/(/'`
|
2016-03-23 05:33:14 +00:00
|
|
|
done
|
2022-08-03 22:10:19 +00:00
|
|
|
rate1=$rate0
|
|
|
|
rate2=44100
|
2016-03-23 05:33:14 +00:00
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
rm 0.$ext
|