title: Create a band-pass filter via Scipy in Python?
body: <p>Is there a way to create a quick bandpass filter via <code>scipy</code> or <code>librosa</code> in Python 3.6 for a 16KHz wav file to filter noise outside of human voice band of 300-3400Hz ? Here is a <a href="https://drive.google.com/open?id=1HF1FfNA90Qj0Wd2IobafED8ol7ur02P1" rel="nofollow noreferrer">sample wav file</a> with background noise at low frequency.</p>
  
  <p>UPDATE:
  Yes, I have already seen/tried <a href="https://stackoverflow.com/questions/12093594/how-to-implement-band-pass-butterworth-filter-with-scipy-signal-butter">How to implement band-pass Butterworth filter with Scipy.signal.butter</a> .  Unfortunately, the filtered sound is horribly deformed. Essentially, the whole code does this: </p>
  
  <pre><code>lo,hi=300,3400
  sr,y=wavfile.read(wav_file)
  b,a=butter(N=6, Wn=[2*lo/sr, 2*hi/sr], btype='band')
  x = lfilter(b,a,y)
  sounddevice.play(x, sr)  # playback
  </code></pre>
  
  <p>What am I doing wrong or how can this be improved so that the background noise is filtered out correctly.</p>
  
  <p>Here is the visualization of the original and filtered file using the link above. The visualization looks reasonable, but it sounds horrible :( How can this be fixed?</p>
  
  <p><a href="https://i.stack.imgur.com/9LZLy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9LZLy.png" alt="enter image description here"></a></p>