mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-10 16:43:33 +02:00
Upgrade libsoxr to 0.1.3
This commit is contained in:
57
lib-src/libsoxr/tests/io-test
Normal file → Executable file
57
lib-src/libsoxr/tests/io-test
Normal file → Executable file
@@ -1,40 +1,65 @@
|
||||
#!/bin/bash
|
||||
# SoX Resampler Library Copyright (c) 2007-13 robs@users.sourceforge.net
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# SoX Resampler Library Copyright (c) 2007-16 robs@users.sourceforge.net
|
||||
# Licence for this file: LGPL v2.1 See LICENCE for details.
|
||||
|
||||
ir=96000
|
||||
# Tests IO
|
||||
|
||||
|
||||
|
||||
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
|
||||
w=$(echo -e "`sox --ver |sed 's/.*SoX v//'` d\n14.4.1 k"|sort -Vr|head -1|sed 's/.* //')
|
||||
|
||||
types=(f32 f64 s32 s16)
|
||||
|
||||
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 -z180 -o io$n$c.png
|
||||
it=${types[$1]}; ot=${types[`expr $2 % 4 || true`]}
|
||||
$tool $ir $or $c $1 $2 $3 < $c.$it > a.$ot
|
||||
sox -r $or -c $c a.$ot -n spectrogram -X50 -hw$w -z${zs[$n]} -o io$c$n-$w.png -c "io-test i:$it o:$ot ($2) q:$3"
|
||||
./4-split-channels $ir $or $c $1 $2 $3 < $c.$it > b.$ot
|
||||
[ $2 != 3 ] && cmp a.$ot b.$ot ||
|
||||
test $(sox -mv-1 -r$or -c$c a.$ot -r$or -c$c b.$ot -n stats 2>&1 |grep Pk\ l|tr ' ' '\n'|grep '[0-9]'|uniq) = -84.29
|
||||
rm [ab].$ot
|
||||
n=`expr $n + 1`
|
||||
}
|
||||
|
||||
rm io??.png
|
||||
|
||||
j=2; test z$1 != z && j=$1
|
||||
test z$1 != z && j=$1 || j=1
|
||||
|
||||
for c in `seq 1 $j`; do
|
||||
for n in `seq 0 3`; do
|
||||
sox -r $ir -n $c.${types[$n]} synth $len sin $f gain -.1
|
||||
sox -R -r $ir -n $c.${types[$n]} synth $len sin $f gain -.1
|
||||
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]
|
||||
|
||||
|
||||
|
||||
# Check conversion between differing I/O types, but no rate-change:
|
||||
|
||||
for i in 1 2 3; do
|
||||
prev=""
|
||||
sox -n -c $i 0.f32 synth $len gain -.1
|
||||
$tool 1 1 $i 0 2 < 0.f32 | $tool 1 1 $i 2 0 > 1.f32
|
||||
cmp [01].f32
|
||||
done
|
||||
rm *.f32
|
||||
|
Reference in New Issue
Block a user