48 #ifndef GRT_FFT_HEADER
49 #define GRT_FFT_HEADER
51 #include "../../CoreModules/FeatureExtraction.h"
52 #include "FastFourierTransform.h"
121 virtual bool clear();
130 virtual bool reset();
175 bool update(
const double x);
185 bool update(
const VectorDouble &x);
250 VectorDouble getFrequencyBins(
const unsigned int sampleRate);
313 vector< FastFourierTransform >
fft;
319 enum FFTWindowFunctionOptions{RECTANGULAR_WINDOW=0,BARTLETT_WINDOW,HAMMING_WINDOW,HANNING_WINDOW};
324 #endif //GRT_FFT_HEADER
GRT::VectorDouble tempBuffer
A temporary buffer used to store the input data for the FFT.
bool setFFTWindowFunction(UINT fftWindowFunction)
virtual bool saveModelToFile(fstream &file) const
vector< FastFourierTransform > & getFFTResultsPtr()
vector< FastFourierTransform > getFFTResults()
UINT hopSize
The current hopSize, this sets how often the fft should be computed.
FFT(UINT fftWindowSize=512, UINT hopSize=1, UINT numDimensions=1, UINT fftWindowFunction=RECTANGULAR_WINDOW, bool computeMagnitude=true, bool computePhase=true)
UINT dataBufferSize
Stores how much previous input data is stored in the dataBuffer.
virtual bool computeFeatures(const VectorDouble &inputVector)
bool getComputeMagnitude()
virtual bool deepCopyFrom(const FeatureExtraction *featureExtraction)
bool computePhase
Tracks if the phase of the FFT needs to be computed.
bool setComputeMagnitude(bool computeMagnitude)
FFT & operator=(const FFT &rhs)
UINT fftWindowSize
Stores the size of the fft (and also the dataBuffer)
bool computeMagnitude
Tracks if the magnitude (and power) of the FFT need to be computed.
bool setFFTWindowSize(UINT fftWindowSize)
vector< FastFourierTransform > fft
A buffer used to store the FFT results.
CircularBuffer< VectorDouble > dataBuffer
A circular buffer used to store the previous M inputs.
bool update(const double x)
UINT getFFTWindowFunction()
bool isPowerOfTwo(UINT x)
A helper function to compute if the input is a power of two.
std::map< unsigned int, unsigned int > windowSizeMap
A map to relate the FFTWindowSize enumerations to actual values.
bool setHopSize(UINT hopSize)
bool setComputePhase(bool computePhase)
UINT fftWindowFunction
The current windowFunction used for the FFT.
virtual bool loadModelFromFile(fstream &file)
UINT hopCounter
Keeps track of how many input samples the FFT has seen.