fixed a few noise related tests.

This commit is contained in:
Weird Constructor 2021-07-17 10:03:10 +02:00
parent 107f3521cc
commit 4291fd2602
3 changed files with 20 additions and 14 deletions

View file

@ -98,7 +98,8 @@ filter use the "12s" variants.
NO 12c - Notch Hal Chamberlin state variable filter (12dB)
The (Andrew) Simper state variable filter is a newer design
and stable up to 22kHz at 44.1kHz sampling rate.
and stable up to 22kHz at 44.1kHz sampling rate. It's overall more precise
and less quirky than the Hal Chamberlin SVF.
LP 12s - Low-pass Simper state variable filter (12dB)
HP 12s - High-pass Simper state variable filter (12dB)

View file

@ -12,6 +12,7 @@ fn check_node_noise_bipolar() {
.out(None, None, noise.out("sig")));
matrix.place(0, 1, Cell::empty(out)
.input(out.inp("ch1"), None, None));
pset_n(&mut matrix, noise, "atv", 1.0);
matrix.sync().unwrap();
let (out_l, _) = run_for_ms(&mut node_exec, 25.0);
@ -41,6 +42,8 @@ fn check_node_noise_seed() {
.out(None, None, nois2.out("sig")));
matrix.place(1, 1, Cell::empty(out)
.input(out.inp("ch2"), None, None));
pset_n(&mut matrix, noise, "atv", 1.0);
pset_n(&mut matrix, nois2, "atv", 1.0);
matrix.sync().unwrap();
let (out_l, out_r) = run_for_ms(&mut node_exec, 25.0);
@ -64,6 +67,7 @@ fn check_node_noise_unipolar() {
matrix.place(0, 1, Cell::empty(out)
.input(out.inp("ch1"), None, None));
pset_s(&mut matrix, noise, "mode", 1);
pset_n(&mut matrix, noise, "atv", 1.0);
matrix.sync().unwrap();
let (out_l, _) = run_for_ms(&mut node_exec, 25.0);

View file

@ -19,6 +19,7 @@ fn setup_sfilter_matrix() -> (Matrix, NodeExecutor) {
.out(None, None, noise.out("sig")));
matrix.place(1, 2, Cell::empty(out)
.input(out.inp("ch2"), None, None));
pset_n(&mut matrix, noise, "atv", 1.0);
matrix.sync().unwrap();
(matrix, node_exec)
@ -660,8 +661,8 @@ fn check_node_sfilter_simpersvf_highpass() {
avg_fft_freqs(10.0, &[
500, 700, 900, 1000, 1500, 2000, 3000, 4000, 12000
], &fft[..]), vec![
(0, 0), (500, 0), (700, 20), (900, 30), (1000, 30),
(1500, 20), (2000, 20), (3000, 20), (4000, 20)
(0, 0), (500, 0), (700, 10), (900, 10), (1000, 20),
(1500, 20), (2000, 20), (3000, 10), (4000, 10)
]);
// High Pass Simper SVF @ 1000Hz RES=0.0
@ -670,8 +671,8 @@ fn check_node_sfilter_simpersvf_highpass() {
avg_fft_freqs(10.0, &[
500, 700, 900, 1000, 1500, 2000, 3000, 4000, 12000
], &fft[..]), vec![
(0, 0), (500, 0), (700, 10), (900, 10), (1000, 20), (1500, 20),
(2000, 20), (3000, 20), (4000, 10)
(0, 0), (500, 0), (700, 0), (900, 0), (1000, 10), (1500, 10),
(2000, 10), (3000, 10), (4000, 10)
]);
// High Pass Simper SVF @ 4000Hz RES=1.0
@ -681,7 +682,7 @@ fn check_node_sfilter_simpersvf_highpass() {
100, 500, 1000, 2000, 3500, 4000, 5000, 6000, 8000, 12000
], &fft[..]), vec![
(0, 0), (100, 0), (500, 0), (1000, 0), (2000, 20),
(3500, 320), (4000, 200), (5000, 40), (6000, 28), (8000, 20)
(3500, 312), (4000, 184), (5000, 40), (6000, 28), (8000, 20)
]);
// High Pass Simper SVF @ 4000Hz RES=0.0
@ -690,8 +691,8 @@ fn check_node_sfilter_simpersvf_highpass() {
avg_fft_freqs(4.0, &[
100, 500, 1000, 2000, 3500, 4000, 5000, 6000, 8000, 12000
], &fft[..]), vec![
(0, 0), (100, 0), (500, 0), (1000, 0), (2000, 8),
(3500, 12), (4000, 16), (5000, 16), (6000, 20), (8000, 20)
(0, 0), (100, 0), (500, 0), (1000, 0), (2000, 4),
(3500, 8), (4000, 8), (5000, 8), (6000, 12), (8000, 16)
]);
// High Pass Simper SVF @ 22050Hz RES=0.0
@ -699,8 +700,8 @@ fn check_node_sfilter_simpersvf_highpass() {
assert_eq!(
avg_fft_freqs(8.0, &[100, 1000, 4000, 12000, 16000, 20000, 22050], &fft[..]),
vec![
(0, 0), (100, 0), (1000, 8), (4000, 24),
(12000, 32), (16000, 40), (20000, 40)
(0, 0), (100, 0), (1000, 0), (4000, 0),
(12000, 0), (16000, 0), (20000, 0)
]);
// High Pass Simper SVF @ 22050Hz RES=1.0
@ -708,21 +709,21 @@ fn check_node_sfilter_simpersvf_highpass() {
assert_eq!(
avg_fft_freqs(8.0, &[100, 1000, 4000, 12000, 16000, 20000, 22050], &fft[..]),
vec![
(0, 0), (100, 0), (1000, 0), (4000, 8), (12000, 144),
(16000, 192), (20000, 48)
(0, 0), (100, 0), (1000, 0), (4000, 0), (12000, 0),
(16000, 0), (20000, 0)
]);
// High Pass Simper SVF @ 0Hz RES=0.0
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 9, 0.0, 0.0);
assert_eq!(
avg_fft_freqs(4.0, &[10, 100, 1000, 4000, 12000, 22050], &fft[..]), vec![
(0, 52), (10, 12), (100, 20), (1000, 16), (4000, 16), (12000, 16)
(0, 32), (10, 12), (100, 20), (1000, 16), (4000, 16), (12000, 16)
]);
// High Pass Simper SVF @ 0Hz RES=1.0
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 9, 0.0, 1.0);
assert_eq!(
avg_fft_freqs(4.0, &[10, 100, 1000, 4000, 12000, 22050], &fft[..]), vec![
(0, 112), (10, 36), (100, 16), (1000, 20), (4000, 16), (12000, 20)
(0, 92), (10, 36), (100, 16), (1000, 20), (4000, 16), (12000, 20)
]);
}