File: time-test

package info (click to toggle)
libsoxr 0.1.3-4.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 840 kB
  • sloc: ansic: 8,011; sh: 284; cpp: 40; makefile: 13
file content (36 lines) | stat: -rwxr-xr-x 953 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
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
test z"$1" != z && c="$1" || c=2
test z"$2" != z && qs="$2" || qs="`seq 0 7` v"
rates="48000 77773 96000"
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

for rate0 in $rates; do
	rate1=44100
	rate2=$rate0
	for n in 1 2; do
		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/.*(/(/'`
		done
		rate1=$rate0
		rate2=44100
	done
done

rm 0.$ext