def get_fft_mel_mat(nfft, sr=8000, nfilts=None, width=1.0, minfrq=20, maxfrq=None, constamp=0):
if nfilts is None:
nfilts = nfft
if maxfrq is None:
maxfrq = sr // 2
wts = np.zeros((nfilts, nfft//2+1))
fftfrqs = np.arange(0, nfft//2+1) / (1. * nfft) * (sr)
minmel = hz2mel(minfrq)
maxmel = hz2mel(maxfrq)
binfrqs = mel2hz(minmel + np.arange(0, nfilts+2) / (nfilts+1.) * (maxmel - minmel))
# binbin = np.round(binfrqs / maxfrq * nfft)
for i in range(nfilts):
fs = binfrqs[[i+0, i+1, i+2]]
fs = fs[1] + width * (fs - fs[1])
loslope = (fftfrqs - fs[0]) / (fs[1] - fs[0])
hislope = (fs[2] - fftfrqs) / (fs[2] - fs[1])
wts[i, :] = np.maximum(0, np.minimum(loslope, hislope))
return wts
feature_extractor.py 文件源码
python
阅读 40
收藏 0
点赞 0
评论 0
评论列表
文章目录