Gist
Public Member Functions | Public Attributes | List of all members
MFCC< T > Class Template Reference

#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
 

Detailed Description

template<class T>
class MFCC< T >

Template class for calculating Mel Frequency Cepstral Coefficients Instantiations of the class should be of either 'float' or 'double' types and no others

Constructor & Destructor Documentation

◆ MFCC()

template<class T >
MFCC< T >::MFCC ( int  frameSize_,
int  samplingFrequency_ 
)

Constructor

Member Function Documentation

◆ calculateMelFrequencyCepstralCoefficients()

template<class T >
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.

Parameters
magnitudeSpectrumthe magnitude spectrum in vector format

◆ calculateMelFrequencySpectrum()

template<class T >
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.

◆ setFrameSize()

template<class T >
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()

Parameters
frameSize_the frame size

◆ setNumCoefficients()

template<class T >
void MFCC< T >::setNumCoefficients ( int  numCoefficients_)

Set the number of coefficients to calculate

Parameters
numCoefficients_the number of coefficients to calculate

◆ setSamplingFrequency()

template<class T >
void MFCC< T >::setSamplingFrequency ( int  samplingFrequency_)

Set the sampling frequency

Parameters
samplingFrequency_the sampling frequency in hz

Member Data Documentation

◆ melSpectrum

template<class T >
std::vector<T> MFCC< T >::melSpectrum

a vector to hold the mel spectrum once it has been computed

◆ MFCCs

template<class T >
std::vector<T> MFCC< T >::MFCCs

a vector to hold the MFCCs once they have been computed


The documentation for this class was generated from the following files: