Krotos Modules 3
Loading...
Searching...
No Matches
audiofft Namespace Reference

Namespaces

namespace  detail
 

Classes

class  AudioFFT
 Performs 1D FFTs. More...
 
class  OouraFFT
 

Typedefs

typedef OouraFFT AudioFFTImplementation
 
typedef AudioFFT AudioFFTBase
 Let's keep an AudioFFTBase type around for now because it has been here already in the 1st version in order to avoid breaking existing code.
 

Detailed Description

AudioFFT provides real-to-complex/complex-to-real FFT routines.

Features:

  • Real-complex FFT and complex-real inverse FFT for power-of-2-sized real data.
  • Uniform interface to different FFT implementations (currently Ooura, FFTW3 and Apple Accelerate).
  • Complex data is handled in "split-complex" format, i.e. there are separate arrays for the real and imaginary parts which can be useful for SIMD optimizations (split-complex arrays have to be of length (size/2+1) representing bins from DC to Nyquist frequency).
  • Output is "ready to use" (all scaling etc. is already handled internally).
  • No allocations/deallocations after the initialization which makes it usable for real-time audio applications (that's what I wrote it for and using it).

How to use it in your project:

  • Add the .h and .cpp file to your project - that's all.
  • To get extra speed, you can link FFTW3 to your project and define AUDIOFFT_FFTW3 (however, please check whether your project suits the according license).
  • To get the best speed on Apple platforms, you can link the Apple Accelerate framework to your project and define AUDIOFFT_APPLE_ACCELERATE (however, please check whether your project suits the according license).

Remarks:

  • AudioFFT is not intended to be the fastest FFT, but to be a fast-enough FFT suitable for most audio applications.
  • AudioFFT uses the quite liberal MIT license.

Example usage:

#include "AudioFFT.h"
void Example()
{
const size_t fftSize = 1024; // Needs to be power of 2!
std::vector<float> input(fftSize, 0.0f);
std::vector<float> re(audiofft::AudioFFT::ComplexSize(fftSize));
std::vector<float> im(audiofft::AudioFFT::ComplexSize(fftSize));
std::vector<float> output(fftSize);
fft.init(1024);
fft.fft(input.data(), re.data(), im.data());
fft.ifft(output.data(), re.data(), im.data());
}
Performs 1D FFTs.
Definition AudioFFT.h:106
void init(size_t size)
Initializes the FFT object.
Definition AudioFFT.cpp:984
void fft(const float *data, float *re, float *im)
Performs the forward FFT.
Definition AudioFFT.cpp:990
void ifft(float *data, const float *re, const float *im)
Performs the inverse FFT.
Definition AudioFFT.cpp:992
static size_t ComplexSize(size_t size)
Calculates the necessary size of the real/imaginary complex arrays.
Definition AudioFFT.cpp:994

Typedef Documentation

◆ AudioFFTBase

Let's keep an AudioFFTBase type around for now because it has been here already in the 1st version in order to avoid breaking existing code.

Deprecated

◆ AudioFFTImplementation