Started working on testing the rest of the Simper SVF.
This commit is contained in:
parent
8c3c834907
commit
0e48eea78e
2 changed files with 126 additions and 0 deletions
|
@ -325,6 +325,46 @@ impl DspNode for SFilter {
|
|||
low
|
||||
});
|
||||
},
|
||||
9 => { // Simper SVF High Pass
|
||||
process_filter_fun32!(
|
||||
ctx.nframes(), inp, out, freq, res, 1.0, input, 22000.0, {
|
||||
let (_low, _band, high) =
|
||||
process_simper_svf(
|
||||
input, freq, res, self.israte,
|
||||
&mut self.k, &mut self.h);
|
||||
high
|
||||
});
|
||||
},
|
||||
10 => { // Simper SVF Band Pass
|
||||
process_filter_fun32!(
|
||||
ctx.nframes(), inp, out, freq, res, 1.0, input, 22000.0, {
|
||||
let (_low, band, _high) =
|
||||
process_simper_svf(
|
||||
input, freq, res, self.israte,
|
||||
&mut self.k, &mut self.h);
|
||||
band
|
||||
});
|
||||
},
|
||||
11 => { // Simper SVF Notch
|
||||
process_filter_fun32!(
|
||||
ctx.nframes(), inp, out, freq, res, 1.0, input, 22000.0, {
|
||||
let (low, _band, high) =
|
||||
process_simper_svf(
|
||||
input, freq, res, self.israte,
|
||||
&mut self.k, &mut self.h);
|
||||
low + high
|
||||
});
|
||||
},
|
||||
12 => { // Simper SVF Peak
|
||||
process_filter_fun32!(
|
||||
ctx.nframes(), inp, out, freq, res, 1.0, input, 22000.0, {
|
||||
let (low, _band, high) =
|
||||
process_simper_svf(
|
||||
input, freq, res, self.israte,
|
||||
&mut self.k, &mut self.h);
|
||||
low - high
|
||||
});
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
|
|
|
@ -640,3 +640,89 @@ fn check_node_sfilter_simpersvf_lowpass() {
|
|||
]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn check_node_sfilter_simpersvf_highpass() {
|
||||
let (mut matrix, mut node_exec) = setup_sfilter_matrix();
|
||||
|
||||
// High Pass Simper SVF @ 1000Hz RES=1.0
|
||||
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 9, 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 Simper SVF @ 1000Hz RES=0.5
|
||||
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 9, 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 Simper SVF @ 1000Hz RES=0.0
|
||||
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 9, 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 Simper SVF @ 4000Hz RES=1.0
|
||||
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 9, 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 Simper SVF @ 4000Hz RES=0.0
|
||||
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 9, 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 Simper SVF @ 22050Hz RES=0.0
|
||||
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 9, 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 Simper SVF @ 22050Hz RES=1.0
|
||||
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 9, 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 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)
|
||||
]);
|
||||
|
||||
// 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)
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue