pub enum WindowFunction {
Rectangular,
Hann,
Hamming,
Blackman,
Kaiser(f32),
FlatTop,
Nuttall,
Gaussian(f32),
Bartlett,
Welch,
}Expand description
Standard window functions for spectral analysis.
Variants§
Rectangular
Rectangular / boxcar — no windowing.
Hann
Hann window (raised cosine).
Hamming
Hamming window.
Blackman
Blackman window.
Kaiser(f32)
Kaiser window with parameter β.
FlatTop
Flat-top window for accurate amplitude measurement.
Nuttall
Nuttall window (minimum 4-term Blackman-Harris).
Gaussian(f32)
Gaussian window with parameter σ (fraction of half-window).
Bartlett
Bartlett (triangle) window.
Welch
Welch window.
Implementations§
Source§impl WindowFunction
impl WindowFunction
Sourcepub fn coefficient(&self, n: usize, len: usize) -> f32
pub fn coefficient(&self, n: usize, len: usize) -> f32
Compute the window coefficient for sample n in a window of length len.
Sourcepub fn apply(&self, samples: &mut [f32])
pub fn apply(&self, samples: &mut [f32])
Apply the window function in-place to a slice of samples.
Sourcepub fn coherent_gain(&self, len: usize) -> f32
pub fn coherent_gain(&self, len: usize) -> f32
Coherent gain (mean of window coefficients) — used for amplitude correction.
Sourcepub fn power_gain(&self, len: usize) -> f32
pub fn power_gain(&self, len: usize) -> f32
Power gain — RMS of window coefficients.
Trait Implementations§
Source§impl Clone for WindowFunction
impl Clone for WindowFunction
Source§fn clone(&self) -> WindowFunction
fn clone(&self) -> WindowFunction
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WindowFunction
impl Debug for WindowFunction
Source§impl PartialEq for WindowFunction
impl PartialEq for WindowFunction
impl Copy for WindowFunction
impl StructuralPartialEq for WindowFunction
Auto Trait Implementations§
impl Freeze for WindowFunction
impl RefUnwindSafe for WindowFunction
impl Send for WindowFunction
impl Sync for WindowFunction
impl Unpin for WindowFunction
impl UnsafeUnpin for WindowFunction
impl UnwindSafe for WindowFunction
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.