#include <FFT.h>
Public Member Functions | |
FFT (int fftSize=1024, bool zeroPhase=true) | |
~FFT () | |
void | process (const MatrixXR &frames, MatrixXC *fft) |
int | fftSize () const |
void | setFftSize (int size, bool callSetup=true) |
bool | zeroPhase () const |
void | setZeroPhase (bool zeroPhase, bool callSetup=true) |
This class represents an object to perform Fast Fourier Transforms (FFT) on Real data. The FFT is a fast implementation of a Discrete Fourier Transform (DFT). The algorithm takes as input N-point vectors of Real values (N being the frame size) and returns (M / 2 + 1) point vectors of Complex values (M being the FFT size).
Note that the algorithm works fastest when M is a power of 2.
Since the input is Real valued, the FFT will be symmetric and only half of the output is needed. This processing unit will only return the (M / 2 + 1)-point array corresponding to positive frequencies of the FFT.
When M is different than N the input data is zero padded at the end. Alternatively the algorithm can perform an N/2 rotation and zero pad the center before the FFT to allow a zero phase transform. This is done by using the setZeroPhase() method.
FFT | ( | int | fftSize = 1024 , |
|
bool | zeroPhase = true | |||
) |
Constructs an FFT object with the specified fftSize and zeroPhase setting.
fftSize | size of the FFT transform must be > 0, it is the target size of the transform. The algorithm performs faster for sizes which are a power of 2. | |
zeroPhase | determines whether or not to perform the zero phase transform. |
References setFftSize(), and setZeroPhase().
void process | ( | const MatrixXR & | frames, | |
MatrixXC * | fft | |||
) |
Performs a Fast Fourier Transform on each of the rows of frames and puts the resulting FFT in the rows of fft.
frames | matrix of Real values. The number of columns of frames must be smaller or equal to the fftSize property. | |
fft | pointer to a matrix of Complex values for the output. The matrix should have the same number of rows as frames and (fftSize / 2) + 1 columns. |
Referenced by Correlation::process(), and Autocorrelation::process().
int fftSize | ( | ) | const |
void setFftSize | ( | int | size, | |
bool | callSetup = true | |||
) |
bool zeroPhase | ( | ) | const |
void setZeroPhase | ( | bool | zeroPhase, | |
bool | callSetup = true | |||
) |