Function synfx_dsp::process_simper_svf
source · [−]pub fn process_simper_svf(
input: f32,
freq: f32,
res: f32,
israte: f32,
ic1eq: &mut f32,
ic2eq: &mut f32
) -> (f32, f32, f32)
Expand description
This function processes a Simper SVF with 12dB. It’s a much newer algorithm for filtering and provides easy to calculate multiple outputs.
input
- Input sample.freq
- Frequency in Hz. otherwise the filter becomes unstable.res
- Resonance from 0.0 to 0.99. Resonance of 1.0 is not recommended, as the filter will then oscillate itself out of control.israte
- 1.0 divided by the sampling rate (eg. 1.0 / 44100.0).band
- First state variable, containing the band pass result after processing.low
- Second state variable, containing the low pass result after processing.
This function returns the low pass, band pass and high pass signal. For a notch or peak filter signal, please consult the following example:
use synfx_dsp::*;
let samples = vec![0.0; 44100];
let mut ic1eq = 0.0;
let mut ic2eq = 0.0;
let mut freq = 1000.0;
for s in samples.iter() {
let (low, band, high) =
process_simper_svf(
*s, freq, 0.5, 1.0 / 44100.0, &mut ic1eq, &mut ic2eq);
// You can easily calculate the notch and peak results too:
let notch = low + high;
let peak = low - high;
// ... do something with the result here.
}