STFT

Struct STFT 

Source
pub struct STFT<T>
where T: FftNum + FromF64 + Float,
{ pub window_size: usize, pub fft_size: usize, pub step_size: usize, pub fft: Arc<dyn Fft<T>>, pub window: Option<Vec<T>>, pub sample_ring: SliceRingImpl<T>, pub real_input: Vec<T>, pub complex_input_output: Vec<Complex<T>>, /* private fields */ }

Fields§

§window_size: usize§fft_size: usize§step_size: usize§fft: Arc<dyn Fft<T>>§window: Option<Vec<T>>§sample_ring: SliceRingImpl<T>

internal ringbuffer used to store samples

§real_input: Vec<T>§complex_input_output: Vec<Complex<T>>

Implementations§

Source§

impl<T> STFT<T>
where T: FftNum + FromF64 + Float,

Source

pub fn window_type_to_window_vec( window_type: WindowType, window_size: usize, ) -> Option<Vec<T>>

Source

pub fn new( window_type: WindowType, window_size: usize, step_size: usize, ) -> Self

Source

pub fn new_with_zero_padding( window_type: WindowType, window_size: usize, fft_size: usize, step_size: usize, ) -> Self

Source

pub fn new_with_window_vec_and_zero_padding( window: Option<Vec<T>>, window_size: usize, fft_size: usize, step_size: usize, ) -> Self

Source

pub fn new_with_window_vec( window: Option<Vec<T>>, window_size: usize, step_size: usize, ) -> Self

Source

pub fn output_size(&self) -> usize

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn append_samples(&mut self, input: &[T])

Source

pub fn contains_enough_to_compute(&self) -> bool

Source

pub fn compute_into_complex_output(&mut self)

Source

pub fn compute_complex_column(&mut self, output: &mut [Complex<T>])

§Panics

panics unless self.output_size() == output.len()

Source

pub fn compute_magnitude_column(&mut self, output: &mut [T])

§Panics

panics unless self.output_size() == output.len()

Source

pub fn compute_column(&mut self, output: &mut [T])

computes a column of the spectrogram

§Panics

panics unless self.output_size() == output.len()

Source

pub fn move_to_next_column(&mut self)

make a step drops self.step_size samples from the internal buffer self.sample_ring.

Source

pub fn freqs(&self, fs: f64) -> Vec<f64>

corresponding frequencies of a column of the spectrogram

§Arguments

fs: sampling frequency.

Source

pub fn first_time(&self, fs: f64) -> f64

corresponding time of first columns of the spectrogram

Source

pub fn time_interval(&self, fs: f64) -> f64

time interval between two adjacent columns of the spectrogram

Auto Trait Implementations§

§

impl<T> Freeze for STFT<T>

§

impl<T> !RefUnwindSafe for STFT<T>

§

impl<T> Send for STFT<T>

§

impl<T> Sync for STFT<T>

§

impl<T> Unpin for STFT<T>
where T: Unpin,

§

impl<T> !UnwindSafe for STFT<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.