我有一个声音文件,我应用了高频滤镜
import wave
import scipy.io.wavfile as wav
import numpy as np
import scipy as sp
origAudio = wave.open('3734.wav','r')
frameRate = origAudio.getframerate()
nChannels = origAudio.getnchannels()
sampWidth = origAudio.getsampwidth()
nbframe=origAudio.getnframes()
da = np.fromstring(origAudio.readframes(frameRate), dtype=np.int16)
left, right = da[0::2], da[1::2]
b, a = signal.butter(2, 0.03,btype='highpass', analog=False)
left = signal.filtfilt(b, a, left)
hann = np.hanning(len(left))
l,f=np.fft.rfft(left*hann), np.fft.rfft(right)
plt.xscale('log')
plt.xlabel('frequency [Hz]')
plt.ylabel('|Magnitude|')
plt.plot(np.abs(l))
我获得了
但是我想从信号中去除噪音,只获得峰值。谢谢