File: phase-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 (39 lines) | stat: -rwxr-xr-x 1,179 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
37
38
39
#!/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 varying phase-response.

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/.* //')
spec="spectrogram -z160 -Z-20 -X 2000 -w$w -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

	# 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-$w
		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`-$w
		$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