QDFT

Struct QDFT 

Source
pub struct QDFT<T, F>
where T: Float + CastFrom<F>, F: Float + CastFrom<T> + CastFrom<f64>,
{ /* private fields */ }
Expand description

Constant-Q Sliding Discrete Fourier Transform (QDFT).

§Arguments

  • T - Time domain data type.
  • F - Frequency domain data type.

Both T and F must be f32 or f64 respectively.

Implementations§

Source§

impl<T, F> QDFT<T, F>
where T: Float + CastFrom<F>, F: Float + CastFrom<T> + CastFrom<f64>,

Source

pub fn new( samplerate: f64, bandwidth: (f64, f64), resolution: f64, latency: f64, window: Option<(f64, f64)>, ) -> Self

Returns a new QDFT plan instance for the specified parameters.

§Arguments
  • samplerate - Sample rate in hertz.
  • bandwidth - Lowest and highest frequency in hertz to be resolved.
  • resolution - Octave resolution, e.g. number of DFT bins per octave.
  • latency - Analysis latency adjustment between -1 and +1.
  • window - Cosine family window coeffs, e.g. (+0.5,-0.5) in case of hann window.
Source

pub fn size(&self) -> usize

Returns the number of DFT bins derived from the bandwidth and resolution.

Source

pub fn samplerate(&self) -> f64

Returns the sample rate in hertz.

Source

pub fn bandwidth(&self) -> (f64, f64)

Returns the lowest and highest frequency in hertz to be resolved.

Source

pub fn resolution(&self) -> f64

Returns the octave resolution, e.g. number of DFT bins per octave.

Source

pub fn quality(&self) -> f64

Returns the quality factor derived from the resolution.

Source

pub fn latency(&self) -> f64

Returns the analysis latency factor.

Source

pub fn frequencies(&self) -> &[f64]

Returns frequency values in hertz of the individual DFT bins.

Source

pub fn window(&self) -> Option<(f64, f64)>

Returns the cosine family window coeffs, e.g. (+0.5,-0.5) in case of hann window.

Source

pub fn qdft_scalar(&mut self, sample: &T, dft: &mut [Complex<F>])

Estimate the DFT vector for the given sample.

Source

pub fn iqdft_scalar(&mut self, dft: &[Complex<F>], sample: &mut T)

Synthesize the sample from the given DFT vector.

Source

pub fn qdft_vector(&mut self, samples: &[T], dfts: &mut [Complex<F>])

Estimate the DFT matrix for the given sample array.

Source

pub fn iqdft_vector(&mut self, dfts: &[Complex<F>], samples: &mut [T])

Synthesize the sample array from the given DFT matrix.

Source

pub fn qdft(&mut self, samples: &[T], dfts: &mut [Complex<F>])

Estimate the DFT matrix for the given sample array. This is a shortcut for the function [qdft_vector].

Source

pub fn iqdft(&mut self, dfts: &[Complex<F>], samples: &mut [T])

Synthesize the sample array from the given DFT matrix. This is a shortcut for the function [iqdft_vector].

Auto Trait Implementations§

§

impl<T, F> Freeze for QDFT<T, F>

§

impl<T, F> RefUnwindSafe for QDFT<T, F>

§

impl<T, F> Send for QDFT<T, F>
where F: Send, T: Send,

§

impl<T, F> Sync for QDFT<T, F>
where F: Sync, T: Sync,

§

impl<T, F> Unpin for QDFT<T, F>
where F: Unpin, T: Unpin,

§

impl<T, F> UnwindSafe for QDFT<T, F>
where F: UnwindSafe, 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.