raised max resonance for simper svf

This commit is contained in:
Weird Constructor 2021-07-15 05:09:48 +02:00
parent 53853d890e
commit b03f5e11e8
3 changed files with 18 additions and 6 deletions

View file

@ -582,7 +582,7 @@ macro_rules! node_list {
sfilter => SFilter UIType::Generic UICategory::Signal
(0 inp n_id d_id r_id f_def stp_d -1.0, 1.0, 0.0)
(1 freq n_pit d_pit r_fq f_freq stp_d -1.0, 0.5647131, 1000.0)
(2 res n_id d_id r_id f_def stp_d 0.0, 0.99, 0.5)
(2 res n_id d_id r_id f_def stp_d 0.0, 1.0, 0.5)
{3 0 ftype setting(8) fa_sfilter_type 0 12}
[0 sig],
test => Test UIType::Generic UICategory::IOUtil

View file

@ -127,6 +127,18 @@ macro_rules! process_filter_fun {
$out.write(frame, s as f32);
}
} };
($nframes: expr, $inp: expr, $out: ident, $freq: ident, $res: ident,
$maxres: expr, $input: ident, $maxfreq: expr, $block: block) => { {
for frame in 0..$nframes {
let $input = $inp.read(frame) as f64;
let $freq = denorm::SFilter::freq($freq, frame) as f64;
let $freq = $freq.clamp(1.0, $maxfreq);
let $res = denorm::SFilter::res($res, frame) as f64;
let $res = $res.clamp(0.0, $maxres);
let s = $block;
$out.write(frame, s as f32);
}
} };
($nframes: expr, $inp: expr, $out: ident, $freq: ident,
$input: ident, $maxfreq: expr, $block: block) => { {
for frame in 0..$nframes {
@ -245,7 +257,7 @@ impl DspNode for SFilter {
},
8 => { // Simper SVF Low Pass
process_filter_fun!(
ctx.nframes(), inp, out, freq, res, input, 22000.0, {
ctx.nframes(), inp, out, freq, res, 1.0, input, 22000.0, {
let (low, _band, _high) =
process_simper_svf(
input, freq, res, self.israte,

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, 110), (1000, 40),
(0, 20), (500, 20), (700, 50), (900, 120), (1000, 50),
(1500, 10), (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, 132),
(4000, 80), (5000, 20), (6000, 8), (8000, 0)
(0, 24), (100, 16), (500, 20), (1000, 20), (2000, 36), (3500, 144),
(4000, 88), (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, 56), (1, 0), (5, 0), (10, 0), (100, 0), (1000, 0),
(0, 60), (1, 0), (5, 0), (10, 0), (100, 0), (1000, 0),
(4000, 0), (12000, 0), (22050, 0)
]);
}