48 #ifndef GRT_FFT_HEADER
49 #define GRT_FFT_HEADER
51 #include "../../CoreModules/FeatureExtraction.h"
52 #include "FastFourierTransform.h"
72 FFT(UINT fftWindowSize=512,UINT hopSize=1,UINT numDimensions=1,UINT fftWindowFunction=RECTANGULAR_WINDOW,
bool computeMagnitude=
true,
bool computePhase=
true);
92 FFT& operator=(
const FFT &rhs);
131 virtual bool clear();
140 virtual bool reset();
177 bool init(UINT fftWindowSize,UINT hopSize,UINT numDimensions,UINT windowFunction,
bool computeMagnitude,
bool computePhase,DataType inputType = DATA_TYPE_VECTOR,DataType outputType = DATA_TYPE_VECTOR);
187 bool update(
const Float x);
221 UINT getDataBufferSize();
228 UINT getFFTWindowSize();
235 UINT getFFTWindowFunction();
242 UINT getHopCounter();
272 VectorFloat getFrequencyBins(
const unsigned int sampleRate);
284 bool setHopSize(UINT hopSize);
293 bool setFFTWindowSize(UINT fftWindowSize);
301 bool setFFTWindowFunction(UINT fftWindowFunction);
309 bool setComputeMagnitude(
bool computeMagnitude);
317 bool setComputePhase(
bool computePhase);
323 bool isPowerOfTwo(UINT x);
324 bool validateFFTWindowFunction(UINT fftWindowFunction);
341 enum FFTWindowFunctionOptions{RECTANGULAR_WINDOW=0,BARTLETT_WINDOW,HAMMING_WINDOW,HANNING_WINDOW};
346 #endif //GRT_FFT_HEADER
bool getComputeMagnitude()
UINT dataBufferSize
Stores how much previous input data is stored in the dataBuffer.
Vector< FastFourierTransform > fft
A buffer used to store the FFT results.
CircularBuffer< VectorFloat > dataBuffer
A circular buffer used to store the previous M inputs.
Vector< FastFourierTransform > & getFFTResultsPtr()
UINT fftWindowFunction
The current windowFunction used for the FFT.
bool computePhase
Tracks if the phase of the FFT needs to be computed.
UINT hopSize
The current hopSize, this sets how often the fft should be computed.
UINT hopCounter
Keeps track of how many input samples the FFT has seen.
VectorFloat tempBuffer
A temporary buffer used to store the input data for the FFT.
std::map< unsigned int, unsigned int > windowSizeMap
A map to relate the FFTWindowSize enumerations to actual values.
UINT fftWindowSize
Stores the size of the fft (and also the dataBuffer)
Vector< FastFourierTransform > getFFTResults()
bool computeMagnitude
Tracks if the magnitude (and power) of the FFT need to be computed.