title: Recognizing notes within recorded sound - Part 2 - Python
body: <p>this is a continuation of this question <a href="https://stackoverflow.com/questions/3600795/recognizing-notes-within-recorded-sound-python">here</a>.</p>
  
  <p><strong>This is the code I used in order to get the samples:</strong></p>
  
  <pre><code>spf = wave.open(speech,'r')
  sound_info = spf.readframes(-1)
  sound_info = fromstring(sound_info, 'Int16')
  </code></pre>
  
  <hr>
  
  <p>The <strong>length of sound_info is 194560</strong>, which is <strong>4.4 times the sample rate of 44100</strong>. The length of the sound file is <strong>2.2 seconds</strong>, so isn't sound_info twice the length it should be?</p>
  
  <p>Also I can only seem to find enough info on <strong>why FFTs are used in order to produce the frequency spectrum</strong>.</p>
  
  <p>I would like to split a sound up and analyse the frequency spectrum of multiple fractions of a second, rather than the whole sound file.</p>
  
  <hr>
  
  <p>Help would be very much appreciated. :)</p>
  
  <hr>
  
  <p><strong>This is the basic sound_info graph</strong></p>
  
  <pre><code>plot(sound_info)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/kwn4L.png" width="466" /></p>
  
  <p><strong>This is the FFT graph</strong></p>
  
  <pre><code>freq = [abs(x.real) for x in fft(sound_info)]
  plot(freq)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/onDwH.png" width="466" /></p>