title: Scipy Butter bandpass is not producing the desired results
body: <p>So I'm trying to bandpass filter a wav PCM 24-bit 44.1khz file. What I would like to do is bandpass each frequency from 0Hz-22Khz. </p>
  
  <p>So far I have loaded the data and can display it on Matplot and it looks like the following.</p>
  
  <p><a href="https://i.stack.imgur.com/JfnYY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JfnYY.png" alt="enter image description here"></a></p>
  
  <p>But when I go to apply the bandpass filter which I got from here </p>
  
  <p><a href="http://scipy-cookbook.readthedocs.io/items/ButterworthBandpass.html" rel="nofollow noreferrer">http://scipy-cookbook.readthedocs.io/items/ButterworthBandpass.html</a></p>
  
  <p>I get the following result:
  <a href="https://i.stack.imgur.com/zF6TY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zF6TY.png" alt="enter image description here"></a></p>
  
  <p>So I'm trying to bandpass at 100-101Hz as a test, here is my code:</p>
  
  <pre><code>from WaveData import WaveData
  import matplotlib.pyplot as plt
  from scipy.signal import butter, lfilter, freqz
  from scipy.io.wavfile import read
  import numpy as np
  from WaveData import WaveData
  
  class Filter:
          def __init__(self, wav):
                  self.waveData = WaveData(wav)
  
          def butter_bandpass(self, lowcut, highcut, fs, order=5):
                  nyq = 0.5 * fs
                  low = lowcut / nyq
                  high = highcut / nyq
                  b, a = butter(order, [low, high], btype='band')
                  return b, a
  
          def butter_bandpass_filter(self, data, lowcut, highcut, fs, order):
                  b, a = self.butter_bandpass(lowcut, highcut, fs, order=order)
                  y = lfilter(b, a, data)
                  return y
  
          def getFilteredSignal(self, freq):
                  return self.butter_bandpass_filter(data=self.waveData.file['Data'], lowcut=100, highcut=101, fs=44100, order=3)
  
          def getUnprocessedData(self):
              return self.waveData.file['Data']
  
          def plot(self, signalA, signalB=None):
                  plt.plot(signalA)
                  if signalB != None:
                          plt.plot(signalB)
                  plt.show()
  
  if __name__ == "__main__":
          # file = WaveData("kick.wav")
          # fileA = read("kick0.wav")
          f = Filter("kick.wav")
          a, b = f. butter_bandpass(lowcut=100, highcut=101, fs=44100)
          w, h = freqz(b, a, worN=22000) ##Filted signal is not working?
          f.plot(h, w)
          print("break")
  </code></pre>
  
  <p>I dont understand where I have gone wrong. </p>
  
  <p>Thanks</p>