From 03fa23e81883cb2ec42d3331bdb8485ebfa22d8c Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Tue, 13 Jul 2021 05:08:31 +0200 Subject: [PATCH] added hal cham. svf high pass test --- tests/node_sfilter.rs | 85 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/tests/node_sfilter.rs b/tests/node_sfilter.rs index e1efff6..20e1fe6 100644 --- a/tests/node_sfilter.rs +++ b/tests/node_sfilter.rs @@ -288,3 +288,88 @@ fn check_node_sfilter_halsvf_lowpass() { (4000, 0), (12000, 0), ]); } + +#[test] +fn check_node_sfilter_halsvf_highpass() { + let (mut matrix, mut node_exec) = setup_sfilter_matrix(); + + // High Pass Hal Chamberlin SVF @ 1000Hz RES=1.0 + let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 5, 1000.0, 1.0); + assert_eq!( + avg_fft_freqs(10.0, &[ + 500, 700, 900, 1000, 1500, 2000, 3000, 4000, 12000 + ], &fft[..]), vec![ + (0, 0), (500, 0), (700, 30), (900, 220), (1000, 80), + (1500, 30), (2000, 20), (3000, 20), (4000, 10) + ]); + + // High Pass Hal Chamberlin SVF @ 1000Hz RES=0.5 + let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 5, 1000.0, 0.5); + assert_eq!( + 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) + ]); + + // High Pass Hal Chamberlin SVF @ 1000Hz RES=0.0 + let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 5, 1000.0, 0.0); + assert_eq!( + 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) + ]); + + // High Pass Hal Chamberlin SVF @ 4000Hz RES=1.0 + let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 5, 4000.0, 1.0); + assert_eq!( + 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, 20), + (3500, 320), (4000, 200), (5000, 40), (6000, 28), (8000, 20) + ]); + + // High Pass Hal Chamberlin SVF @ 4000Hz RES=0.0 + let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 5, 4000.0, 0.0); + assert_eq!( + 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) + ]); + + // High Pass Hal Chamberlin SVF @ 22050Hz RES=0.0 + let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 5, 22050.0, 0.0); + 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) + ]); + + // High Pass Hal Chamberlin SVF @ 22050Hz RES=1.0 + let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 5, 22050.0, 1.0); + 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) + ]); + + // High Pass Hal Chamberlin SVF @ 0Hz RES=0.0 + let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 5, 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) + ]); + + // High Pass Hal Chamberlin SVF @ 0Hz RES=1.0 + let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 5, 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) + ]); +}