#include <sent/stddefs.h>
#include <sent/mfcc.h>
Include dependency graph for mfcc-core.c:
Go to the source code of this file.
Functions | |
void | make_costbl_hamming (int framesize) |
void | make_fft_table (int n) |
void | make_costbl_makemfcc (int fbank_num, int mfcc_dim) |
void | make_sintbl_wcep (int lifter, int mfcc_dim) |
float | Mel (int k, float fres) |
FBankInfo | InitFBank (Value para) |
void | FreeFBank (FBankInfo fb) |
void | ZMeanFrame (float *wave, int framesize) |
float | CalcLogRawE (float *wave, int framesize) |
void | PreEmphasise (float *wave, Value para) |
void | Hamming (float *wave, int framesize) |
void | FFT (float *xRe, float *xIm, int p) |
void | MakeFBank (float *wave, double *fbank, FBankInfo fb, Value para, float *ssbuf) |
float | CalcC0 (double *fbank, Value para) |
void | MakeMFCC (double *fbank, float *mfcc, Value para) |
void | WeightCepstrum (float *mfcc, Value para) |
void | WMP_calc_init (Value para, float **bf, int *bflen) |
void | WMP_calc (float *mfcc, float *bf, Value para, float *ssbuf) |
void | WMP_calc_fin (float *bf) |
Variables | |
static double * | costbl_hamming |
Cos table for hamming window. | |
static int | costbl_hamming_len = 0 |
Length of above. | |
static double * | costbl_fft |
Cos table for FFT. | |
static double * | sintbl_fft |
Sin table for FFT. | |
static int | tbllen = 0 |
Length of above. | |
static double * | costbl_makemfcc |
Cos table for DCT. | |
static int | costbl_makemfcc_len = 0 |
Length of above. | |
static double * | sintbl_wcep |
Sin table for cepstrum weighting. | |
static int | sintbl_wcep_len = 0 |
Length of above. | |
static float | sqrt2var |
Work area that holds value of sqrt(2.0) / fbank_num. | |
static double * | fbank |
Local buffer to hold filterbank. | |
static FBankInfo | fb |
Local buffer to hold filterbank information. |
Definition in file mfcc-core.c.
void make_costbl_hamming | ( | int | framesize | ) |
Generate table for hamming window.
framesize | [in] window size |
Definition at line 63 of file mfcc-core.c.
Referenced by new_SS_calculate().
void make_fft_table | ( | int | n | ) |
Build tables for FFT.
n | [in] 2^n = FFT point |
Definition at line 94 of file mfcc-core.c.
Referenced by new_SS_calculate().
void make_costbl_makemfcc | ( | int | fbank_num, | |
int | mfcc_dim | |||
) |
Generate table for DCT operation to make mfcc from fbank.
fbank_num | [in] number of filer banks | |
mfcc_dim | [in] number of dimensions in MFCC |
Definition at line 127 of file mfcc-core.c.
void make_sintbl_wcep | ( | int | lifter, | |
int | mfcc_dim | |||
) |
Generate table for weighing cepstrum.
lifter | [in] cepstral liftering coefficient | |
mfcc_dim | [in] number of dimensions in MFCC |
Definition at line 165 of file mfcc-core.c.
float Mel | ( | int | k, | |
float | fres | |||
) |
Return mel-frequency.
k | [in] channel number of filter bank | |
fres | [in] constant value computed by "1.0E7 / (para.smp_period * fb.fftN * 700.0)" |
Definition at line 199 of file mfcc-core.c.
Referenced by InitFBank().
Build filterbank information and generate tables for MFCC comptutation.
para | [in] configuration parameters |
Definition at line 211 of file mfcc-core.c.
Referenced by WMP_calc_init().
void FreeFBank | ( | FBankInfo | fb | ) |
Free FBankInfo.
fb | [in] filterbank information |
Definition at line 305 of file mfcc-core.c.
Referenced by WMP_calc_fin().
void ZMeanFrame | ( | float * | wave, | |
int | framesize | |||
) |
Remove DC offset per frame
wave | [i/o] waveform data in the current frame | |
framesize | [in] frame size |
Definition at line 322 of file mfcc-core.c.
Referenced by new_SS_calculate(), and WMP_calc().
float CalcLogRawE | ( | float * | wave, | |
int | framesize | |||
) |
Calculate Log Raw Energy.
wave | [in] waveform data in the current frame | |
framesize | [in] frame size |
Definition at line 341 of file mfcc-core.c.
Referenced by WMP_calc().
void PreEmphasise | ( | float * | wave, | |
Value | para | |||
) |
Apply pre-emphasis filter.
wave | [i/o] waveform data in the current frame | |
para | [in] configuration parameters |
Definition at line 360 of file mfcc-core.c.
Referenced by new_SS_calculate(), and WMP_calc().
void Hamming | ( | float * | wave, | |
int | framesize | |||
) |
Apply hamming window.
wave | [i/o] waveform data in the current frame | |
framesize | [in] frame size |
Definition at line 375 of file mfcc-core.c.
Referenced by new_SS_calculate(), and WMP_calc().
void FFT | ( | float * | xRe, | |
float * | xIm, | |||
int | p | |||
) |
Apply FFT
xRe | [i/o] real part of waveform | |
xIm | [i/o] imaginal part of waveform | |
p | [in] 2^p = FFT point |
Definition at line 396 of file mfcc-core.c.
Convert wave -> (spectral subtraction) -> mel-frequency filterbank
wave | [in] waveform data in the current frame | |
fbank | [out] the resulting mel-frequency filterbank | |
fb | [in] filterbank information | |
para | [in] configuration parameters | |
ssbuf | [in] noise spectrum, or NULL if not apply subtraction |
Definition at line 450 of file mfcc-core.c.
Referenced by WMP_calc().
float CalcC0 | ( | double * | fbank, | |
Value | para | |||
) |
Calculate 0'th cepstral coefficient.
fbank | [in] filterbank | |
para | [in] configuration parameters |
Definition at line 510 of file mfcc-core.c.
Referenced by WMP_calc().
void MakeMFCC | ( | double * | fbank, | |
float * | mfcc, | |||
Value | para | |||
) |
Apply DCT to filterbank to make MFCC.
fbank | [in] filterbank | |
mfcc | [out] output MFCC vector | |
para | [in] configuration parameters |
Definition at line 528 of file mfcc-core.c.
Referenced by WMP_calc().
void WeightCepstrum | ( | float * | mfcc, | |
Value | para | |||
) |
Re-scale cepstral coefficients.
mfcc | [i/o] a MFCC vector | |
para | [in] configuration parameters |
Definition at line 562 of file mfcc-core.c.
Referenced by WMP_calc().
void WMP_calc_init | ( | Value | para, | |
float ** | bf, | |||
int * | bflen | |||
) |
Initialize calculation functions and work areas.
para | [in] configuration parameters | |
bf | [out] returns pointer to newly allocated window buffer | |
bflen | [out] length of bf |
Definition at line 605 of file mfcc-core.c.
Referenced by WMP_init().
void WMP_calc | ( | float * | mfcc, | |
float * | bf, | |||
Value | para, | |||
float * | ssbuf | |||
) |
Calculate MFCC and log energy for one frame. Perform spectral subtraction if ssbuf is specified.
mfcc | [out] buffer to hold the resulting MFCC vector | |
bf | [i/o] work area for FFT | |
para | [in] configuration parameters | |
ssbuf | [in] noise spectrum, or NULL if not using spectral subtraction |
Definition at line 632 of file mfcc-core.c.
Referenced by RealTimePipeLine(), and Wav2MFCC().
void WMP_calc_fin | ( | float * | bf | ) |
Free work area for MFCC computation
bf | [in] window buffer previously allocated by WMP_calc_init() |
Definition at line 674 of file mfcc-core.c.