def ams_extractor(x, sr, win_len, shift_len, order):
from scipy.signal import hilbert
envelope = np.abs(hilbert(x))
for i in range(order-1):
envelope = np.abs(hilbert(envelope))
envelope = envelope * 1./3.
frames = (len(envelope) - win_len) // shift_len
hanning_window = np.hanning(win_len)
ams_feature = np.zeros(shape=(15, frames))
wts = cal_triangle_window(0, sr//2, win_len, 15, 15.6, 400)
for i in range(frames):
one_frame = x[i*shift_len:i*shift_len+win_len]
one_frame = one_frame * hanning_window
frame_fft = np.abs(np.fft.fft(one_frame, win_len))
ams_feature[:,i] = np.matmul(wts, frame_fft)
return ams_feature
cal_triangle_window.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录