title: 20hz-20000hz Butterworth filtering exploding
body: <p>I want to filter out everything outside 20 Hz - 20000 Hz. I'm using a Butterworth filter:</p>
  
  <pre><code>from scipy.io import wavfile
  from scipy import signal
  import numpy
  
  sr, x = wavfile.read('sweep.wav')
  nyq = 0.5 * sr
  b, a = signal.butter(5, [20.0 / nyq, 20000.0 / nyq], btype='band')
  
  x = signal.lfilter(b, a, x)
  x = numpy.float32(x)
  x /= numpy.max(numpy.abs(x))
  wavfile.write('b.wav', sr, x)
  </code></pre>
  
  <p>I've noticed that it works with a 44.1 khz file, but <strong>not with a 96 khz WAV file</strong> (<a href="http://gget.it/ooeln2hi/sweep.wav" rel="nofollow noreferrer">demo file here</a>) (it's not an audio I/O problem): the output is either blank (silence) or exploding (with some other input wav files).</p>
  
  <p>1) Is there something that makes that the Butterworth filters don't work with a bandpass [b1, b2] where b2 &lt; 0.5 ?</p>
  
  <p>2) <strong>More generally, how would you do a filtering to keep only 20 - 20000Hz with Python / scipy?</strong> (no other external library)</p>