title: Multichannel PyAudio with ASIO Support
body: <p>I'm attempting to interface to a PreSonus AudioBox 1818VSL with PyAudio on Win7, but am having some trouble recording more than 2 channels (stereo) at a time. The PreSonus driver creates many stereo input audio devices (ex. stereo channels 1&amp;2, 3&amp;4, etc.) and an 18 input channel ASIO device.  I can record from any of the stereo devices without issue. To minimize latency and record from > 2 channels, I'm trying to use the ASIO device. </p>
  
  <p>I've been using a build of PyAudio from <a href="http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio" rel="noreferrer">http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio</a>, which has compiled support for ASIO, DS, WMME, WASAPI, WDMKS.  </p>
  
  <p>Calls to <code>pyaudio_handle.is_format_supported()</code> show the ASIO device supports 8 to 32-bit data at 44.1, 48, and 96 kHz.</p>
  
  <p>Below is the dictionary returned by <code>pa.get_device_info_by_index(32)</code></p>
  
  <pre><code>{'defaultHighInputLatency': 0.046439909297052155,
  'defaultHighOutputLatency': 0.046439909297052155,
  'defaultLowInputLatency': 0.046439909297052155,
  'defaultLowOutputLatency': 0.046439909297052155,
  'defaultSampleRate': 44100.0,
  'hostApi': 2L,
  'index': 32,
  'maxInputChannels': 18L,
  'maxOutputChannels': 18L,
  'name': u'AudioBox ASIO Driver',
  'structVersion': 2L}
  </code></pre>
  
  <p>Below is the code that I have been using to create the PyAudio input stream. The callback function simply pushes the data into a list and returns <code>pyaudio.paContinue</code> until I get the amount of samples I want, then it returns <code>pyaudio.paComplete</code>. </p>
  
  <pre><code>pyaudio_handle = pyaudio.PyAudio()
  stream = pyaudio_handle.open(
      format=pyaudio.get_format_from_width(2,unsigned=False),
      channels=4,
      rate=48000,
      input=True,
      frames_per_buffer=256,
      input_device_index=32,
      stream_callback=pyaudio_stream_callback,
  )
  </code></pre>
  
  <p>Attempting to initialize the ASIO driver at rates faster than 44.1 kHz cause PyAudio to hang and not return. Initializing at 44.1 kHz produces the following error: <code>IOError: [Errno Unanticipated host error] -9999</code>.  </p>
  
  <p>Any help that you can provide resolving this error would be helpful. I would even settle for proof that ASIO works with > 2 channels in PyAudio when running on Win7.  Thanks. </p>