48 #ifndef GRT_FFT_HEADER
49 #define GRT_FFT_HEADER
51 #include "../../CoreModules/FeatureExtraction.h"
52 #include "FastFourierTransform.h"
131 virtual bool clear();
140 virtual bool reset();
187 bool update(
const Float x);
272 VectorFloat getFrequencyBins(
const unsigned int sampleRate);
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 setHopSize(UINT hopSize)
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.
bool setComputeMagnitude(bool computeMagnitude)
std::map< unsigned int, unsigned int > windowSizeMap
A map to relate the FFTWindowSize enumerations to actual values.
UINT getFFTWindowFunction()
virtual bool loadModelFromFile(std::fstream &file)
UINT fftWindowSize
Stores the size of the fft (and also the dataBuffer)
FFT(UINT fftWindowSize=512, UINT hopSize=1, UINT numDimensions=1, UINT fftWindowFunction=RECTANGULAR_WINDOW, bool computeMagnitude=true, bool computePhase=true)
virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction)
bool setFFTWindowFunction(UINT fftWindowFunction)
Vector< FastFourierTransform > getFFTResults()
bool setFFTWindowSize(UINT fftWindowSize)
bool setComputePhase(bool computePhase)
virtual bool computeFeatures(const VectorFloat &inputVector)
bool computeMagnitude
Tracks if the magnitude (and power) of the FFT need to be computed.
virtual bool saveModelToFile(std::fstream &file) const
FFT & operator=(const FFT &rhs)
bool isPowerOfTwo(UINT x)
A helper function to compute if the input is a power of two.
bool update(const Float x)