tuned the SVF filter a bit more

This commit is contained in:
Weird Constructor 2021-07-15 05:12:05 +02:00
parent b03f5e11e8
commit 7f7b8a0837
2 changed files with 7 additions and 6 deletions

View file

@ -1018,7 +1018,8 @@ pub fn process_simper_svf(
input: f64, freq: f64, res: f64, israte: f64, ic1eq: &mut f64, ic2eq: &mut f64
) -> (f64, f64, f64) {
let g = (std::f64::consts::PI * freq * israte).tan();
let k = 2f64 - (1.9f64 * res);
// XXX: the 1.989 were tuned by hand, so the resonance is more audible.
let k = 2f64 - (1.989f64 * res);
let a1 = 1.0 / (1.0 + (g * (g + k)));
let a2 = g * a1;

View file

@ -563,7 +563,7 @@ fn check_node_sfilter_simpersvf_lowpass() {
avg_fft_freqs(10.0, &[
500, 700, 900, 1000, 1500, 2000, 3000, 4000, 12000
], &fft[..]), vec![
(0, 20), (500, 20), (700, 50), (900, 120), (1000, 50),
(0, 20), (500, 20), (700, 50), (900, 240), (1000, 60),
(1500, 10), (2000, 0), (3000, 0), (4000, 0)
]);
@ -573,7 +573,7 @@ fn check_node_sfilter_simpersvf_lowpass() {
avg_fft_freqs(10.0, &[
500, 700, 900, 1000, 1500, 2000, 3000, 4000, 12000
], &fft[..]), vec![
(0, 10), (500, 10), (700, 20), (900, 10), (1000, 10),
(0, 10), (500, 10), (700, 20), (900, 20), (1000, 10),
(1500, 0), (2000, 0), (3000, 0), (4000, 0)
]);
@ -593,8 +593,8 @@ fn check_node_sfilter_simpersvf_lowpass() {
avg_fft_freqs(4.0, &[
100, 500, 1000, 2000, 3500, 4000, 5000, 6000, 8000, 12000
], &fft[..]), vec![
(0, 24), (100, 16), (500, 20), (1000, 20), (2000, 36), (3500, 144),
(4000, 88), (5000, 20), (6000, 8), (8000, 0)
(0, 24), (100, 16), (500, 20), (1000, 20), (2000, 36), (3500, 332),
(4000, 164), (5000, 20), (6000, 8), (8000, 0)
]);
// Low Pass Simper SVF @ 4000Hz RES=0.0
@ -635,7 +635,7 @@ fn check_node_sfilter_simpersvf_lowpass() {
let fft = fft_with_freq_res_type(&mut matrix, &mut node_exec, 8, 0.0, 1.0);
assert_eq!(
avg_fft_freqs(4.0, &[1, 5, 10, 100, 1000, 4000, 12000, 22050, 22051], &fft[..]), vec![
(0, 60), (1, 0), (5, 0), (10, 0), (100, 0), (1000, 0),
(0, 68), (1, 0), (5, 0), (10, 4), (100, 0), (1000, 0),
(4000, 0), (12000, 0), (22050, 0)
]);
}