title: Python alsaaudio capturing sound
body: <p>I'm trying to capture data from microphone. Code is pretty simple but I get the error <code>alsaaudio.ALSAAudioError: Capture data too large. Try decreasing period size</code> for some reason. Tried google it but nothing...</p>
  
  <pre><code>res = []
  
  recoder = alsaaudio.PCM(type=alsaaudio.PCM_CAPTURE)
  recoder.setchannels(1)
  recoder.setrate(8000)
  recoder.setperiodsize(80)
  recoder.setformat(alsaaudio.PCM_FORMAT_S8)
  
  while len(res) &lt; 8000*5:
      len, frame = recoder.read()
  
      if len(frame) != 0:
          print(len)
          res.extend(frame)
  </code></pre>
  
  <p>The most interesting part is that decreasing doesn't help. But increasing changes the error: period size more than 135 gives me <code>Input output error</code>. </p>
  
  <p>OS Ubuntu 16.04. 
  Does anybody know what the problem is? </p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Removing recoder.setchannels(1) does the trick and I can set rate/period to 8000/80 and it works but can't set to 8000/10 for example. Got the same error. It seems like a bug.</p>