2017-02-28 120 views
0

我想要获得我的wav文件的MFCC值。这是我的代码:MFCC采样频率

> import numpy as np 
> import scipy.io.wavfile 
> from scikits.talkbox.features import mfcc 
> sr1,x1=scipy.io.wavfile.read("filename.wav") 
> ceps1,mspec1,spec1=mfcc(x1) 

sr1 = 22050的值。但是在scikit.talkbox库中,mfcc()使用fs = 16000作为默认值。我该如何解决它?或者它对我造成什么问题?

回答

0

看看the docstring for mfcc。该函数的签名是

def mfcc(input, nwin=256, nfft=512, fs=16000, nceps=13): 

正如您在问题所指出,fs默认值是16000可以覆盖在你的代码中使用fs=sr1

ceps1, mspec1, spec1 = mfcc(x1, fs=sr1) 

(欲了解更多信息关于python functons的关键字参数,请参阅,例如,4.7.2. Keyword Arguments in the python tutorial。)