pub struct FftProcessor { /* private fields */ }
Expand description
An FFT processor with overlap and windowing.
This processor will collect samples onto a circular buffer and perform FFTs whenever hop size is reached.
Implementations§
source§impl FftProcessor
impl FftProcessor
sourcepub fn new(options: FftProcessorOptions) -> Self
pub fn new(options: FftProcessorOptions) -> Self
Constructs a new FftProcessor
- size: Size of the FFT
- direction: Direction of the FFT
- overlap_ratio: 0.0 will do no overlap, 0.5 will do half a window of overlap and 0.75 will do 3/4 window overlap
- window_function: The window function to use
sourcepub fn buffer_mut(&mut self) -> &mut Vec<Complex<f32>>
pub fn buffer_mut(&mut self) -> &mut Vec<Complex<f32>>
Get a mutable reference to the FFT bins buffer
sourcepub fn step_len(&self) -> usize
pub fn step_len(&self) -> usize
Get the hop size of this processor. This is the number of samples between each FFT.
sourcepub fn process_fft_buffer(&mut self, samples: &mut [Complex<f32>])
pub fn process_fft_buffer(&mut self, samples: &mut [Complex<f32>])
Manually process an external FFT buffer in-place.
sourcepub fn has_changed(&self) -> bool
pub fn has_changed(&self) -> bool
Returns true if an FFT has just been performed on the last call to s_process
sourcepub fn input_buffer_sum(&self) -> f32
pub fn input_buffer_sum(&self) -> f32
Returns the sum of the power of the current input buffer window.
sourcepub fn perform_fft(&mut self, start_idx: usize)
pub fn perform_fft(&mut self, start_idx: usize)
Manually perform an FFT; offset the input buffer by a certain index.
Trait Implementations§
source§impl Default for FftProcessor
impl Default for FftProcessor
source§impl MonoAudioProcessor for FftProcessor
impl MonoAudioProcessor for FftProcessor
type SampleType = f32
fn m_process( &mut self, _context: &mut AudioContext, sample: Self::SampleType ) -> Self::SampleType
fn m_prepare( &mut self, _context: &mut AudioContext, _settings: AudioProcessorSettings )
Auto Trait Implementations§
impl !RefUnwindSafe for FftProcessor
impl Send for FftProcessor
impl Sync for FftProcessor
impl Unpin for FftProcessor
impl !UnwindSafe for FftProcessor
Blanket Implementations§
source§impl<M, ST> SimpleAudioProcessor for Mwhere
M: MonoAudioProcessor<SampleType = ST>,
ST: Copy + Sum<ST> + Float + FloatConst,
impl<M, ST> SimpleAudioProcessor for Mwhere M: MonoAudioProcessor<SampleType = ST>, ST: Copy + Sum<ST> + Float + FloatConst,
type SampleType = <M as MonoAudioProcessor>::SampleType
source§fn s_prepare(
&mut self,
context: &mut AudioContext,
settings: AudioProcessorSettings
)
fn s_prepare( &mut self, context: &mut AudioContext, settings: AudioProcessorSettings )
Prepare for playback based on current audio settings
source§fn s_process_frame(
&mut self,
context: &mut AudioContext,
frame: &mut [<M as SimpleAudioProcessor>::SampleType]
)
fn s_process_frame( &mut self, context: &mut AudioContext, frame: &mut [<M as SimpleAudioProcessor>::SampleType] )
Process a multi-channel frame.