title: extract MFCCs feature out of pyaudio live audio stream
body: <p>I want to obtain this live audio stream of data to extract MFCCs feature without writing the stream to a wave file and reading back. How to convert the stream data to MFCC features?</p>
  <p>I have this code here that has 2 functions:</p>
  <ol>
  <li>function takes microphone input using Pyaudio (Listen())</li>
  <li>function that takes the data from the first function and try to predict if it's class 0 or 1 (predict())</li>
  </ol>
  <p>this script is to use a machine learning model to predict live audio (binary classification)</p>
  <pre><code>import pyaudio
  def listen():
      FORMAT = pyaudio.paInt16
      CHANNELS = 1
      RATE = 44100
      CHUNK = 1024
  
      audio = pyaudio.PyAudio()
      stream = audio.open(format=FORMAT,
                          channels=CHANNELS,
                          rate=RATE,
                          input=True,
                          frames_per_buffer=CHUNK)
  
      data = np.frombuffer(stream.read(CHUNK),dtype=np.int16)
      peak=np.average(np.abs(data))*2
      bars=&quot;#&quot;*int(50*peak/2**16)
      arr = np.array(&quot;%04d %05d %s&quot;%(i,peak,bars))
  
      mfcc = librosa.feature.mfcc(y=arr, sr=RATE, n_mfcc=40)
      mfcc_processed = np.mean(mfcc.T, axis=0)
      prediction_thread(mfcc_processed)
      time.sleep(0.001)
      
  
  def predict(y):
      prediction = model.predict(y)
      if prediction[:, 1] &gt; 0.96:
          print(&quot;ready!&quot;)
      else:
          print(&quot;not ready&quot;)
  </code></pre>
  <p>However it raises this error</p>
  <pre><code>raise ParameterError(&quot;Audio data must be floating-point&quot;)
  librosa.util.exceptions.ParameterError: Audio data must be floating-point
  </code></pre>
  <p>and I can't predict on the live audio that pyaudio is catching.</p>