4 #include "GRT/CoreModules/FeatureExtraction.h" 27 void initialize(uint32_t num_filter, uint32_t filter_size);
28 void setFilter(uint32_t idx,
double left,
double middle,
double right,
32 return 1127.0f * log(1.0f + freq / 700.0f);
36 return 700.0f * (exp(mel_freq / 1127.0f) - 1.0f);
43 void filter(
const vector<double>& input, vector<double>& output);
49 uint32_t filter_size_;
89 class MFCC :
public FeatureExtraction {
102 : sample_rate(0), fft_size(0), start_freq(-1), end_freq(-1),
103 num_tri_filter(0), num_cepstral_coeff(0), lifter_param(0),
104 use_vad(false), noise_level(0) {
115 this->use_vad == rhs.
use_vad &&
124 bool deepCopyFrom(
const FeatureExtraction* featureExtraction)
override;
126 delete[] dct_matrix_;
131 bool computeFeatures(
const VectorDouble& inputVector)
override;
132 bool reset()
override;
141 bool saveModelToFile(
string filename)
const override;
142 bool loadModelFromFile(
string filename)
override;
143 bool saveModelToFile(fstream &file)
const override;
144 bool loadModelFromFile(fstream &file)
override;
154 void computeLFBE(
const vector<double>& fft, vector<double>& lfbe);
155 void computeCC(
const vector<double>& lfbe, vector<double>& cc);
156 vector<double> getCC(
const vector<double>& lfbe);
157 vector<double> lifterCC(
const vector<double>& cc);
176 #endif // ESP_MFCC_H_
TriFilterBanks filters_
Definition: MFCC.h:166
vector< double > tmp_cc_
Definition: MFCC.h:169
~MFCC() override
Definition: MFCC.h:125
Options()
Definition: MFCC.h:101
uint32_t fft_size
Definition: MFCC.h:93
bool use_vad
Definition: MFCC.h:99
~TriFilterBanks()
Definition: MFCC.cpp:53
Definition: Filter.cpp:23
vector< double > tmp_lfbe_
Definition: MFCC.h:168
double noise_level
Definition: user_speaker.cpp:20
void setFilter(uint32_t idx, double left, double middle, double right, uint32_t fs)
Definition: MFCC.cpp:31
TriFilterBanks getFilters() const
Definition: MFCC.h:149
TriFilterBanks()
Definition: MFCC.cpp:21
double start_freq
Definition: MFCC.h:94
Options options_
Definition: MFCC.h:161
uint32_t num_tri_filter
Definition: MFCC.h:96
uint32_t lifter_param
Definition: MFCC.h:98
bool setNoiseLevel(double noise_level)
Definition: MFCC.h:135
bool operator==(const Options &rhs)
Definition: MFCC.h:107
void filter(const vector< double > &input, vector< double > &output)
Definition: MFCC.cpp:59
double noise_level
Definition: MFCC.h:100
uint32_t getNumFilters() const
Definition: MFCC.h:39
static double toMelScale(double freq)
Definition: MFCC.h:31
void initialize(uint32_t num_filter, uint32_t filter_size)
Definition: MFCC.cpp:24
static double fromMelScale(double mel_freq)
Definition: MFCC.h:35
uint32_t sample_rate
Definition: MFCC.h:92
static RegisterFeatureExtractionModule< MFCC > registerModule
Definition: MFCC.h:171
uint32_t num_cepstral_coeff
Definition: MFCC.h:97
bool initialized_
Definition: MFCC.h:160
double end_freq
Definition: MFCC.h:95
double * dct_matrix_
Definition: MFCC.h:165