VCV Rack API v2
Loading...
Searching...
No Matches
rack::dsp::RealFFT Struct Reference

Real-valued FFT context. More...

#include <fft.hpp>

Public Member Functions

 RealFFT (size_t length)
 
 ~RealFFT ()
 
void rfftUnordered (const float *input, float *output)
 Performs the real FFT.
 
void irfftUnordered (const float *input, float *output)
 Performs the inverse real FFT.
 
void rfft (const float *input, float *output)
 Slower than the above methods, but returns results in the "canonical" FFT order as follows.
 
void irfft (const float *input, float *output)
 
void scale (float *x)
 Scales the RFFT so that scale(IFFT(FFT(x))) = x.
 

Public Attributes

PFFFT_Setup * setup
 
int length
 

Detailed Description

Real-valued FFT context.

Wrapper for PFFFT length must be a multiple of 32. Buffers must be aligned to 16-byte boundaries. new[] and malloc() do this for you.

Constructor & Destructor Documentation

◆ RealFFT()

rack::dsp::RealFFT::RealFFT ( size_t length)
inline

◆ ~RealFFT()

rack::dsp::RealFFT::~RealFFT ( )
inline

Member Function Documentation

◆ rfftUnordered()

void rack::dsp::RealFFT::rfftUnordered ( const float * input,
float * output )
inline

Performs the real FFT.

Input and output must be aligned using the above align*() functions. Input and output arrays may overlap. Input is length elements. Output is 2*length elements. Output is arbitrarily ordered for performance reasons. However, this ordering is consistent, so element-wise multiplication with line up with other results, and the inverse FFT will return a correctly ordered result.

◆ irfftUnordered()

void rack::dsp::RealFFT::irfftUnordered ( const float * input,
float * output )
inline

Performs the inverse real FFT.

Input is 2*length elements. Output is length elements. Scaling is such that IRFFT(RFFT(x)) = N*x.

◆ rfft()

void rack::dsp::RealFFT::rfft ( const float * input,
float * output )
inline

Slower than the above methods, but returns results in the "canonical" FFT order as follows.

output[0] = F(0) output[1] = F(n/2) output[2] = real(F(1)) output[3] = imag(F(1)) output[4] = real(F(2)) output[5] = imag(F(2)) ... output[length - 2] = real(F(n/2 - 1)) output[length - 1] = imag(F(n/2 - 1))

◆ irfft()

void rack::dsp::RealFFT::irfft ( const float * input,
float * output )
inline

◆ scale()

void rack::dsp::RealFFT::scale ( float * x)
inline

Scales the RFFT so that scale(IFFT(FFT(x))) = x.

Member Data Documentation

◆ setup

PFFFT_Setup* rack::dsp::RealFFT::setup

◆ length

int rack::dsp::RealFFT::length

The documentation for this struct was generated from the following file: