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

source

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
source

pub fn size(&self) -> usize

The number of frequency bins this FFT processor operates with

source

pub fn buffer(&self) -> &Vec<Complex<f32>>

Get a reference to the FFT bins buffer

source

pub fn fft(&self) -> &Arc<dyn Fft<f32>>

Get a reference to the rustfft instance

source

pub fn buffer_mut(&mut self) -> &mut Vec<Complex<f32>>

Get a mutable reference to the FFT bins buffer

source

pub fn scratch_mut(&mut self) -> &mut Vec<Complex<f32>>

Get a mutable reference to the scratch buffer

source

pub fn step_len(&self) -> usize

Get the hop size of this processor. This is the number of samples between each FFT.

source

pub fn process_fft_buffer(&mut self, samples: &mut [Complex<f32>])

Manually process an external FFT buffer in-place.

source

pub fn has_changed(&self) -> bool

Returns true if an FFT has just been performed on the last call to s_process

source

pub fn input_buffer_sum(&self) -> f32

Returns the sum of the power of the current input buffer window.

source

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

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl MonoAudioProcessor for FftProcessor

§

type SampleType = f32

source§

fn m_process( &mut self, _context: &mut AudioContext, sample: Self::SampleType ) -> Self::SampleType

source§

fn m_prepare(&mut self, _context: &mut AudioContext)

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.