pub struct GoertzelDetector { /* private fields */ }Expand description
A Goertzel single-frequency detector: computes the DFT magnitude at one target frequency via a simple two-pole recursive filter, without a full FFT. Ideal for detecting a known tone (e.g. DTMF, a pilot tone) from a stream of samples on constrained hardware.
Implementations§
Source§impl GoertzelDetector
impl GoertzelDetector
Sourcepub fn new(target_freq_hz: f32, sample_rate_hz: f32) -> Self
pub fn new(target_freq_hz: f32, sample_rate_hz: f32) -> Self
Creates a detector tuned to target_freq_hz at the given sample_rate_hz.
Sourcepub fn process_sample(&mut self, x: f32)
pub fn process_sample(&mut self, x: f32)
Feeds one input sample into the detector.
Trait Implementations§
Source§impl Clone for GoertzelDetector
impl Clone for GoertzelDetector
Source§fn clone(&self) -> GoertzelDetector
fn clone(&self) -> GoertzelDetector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for GoertzelDetector
Source§impl Debug for GoertzelDetector
impl Debug for GoertzelDetector
Source§impl Default for GoertzelDetector
impl Default for GoertzelDetector
Source§fn default() -> GoertzelDetector
fn default() -> GoertzelDetector
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for GoertzelDetector
impl RefUnwindSafe for GoertzelDetector
impl Send for GoertzelDetector
impl Sync for GoertzelDetector
impl Unpin for GoertzelDetector
impl UnsafeUnpin for GoertzelDetector
impl UnwindSafe for GoertzelDetector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more