我正在尝试设计一个带阻滤波器,由于滤波器输出中的纳米值,它无法给我一个有效的(wav文件)输出。
输入是一段几秒钟的简单语音片段。
def bandstop(x, f1, f2):
fs, samples = wavfile.read(x)
N = 6 # filter order
rs = 60 # stop band minimum attenuation
b, a = signal.cheby2(N, rs, [2 * f1 / fs, 2 * f2 / fs], btype='bandstop')
xfiltered = signal.filtfilt(b, a, samples) # applying filter
wavfile.write("xfiltered.wav", fs, xfiltered) # returns unreadable file?
我正在用简单的
测试这个print xfiltered
找到nan值。任何解决方案?