Skip to content

Commit f8b181b

Browse files
MFCC python script improved
Python scripts used to generate MFCC tables for the C implementation has been improved. The windowing function no more take into account the 0 padding of the FFT.
1 parent 615798f commit f8b181b

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

Scripts/mfccdata.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,21 @@ def prepareWindowConfig(configs):
193193
# sig.hamming(FFTSize, sym=False)
194194
for config in configs:
195195
c=configs[config]
196+
if "frameLength" in c:
197+
frameLength = c["frameLength"]
198+
else:
199+
frameLength = c["fftlength"]
200+
print("Warning: frameLength not specified, using fftlength")
196201
if c["win"] == "hamming":
197-
win = sw.hamming(c["fftlength"], sym=False)
202+
win = sw.hamming(frameLength, sym=False)
198203
if c["win"] == "hanning":
199-
win = sw.hann(c["fftlength"], sym=False)
204+
win = sw.hann(frameLength, sym=False)
205+
200206

201207
cvt=ConvertArray(c["type"])
202208
c["ctype"]=ctype(c["type"])
203209
c["ext"]=typeext(c["type"])
210+
c["winLength"] = frameLength
204211

205212
c["winSamples"] = cvt.getArrayContent(win)
206213

Scripts/mfcctemplates/mfccdata.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extern const {{configs["dct"][config]["ctype"]}} mfcc_dct_coefs_{{config}}[NB_MF
4747

4848
{% for config in configs["window"] %}
4949
{{iff16("window",config)}}
50-
#define NB_MFCC_WIN_COEFS_{{config.upper()}} {{configs["window"][config]['fftlength']}}
50+
#define NB_MFCC_WIN_COEFS_{{config.upper()}} {{configs["window"][config]['winLength']}}
5151
extern const {{configs["window"][config]["ctype"]}} mfcc_window_coefs_{{config}}[NB_MFCC_WIN_COEFS_{{config.upper()}}];
5252
{{endiff16("window",config)}}
5353

0 commit comments

Comments
 (0)