soxr-code/tests/phase-test

37 lines
752 B
Bash
Executable File

#!/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 varying phase-response.
tool=./3-options-input-fn
spec="spectrogram -z160 -Z-20 -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
done
rm 0.$ext