我使用陷波滤波器去除正弦(频率= 1KHZ),但看起来信号开头有问题。
#1kHZ fs=44100
l = np.cos(2*1000.0*np.pi/44100.0 )
r = 0.999
#Notch Filter
b=[1, -2*l, 1]
a=[1, -2*l*r, r*r]
#Get data from wav file
data, f, n = _wave_get_data("C:/SourceCode/Auana-P/sine/SINE_02.wav")
#filter
zi = signal.lfilter_zi(b, a)
y,zf=signal.lfilter(b, a, data[0], zi=zi)
#plot
n = len(y)
x = np.arange(0, n)
pl.plot(x,y)
pl.show()