Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/alexmarsev/soxr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Sykes <robs@users.sourceforge.net>2015-09-05 18:36:06 +0300
committerRob Sykes <robs@users.sourceforge.net>2015-09-05 18:36:06 +0300
commitba8d717a377cfeb0084d557f3af4d12967ecfda5 (patch)
tree89f91ad0ce635c2e518c08a65d0e2050a0fc38c4
parenta0ff3836927eb72b39d4d48c9c5d65b5f1be4114 (diff)
rework test scripts
-rwxr-xr-xtests/bandwidth-test13
-rwxr-xr-xtests/eg-test6
-rwxr-xr-xtests/io-test25
-rwxr-xr-xtests/large-ratio22
-rwxr-xr-xtests/large-ratio-test23
-rwxr-xr-xtests/phase-test40
-rwxr-xr-xtests/q-test46
-rwxr-xr-xtests/scripts13
-rwxr-xr-xtests/time-test35
9 files changed, 130 insertions, 93 deletions
diff --git a/tests/bandwidth-test b/tests/bandwidth-test
index 0e862de..47c2303 100755
--- a/tests/bandwidth-test
+++ b/tests/bandwidth-test
@@ -22,14 +22,15 @@ rate1n=`expr $rate1 / 2`
#sox -r $rate1 -n 0.$ext synth 1s sq pad .03 .03 gain -1
sox -r $rate1 -n 0.$ext synth 8 sin 0:$rate1n gain -1
-for q in `seq 79 5 99`; do
- f=bw1-$rate2-p`printf %02u $q`
- $tool $rate1 $rate2 1 $e $e 4 0 $q < 0.$ext | sox -c1 -r$rate2 -t $ext - -n $spec $f.png
+for pass in `seq 79 5 99`; do
+ f=bw1-$rate2-p`printf %02u $pass`
+ $tool $rate1 $rate2 1 $e $e 4 0 $pass < 0.$ext | sox -c1 -r$rate2 -t $ext - -n $spec $f.png -c "bw-test pass:$pass stop:100"
done
-for q in `seq 79 5 99`; do
- f=bw2-$rate2-p`printf %02u $q`
- $tool $rate1 $rate2 1 $e $e 4 0 $q `expr 200 - $q` < 0.$ext | sox -c1 -r$rate2 -t $ext - -n $spec $f.png
+for pass in `seq 79 5 99`; do
+ f=bw2-$rate2-p`printf %02u $pass`
+ stop=`expr 200 - $pass`
+ $tool $rate1 $rate2 1 $e $e 4 0 $pass $stop < 0.$ext | sox -c1 -r$rate2 -t $ext - -n $spec $f.png -c "bw-test pass:$pass stop:$stop"
done
r=$rate1; rate1=$rate2; rate2=$r
diff --git a/tests/eg-test b/tests/eg-test
index 7364065..58d085c 100755
--- a/tests/eg-test
+++ b/tests/eg-test
@@ -37,7 +37,11 @@ rm *.f32
# Exercise VR making sure that varied internal stage reconfigurations occur:
+variations=(slow-sweep fast-changing)
+signals=(sine-wave saw-tooth-wave)
for n in 0 1 2 3; do
- $vg ./5-variable-rate $n | sox -tf32 -r44100 -c1 - -n spectrogram -z130 -hwd -o v$n.png -X 50
+ signal=${signals[`expr $n % 2 || true`]}
+ variation=${variations[`expr $n / 2 || true`]}
+ $vg ./5-variable-rate $n | sox -tf32 -r44100 -c1 - -n spectrogram -z130 -hwd -o v$n.png -X 50 -c "variation:$variation signal:$signal"
vg=""
done
diff --git a/tests/io-test b/tests/io-test
index 360949f..a291c78 100755
--- a/tests/io-test
+++ b/tests/io-test
@@ -8,20 +8,20 @@ set -e
-ir=96000
+ir=65537
or=44100
len=16
-f=0+48k
-g=48k+0
-ex=./3-options-input-fn
+f=1/32768
+g=32768:0
+tool=./3-options-input-fn
types=(f32 f64 s32 s16)
-zs=(160 160 160 120 180 180 120 120)
+zs=(180 180 180 180 180 120 120 120 120)
do_one() {
- $ex $ir $or $c $1 $2 $3 < $c.${types[$1]} |
- sox -t ${types[$2]} -r $or -c $c - -n spectrogram -X50 -hwk -z${zs[$n]} -o io$c$n.png
+ $tool $ir $or $c $1 $2 $3 < $c.${types[$1]} |
+ sox -t ${types[`expr $2 % 4`]} -r $or -c $c - -n spectrogram -X50 -hwk -z${zs[$n]} -o io$c$n.png -c "io-test i:${types[$1]} o:${types[`expr $2 % 4`]} ($2) q:$3"
n=`expr $n + 1`
}
@@ -33,14 +33,15 @@ for c in `seq 1 $j`; do
done
n=0
- for m in `seq 0 3`; do do_one $m $m 4; done
do_one 1 2 5
do_one 2 0 5
- do_one 3 2 4
- do_one 0 3 4
+ for m in `seq 0 3`; do do_one $m $m 5; done
+ do_one 3 2 3
+ do_one 0 3 3
+ do_one 0 11 3
f="$f sin $g"
- g=48k:0
+ g=0+32768
done
rm ?.[sf][0-9][0-9]
@@ -52,7 +53,7 @@ rm ?.[sf][0-9][0-9]
for i in 1 2 3; do
prev=""
sox -n -c $i 0.f32 synth $len gain -.1
- $ex 1 1 $i 0 2 < 0.f32 | $ex 1 1 $i 2 0 > 1.f32
+ $tool 1 1 $i 0 2 < 0.f32 | $tool 1 1 $i 2 0 > 1.f32
cmp [01].f32
done
rm *.f32
diff --git a/tests/large-ratio b/tests/large-ratio
deleted file mode 100755
index a12bda9..0000000
--- a/tests/large-ratio
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-# SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
-# Licence for this file: LGPL v2.1 See LICENCE for details.
-
-# Warning: the intermediate signal (piped) is 3.2 Gbytes so may slug the
-# system somewhat.
-
-ex=../examples/3-options-input-fn
-q=6
-r=1e5
-
-rm lr.png
-
-../tests/vector-gen 1000 0 8 500 .9375 1.s32
-
-$ex 1 $r 1 2 1 $q < 1.s32 | $ex $r 1 1 1 2 $q > 2.s32
-
-sox -M -r 1k 1.s32 -r 1k 2.s32 -n spectrogram -hwk -z180 -o lr.png
-
-display lr.png &
-
-rm [12].s32
diff --git a/tests/large-ratio-test b/tests/large-ratio-test
new file mode 100755
index 0000000..64f1789
--- /dev/null
+++ b/tests/large-ratio-test
@@ -0,0 +1,23 @@
+#!/bin/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 interpolating then decimating be the same, large ratio.
+
+tool=../examples/3-options-input-fn
+q=6
+ratio=2e4
+srate=8000
+nrate=`expr $srate / 2`
+
+rm -f lr.png
+
+../tests/vector-gen $srate 0 8 $nrate .9375 1.s32
+
+$tool 1 $ratio 1 2 1 $q < 1.s32 | $tool $ratio 1 1 1 2 $q > 2.s32
+
+sox -M -r $srate -c1 1.s32 -r $srate -c1 2.s32 -n spectrogram -hwd -Z-10 -z180 -o lr.png -c "large-ratio-test q:$q ratio:$ratio"
+
+rm [12].s32
diff --git a/tests/phase-test b/tests/phase-test
index a3d87bb..4c491d8 100755
--- a/tests/phase-test
+++ b/tests/phase-test
@@ -6,31 +6,33 @@ set -e
# Tests varying phase-response.
-
-
tool=./3-options-input-fn
-
-spec="spectrogram -z160 -Z-20 -wd -ho"
+spec="spectrogram -z160 -Z-20 -X 2000 -wd -ho"
ext=f32; e=0
rate1=48000
rate2=44100
for n in 1 2; do
-
-sox -r $rate1 -n 0.$ext synth 1s sq pad .03 .03 gain -1
-
-for q in `seq 0 7`; do
- f=ph-$rate2-q$q
- $tool $rate1 $rate2 1 $e $e $q'6' < 0.$ext | sox -c1 -r$rate2 -t $ext - -n $spec $f.png -X 2000
-done
-
-for q in `seq 0 10`; do
- f=ph-$rate2-p`printf %02u $q`
- $tool $rate1 $rate2 1 $e $e 46 0 0 0 $q'0' < 0.$ext | sox -c1 -r$rate2 -t $ext - -n $spec $f.png -X 2000
-done
-
-r=$rate1; rate1=$rate2; rate2=$r
-
+ sox -r $rate1 -n 0.$ext synth 1s sq pad .03 .03 gain -1
+
+ # Test the following combinations:
+ names=(linear-phase intermediate-phase maximum-phase minimum-phase)
+ filters=(standard-filter steep-filter)
+
+ for q in `seq 0 7`; do
+ f=ph-$rate2-q$q
+ name=${names[`expr $q % 4 || true`]}
+ filter=${filters[`expr $q / 4 || true`]}
+ $tool $rate1 $rate2 1 $e $e $q'6' < 0.$ext | sox -c1 -r$rate2 -t $ext - -n $spec $f.png -c "ph-test $filter $name"
+ done
+
+ # Test specific phase-response percentages:
+ for q in `seq 0 20 100`; do
+ f=ph-$rate2-p`printf %03u $q`
+ $tool $rate1 $rate2 1 $e $e 46 0 0 0 $q < 0.$ext | sox -c1 -r$rate2 -t $ext - -n $spec $f.png -c "ph-test phase:${q}%"
+ done
+
+ r=$rate1; rate1=$rate2; rate2=$r
done
rm 0.$ext
diff --git a/tests/q-test b/tests/q-test
index 7c6b3d1..7a0f0a2 100755
--- a/tests/q-test
+++ b/tests/q-test
@@ -4,24 +4,19 @@ 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 and generates spectrograms for
-# qualities 0..7 & variable-rate.
+# Tests conversion qualities 0..7 & variable-rate.
tool=./3-options-input-fn
-
ext=f64; e=1
c=1
q1=0; q2=7
-
rates=48000
-rates="48000 77773 96000"
-
-z=(50 87 87 87 111 135 159 180 95)
+zs=(50 87 87 87 111 135 159 180 95)
zz() {
- echo "spectrogram -z${z[$1]} -Z-30 -wd -ho"
+ echo "spectrogram -z${zs[$1]} -Z-30 -wd -ho"
}
for rate0 in $rates; do
@@ -35,32 +30,17 @@ rate1n=`expr $rate1 / 2`
-# Measure time to convert a 5-minute file:
-
-#: << :
-sox -r $rate1 -n -c $c 0.$ext synth 5: sin 0:$rate1n gain -1
-
-for q in `seq $q1 $q2`; do
- echo $rate1 '-->' $rate2 c=$c q=$q
- time $tool $rate1 $rate2 $c $e $e $q < 0.$ext > /dev/null;
-done
-echo $rate1 '-->' $rate2 c=$c q=v
-time $tool $rate1 $rate2 $c $e $e 4 20 < 0.$ext > /dev/null
-:
-
-
-
# Convert sweep, for spectrogram:
sox -r $rate1 -n -c $c 0.$ext synth 8 sin 0:$rate1n gain -1
for q in `seq $q1 $q2`; do
- f=q$rate1-$rate2-a-$q
- $tool $rate1 $rate2 $c $e $e $q 0 < 0.$ext | sox -c$c -r$rate2 -t $ext - -n $(zz $q) $f.png
+ f=qa-$rate1-$rate2-$q
+ $tool $rate1 $rate2 $c $e $e $q 0 < 0.$ext | sox -c$c -r$rate2 -t $ext - -n $(zz $q) $f.png -c $f
done
q=8
-f=q$rate1-$rate2-a-v
-$tool $rate1 $rate2 $c $e $e 4 20 < 0.$ext | sox -c$c -r$rate2 -t $ext - -n $(zz $q) $f.png
+f=qa-$rate1-$rate2-v
+$tool $rate1 $rate2 $c $e $e 4 20 < 0.$ext | sox -c$c -r$rate2 -t $ext - -n $(zz $q) $f.png -c $f
@@ -70,17 +50,17 @@ $tool $rate1 $rate2 $c $e $e 4 20 < 0.$ext | sox -c$c -r$rate2 -t $ext - -n $(zz
sox -r $rate1 -n 0.$ext synth 1s sq pad .03 .03 gain -1
for q in `seq $q1 $q2`; do
- f=q$rate1-$rate2-b-$q
- $tool $rate1 $rate2 1 $e $e $q 0 < 0.$ext | sox -c1 -r$rate2 -t $ext - $f.wav $(zz $q) $f.png -X 2000
+ f=qb-$rate1-$rate2-$q
+ $tool $rate1 $rate2 1 $e $e $q 0 < 0.$ext | sox -c1 -r$rate2 -t $ext - $f.wav
done
q=8
-f=q$rate1-$rate2-b-v
-$tool $rate1 $rate2 1 $e $e 4 20 < 0.$ext | sox -c1 -r$rate2 -t $ext - $f.wav $(zz $q) $f.png -X 2000
+f=qb-$rate1-$rate2-v
+$tool $rate1 $rate2 1 $e $e 4 20 < 0.$ext | sox -c1 -r$rate2 -t $ext - $f.wav
# Combine impuse responses into multi-channel file (for inspection in Audacity):
-sox -M q$rate1-$rate2-b-?.wav q$rate1-$rate2.wav
+sox -M qb-$rate1-$rate2-?.wav q$rate1-$rate2.wav
-rm q$rate1-$rate2-b-?.wav
+rm qb-$rate1-$rate2-?.wav
:
rate1=44100
diff --git a/tests/scripts b/tests/scripts
new file mode 100755
index 0000000..f245919
--- /dev/null
+++ b/tests/scripts
@@ -0,0 +1,13 @@
+#!/bin/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/bandwidth-test
+../../tests/eg-test
+../../tests/io-test
+../../tests/large-ratio-test
+../../tests/phase-test
+../../tests/q-test
+../../tests/time-test
diff --git a/tests/time-test b/tests/time-test
new file mode 100755
index 0000000..e8904b3
--- /dev/null
+++ b/tests/time-test
@@ -0,0 +1,35 @@
+#!/bin/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
+c=2
+q1=0; q2=7
+rates="48000 77773 96000"
+
+for rate0 in $rates; do
+ rate1=$rate0
+ rate2=44100
+ for n in 1 2; do
+ rate1n=`expr $rate1 / 2`
+ sox -r $rate1 -n -c $c 0.$ext synth 5: sin 0:$rate1n gain -1
+
+ for q in `seq $q1 $q2`; do
+ echo $rate1 '-->' $rate2 c=$c q=$q
+ time $tool $rate1 $rate2 $c $e $e $q < 0.$ext > /dev/null;
+ done
+
+ echo $rate1 '-->' $rate2 c=$c q=v
+ time $tool $rate1 $rate2 $c $e $e 4 20 < 0.$ext > /dev/null
+
+ rate1=44100
+ rate2=$rate0
+ done
+done
+
+rm 0.$ext