pyAudioAnalysis-audioFeatureExtraction 错误纠正
1. TypeError: mfccInitFilterBanks() takes 2 positional arguments but 7 were given
The issue
In the function stFeatureSpeed()
from audioFeatureExtraction.py make a call: [fbank, freqs] = mfccInitFilterBanks(Fs, nfft, lowfreq, linsc, logsc, nlinfil, nlogfil)
, but this function is only able to receive two arguments. It has the following signature: def mfccInitFilterBanks(fs, nfft)
The "extra" arguments are: lowfreq, linsc, logsc, nlinfil, nlogfil
These are all defined in the mfccInitFilterBanks function itself wit exactly the same values.
Note that there is a comment in the source code (audioFeatureExtraction.py) that says that the stFeatureSpeed()
function is work in progress. so there could be many (non obvious) bugs. apart from this one.
Solutions
Simply remove the arguments from the call in the stFeatureSpeed function.
2. TypeError: 'float' object cannot be interpreted as an integer
A quick fix might be to replacenfft = Win / 2
on line 680 of audioFeatureExtraction.py
with nfft = int(Win / 2)
,and modify this line of code x = signal[cur_p:cur_p + win]
-> x = signal[int(cur_p):int(cur_p + win)]
in function stFeatureSpeed.
3. TypeError: 'numpy.float64' object cannot be interpreted as an index
add astype(numpy.int) at the end of the line 125 :
M = numpy.round(0.016 * fs).astype(numpy.int) - 1
参考资料
GitHub
音频特征提取——pyAudioAnalysis工具包
