diff --git a/src/dsp/node_sfilter.rs b/src/dsp/node_sfilter.rs index 4ed006d..9772b32 100644 --- a/src/dsp/node_sfilter.rs +++ b/src/dsp/node_sfilter.rs @@ -88,7 +88,8 @@ impl DspNode for SFilter { 0 => { for frame in 0..ctx.nframes() { let input = inp.read(frame) as f64; - let freq = (denorm::SFilter::freq(freq, frame) as f64); + let freq = denorm::SFilter::freq(freq, frame) as f64; + let freq = freq.clamp(10.0, 22050.0); out.write(frame, process_1pole_lowpass( input, freq, self.israte, &mut self.z) @@ -98,7 +99,8 @@ impl DspNode for SFilter { 1 => { for frame in 0..ctx.nframes() { let input = inp.read(frame) as f64; - let freq = (denorm::SFilter::freq(freq, frame) as f64); + let freq = denorm::SFilter::freq(freq, frame) as f64; + let freq = freq.clamp(10.0, 18000.0); out.write(frame, process_1pole_tpt_lowpass( input, freq, self.israte, &mut self.z) @@ -108,7 +110,8 @@ impl DspNode for SFilter { 2 => { for frame in 0..ctx.nframes() { let input = inp.read(frame) as f64; - let freq = (denorm::SFilter::freq(freq, frame) as f64); + let freq = denorm::SFilter::freq(freq, frame) as f64; + let freq = freq.clamp(10.0, 22050.0); out.write(frame, process_1pole_highpass( input, freq, self.israte, &mut self.z, &mut self.y) @@ -118,7 +121,8 @@ impl DspNode for SFilter { 3 => { for frame in 0..ctx.nframes() { let input = inp.read(frame) as f64; - let freq = (denorm::SFilter::freq(freq, frame) as f64); + let freq = denorm::SFilter::freq(freq, frame) as f64; + let freq = freq.clamp(10.0, 18000.0); out.write(frame, process_1pole_tpt_highpass( input, freq, self.israte, &mut self.z)