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>
impl<T: Float + FromPrimitive + NumCast + AddAssign> STFT<T>
Sourcepub fn configure(
&mut self,
in_channels: usize,
out_channels: usize,
block_samples: usize,
extra_input_history: usize,
interval_samples: usize,
)
pub fn configure( &mut self, in_channels: usize, out_channels: usize, block_samples: usize, extra_input_history: usize, interval_samples: usize, )
Configure the STFT
Sourcepub fn block_samples(&self) -> usize
pub fn block_samples(&self) -> usize
Get the block size in samples
Sourcepub fn fft_samples(&self) -> usize
pub fn fft_samples(&self) -> usize
Get the FFT size in samples
Sourcepub fn default_interval(&self) -> usize
pub fn default_interval(&self) -> usize
Get the default interval between blocks
Sourcepub fn analysis_latency(&self) -> usize
pub fn analysis_latency(&self) -> usize
Get the analysis latency
Sourcepub fn synthesis_latency(&self) -> usize
pub fn synthesis_latency(&self) -> usize
Get the synthesis latency
Sourcepub fn bin_to_freq(&self, bin: T) -> T
pub fn bin_to_freq(&self, bin: T) -> T
Convert bin index to frequency
Sourcepub fn freq_to_bin(&self, freq: T) -> T
pub fn freq_to_bin(&self, freq: T) -> T
Convert frequency to bin index
Sourcepub fn reset_default(&mut self)
pub fn reset_default(&mut self)
Reset the STFT state with default product weight
Sourcepub fn write_input(
&mut self,
channel: usize,
offset: usize,
length: usize,
input_array: &[T],
)
pub fn write_input( &mut self, channel: usize, offset: usize, length: usize, input_array: &[T], )
Write input samples to a specific channel
Sourcepub fn write_input_simple(&mut self, channel: usize, input_array: &[T])
pub fn write_input_simple(&mut self, channel: usize, input_array: &[T])
Write input samples to a specific channel (without offset)
Sourcepub fn read_output(
&self,
channel: usize,
offset: usize,
length: usize,
output_array: &mut [T],
)
pub fn read_output( &self, channel: usize, offset: usize, length: usize, output_array: &mut [T], )
Read output samples from a specific channel
Sourcepub fn read_output_simple(&self, channel: usize, output_array: &mut [T])
pub fn read_output_simple(&self, channel: usize, output_array: &mut [T])
Read output samples from a specific channel (without offset)
Sourcepub fn move_input(&mut self, samples: usize)
pub fn move_input(&mut self, samples: usize)
Move the input position
Sourcepub fn move_output(&mut self, samples: usize)
pub fn move_output(&mut self, samples: usize)
Move the output position
Sourcepub fn set_interval(&mut self, interval: usize, window_shape: WindowShape)
pub fn set_interval(&mut self, interval: usize, window_shape: WindowShape)
Set the interval between blocks and update windows
Sourcepub fn process_block_to_spectrum(&mut self, channel: usize) -> &[Complex<T>]
pub fn process_block_to_spectrum(&mut self, channel: usize) -> &[Complex<T>]
Process a block of input samples to produce a spectrum
Sourcepub fn process_spectrum_to_block(
&mut self,
channel: usize,
spectrum: &[Complex<T>],
)
pub fn process_spectrum_to_block( &mut self, channel: usize, spectrum: &[Complex<T>], )
Process a spectrum to produce a block of output samples
Sourcepub fn process_block(&mut self, in_channel: usize, out_channel: usize)
pub fn process_block(&mut self, in_channel: usize, out_channel: usize)
Process a block of input samples directly to output
Sourcepub fn process_channels(
&mut self,
in_channels: &[usize],
out_channels: &[usize],
)
pub fn process_channels( &mut self, in_channels: &[usize], out_channels: &[usize], )
Process multiple channels at once