TransferFunction implemented for series biquad
This commit is contained in:
parent
7e9cf734d0
commit
81872c62e1
@ -1,14 +1,11 @@
|
||||
|
||||
use super::*;
|
||||
|
||||
use super::biquad::Biquad;
|
||||
use anyhow::{bail, Result};
|
||||
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[cfg_attr(feature = "python-bindings", pyclass)]
|
||||
|
||||
|
||||
/// Series of biquads that filter sequentially on an input signal
|
||||
///
|
||||
/// # Examples
|
||||
@ -109,7 +106,16 @@ impl Filter for SeriesBiquad {
|
||||
Box::new(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: AsArray<'a, Flt>> TransferFunction<'a, T> for SeriesBiquad {
|
||||
fn tf(&self, fs: Flt, freq: T) -> Ccol {
|
||||
let freq = freq.into();
|
||||
let mut res = self.biqs.first().unwrap().tf(fs, freq);
|
||||
for i in self.biqs.iter().skip(1) {
|
||||
res = &res * i.tf(fs, freq);
|
||||
}
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
Loading…
Reference in New Issue
Block a user