Gist
|
#include <MFCC.h>
Public Member Functions | |
MFCC (int frameSize_, int samplingFrequency_) | |
void | setNumCoefficients (int numCoefficients_) |
void | setFrameSize (int frameSize_) |
void | setSamplingFrequency (int samplingFrequency_) |
void | calculateMelFrequencyCepstralCoefficients (const std::vector< T > &magnitudeSpectrum) |
void | calculateMelFrequencySpectrum (const std::vector< T > &magnitudeSpectrum) |
Public Attributes | |
std::vector< T > | melSpectrum |
std::vector< T > | MFCCs |
Template class for calculating Mel Frequency Cepstral Coefficients Instantiations of the class should be of either 'float' or 'double' types and no others
void MFCC< T >::calculateMelFrequencyCepstralCoefficients | ( | const std::vector< T > & | magnitudeSpectrum | ) |
Calculates the Mel Frequency Cepstral Coefficients from the magnitude spectrum of a signal. The result is stored in the public vector MFCCs.
Note that the magnitude spectrum passed to the function is not the full mirrored magnitude spectrum, but only the first half. The frame size passed to the constructor should be twice the length of the magnitude spectrum.
magnitudeSpectrum | the magnitude spectrum in vector format |
void MFCC< T >::calculateMelFrequencySpectrum | ( | const std::vector< T > & | magnitudeSpectrum | ) |
Calculates the magnitude spectrum on a Mel scale. The result is stored in the public vector melSpectrum.
void MFCC< T >::setFrameSize | ( | int | frameSize_ | ) |
Set the frame size - N.B. this will be twice the length of the magnitude spectrum passed to calculateMFCC()
frameSize_ | the frame size |
void MFCC< T >::setNumCoefficients | ( | int | numCoefficients_ | ) |
Set the number of coefficients to calculate
numCoefficients_ | the number of coefficients to calculate |
void MFCC< T >::setSamplingFrequency | ( | int | samplingFrequency_ | ) |
Set the sampling frequency
samplingFrequency_ | the sampling frequency in hz |
std::vector<T> MFCC< T >::melSpectrum |
a vector to hold the mel spectrum once it has been computed
std::vector<T> MFCC< T >::MFCCs |
a vector to hold the MFCCs once they have been computed