如何从波形文件中删除噪音

时间:2016-08-01 14:40:27

标签: python pandas scipy fft wav

我有一个声音文件,我应用了高频滤镜

   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))

我获得了

enter image description here

但是我想从信号中去除噪音,只获得峰值。谢谢

0 个答案:

没有答案