pub struct StreamingSpectrogram { /* private fields */ }Expand description
A rolling spectrogram that maintains a sliding window of magnitude frames.
After calling push with audio samples, the latest
spectrogram can be retrieved as a Vec<Vec<f32>> of shape
(n_frames, n_freq_bins).
Implementations§
Source§impl StreamingSpectrogram
impl StreamingSpectrogram
Sourcepub fn new(
stft_config: RingBufferStftConfig,
max_frames: usize,
) -> FFTResult<Self>
pub fn new( stft_config: RingBufferStftConfig, max_frames: usize, ) -> FFTResult<Self>
Create a new streaming spectrogram.
max_frames is the maximum number of magnitude frames retained. Older
frames are discarded once the limit is reached.
§Errors
Propagates errors from RingBufferStft::new.
Sourcepub fn get_spectrogram(&self) -> Vec<Vec<f32>>
pub fn get_spectrogram(&self) -> Vec<Vec<f32>>
Return the current spectrogram as a Vec<Vec<f32>> of shape
(n_frames, n_freq_bins).
Sourcepub fn n_freq_bins(&self) -> usize
pub fn n_freq_bins(&self) -> usize
Number of one-sided frequency bins.
Auto Trait Implementations§
impl Freeze for StreamingSpectrogram
impl RefUnwindSafe for StreamingSpectrogram
impl Send for StreamingSpectrogram
impl Sync for StreamingSpectrogram
impl Unpin for StreamingSpectrogram
impl UnsafeUnpin for StreamingSpectrogram
impl UnwindSafe for StreamingSpectrogram
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> 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>
Converts
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>
Converts
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