pub struct StftParams { /* private fields */ }Expand description
The frame layout of an STFT: frame length N, hop, window, padding and
FFT oversampling.
Frames are centred: frame m covers samples m hop - N/2 to
m hop - N/2 + N - 1, so a signal of len samples gives
1 + floor((len + 2 floor(N/2) - N) / hop) frames, which is
1 + floor(len / hop) for an even N. The default hop is N/4.
Oversampling by a factor p zero-pads each windowed frame to p N
samples, so the bins sit fs / (p N) apart. It refines peak positions
and changes no frequency resolution.
Implementations§
Source§impl StftParams
impl StftParams
Sourcepub fn with_window(self, window: Window) -> Self
pub fn with_window(self, window: Window) -> Self
Sets the window.
Sourcepub fn with_padding(self, padding: Padding) -> Self
pub fn with_padding(self, padding: Padding) -> Self
Sets the padding at both ends of the signal.
Sourcepub fn with_oversample(self, factor: usize) -> Result<Self, StftError>
pub fn with_oversample(self, factor: usize) -> Result<Self, StftError>
Sourcepub fn frame_count(self, len: usize) -> usize
pub fn frame_count(self, len: usize) -> usize
Returns the number of centred frames for a signal of len samples.
Sourcepub fn bin_hz(self, bin: usize, rate: SampleRate) -> Hz
pub fn bin_hz(self, bin: usize, rate: SampleRate) -> Hz
Returns the frequency of bin k, k fs / fft_len.
Sourcepub fn bin_width(self, rate: SampleRate) -> Hz
pub fn bin_width(self, rate: SampleRate) -> Hz
Returns the bin spacing, fs / fft_len.
Sourcepub fn frame_time(self, frame: usize, rate: SampleRate) -> Seconds
pub fn frame_time(self, frame: usize, rate: SampleRate) -> Seconds
Returns the time of the centre of frame m, m hop / fs.
Trait Implementations§
Source§impl Clone for StftParams
impl Clone for StftParams
impl Copy for StftParams
Source§impl Debug for StftParams
impl Debug for StftParams
impl Eq for StftParams
Source§impl Hash for StftParams
impl Hash for StftParams
Source§impl PartialEq for StftParams
impl PartialEq for StftParams
impl StructuralPartialEq for StftParams
Auto Trait Implementations§
impl Freeze for StftParams
impl RefUnwindSafe for StftParams
impl Send for StftParams
impl Sync for StftParams
impl Unpin for StftParams
impl UnsafeUnpin for StftParams
impl UnwindSafe for StftParams
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more