STFT

Struct STFT 

Source
pub struct STFT<T: Float> { /* private fields */ }
Expand description

A self-normalizing STFT, with variable position/window for output blocks

Implementations§

Source§

impl<T: Float + FromPrimitive + NumCast + AddAssign> STFT<T>

Source

pub fn new(modified: bool) -> Self

Create a new STFT instance

Source

pub fn configure( &mut self, in_channels: usize, out_channels: usize, block_samples: usize, extra_input_history: usize, interval_samples: usize, )

Configure the STFT

Source

pub fn block_samples(&self) -> usize

Get the block size in samples

Source

pub fn fft_samples(&self) -> usize

Get the FFT size in samples

Source

pub fn default_interval(&self) -> usize

Get the default interval between blocks

Source

pub fn bands(&self) -> usize

Get the number of frequency bands

Source

pub fn analysis_latency(&self) -> usize

Get the analysis latency

Source

pub fn synthesis_latency(&self) -> usize

Get the synthesis latency

Source

pub fn latency(&self) -> usize

Get the total latency

Source

pub fn bin_to_freq(&self, bin: T) -> T

Convert bin index to frequency

Source

pub fn freq_to_bin(&self, freq: T) -> T

Convert frequency to bin index

Source

pub fn reset(&mut self, product_weight: T)

Reset the STFT state

Source

pub fn reset_default(&mut self)

Reset the STFT state with default product weight

Source

pub fn write_input( &mut self, channel: usize, offset: usize, length: usize, input_array: &[T], )

Write input samples to a specific channel

Source

pub fn write_input_simple(&mut self, channel: usize, input_array: &[T])

Write input samples to a specific channel (without offset)

Source

pub fn read_output( &self, channel: usize, offset: usize, length: usize, output_array: &mut [T], )

Read output samples from a specific channel

Source

pub fn read_output_simple(&self, channel: usize, output_array: &mut [T])

Read output samples from a specific channel (without offset)

Source

pub fn move_input(&mut self, samples: usize)

Move the input position

Source

pub fn move_output(&mut self, samples: usize)

Move the output position

Source

pub fn set_interval(&mut self, interval: usize, window_shape: WindowShape)

Set the interval between blocks and update windows

Source

pub fn process_block_to_spectrum(&mut self, channel: usize) -> &[Complex<T>]

Process a block of input samples to produce a spectrum

Source

pub fn process_spectrum_to_block( &mut self, channel: usize, spectrum: &[Complex<T>], )

Process a spectrum to produce a block of output samples

Source

pub fn process_block(&mut self, in_channel: usize, out_channel: usize)

Process a block of input samples directly to output

Source

pub fn process_channels( &mut self, in_channels: &[usize], out_channels: &[usize], )

Process multiple channels at once

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

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.