MFCC的滑动平均滤波实现代码
时间: 2023-03-14 22:15:34 浏览: 65
MFCC滑动平均滤波的实现代码如下:from scipy.signal import butter, lfilterdef butter_bandpass(lowcut, highcut, fs, order=5):
nyq = 0.5 * fs
low = lowcut / nyq
high = highcut / nyq
b, a = butter(order, [low, high], btype='band')
return b, adef butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
b, a = butter_bandpass(lowcut, highcut, fs, order=order)
y = lfilter(b, a, data)
return y
相关问题
二维MFCC的滑动平均滤波实现代码
二维MFCC滑动平均滤波实现的代码可以参考下面的示例:
```
import numpy as np# Define the size of the sliding window
window_size = 32# Create an array of zeros to hold the sliding window
sliding_window = np.zeros(window_size)# Step through the MFCC array
for i in range(len(mfcc)):
# Add the current sample to the end of the sliding window
sliding_window[:-1] = sliding_window[1:]
sliding_window[-1] = mfcc[i]
# Calculate the average value of the sliding window
avg = np.mean(sliding_window)
# Output the filtered value
filtered_mfcc[i] = avg
```
阅读全文