PyAudio IOError: No Default Input Device Available

Gus picture Gus · Jan 12, 2011 · Viewed 27.7k times · Source

I'm using PyAudio under the Enthought Python Distribution (Python 2.6.6) in Ubuntu 10.10 x64.

>>> import pyaudio
>>> pa = pyaudio.PyAudio()
>>> pa.get_default_input_device_info()

Traceback (most recent call last):
  File "<pyshell#24>", line 1, in <module>
    pa.get_default_input_device_info()
  File "/usr/lib/python_epd/lib/python2.6/site-packages/pyaudio.py", line 936, in get_default_input_device_info
    device_index = pa.get_default_input_device()
IOError: No Default Input Device Available

This is the same error I get if I try to open an input stream. There is the corresponding error "IOError: No Default Output Device Available"

Answer

archiboldian picture archiboldian · Jul 22, 2011

I would recommend PYO for audio I/O and synthesis, I found it really easy to pick up. Here's some code to illustrate how I would get PYO to get and output an audio input after processing it to change it's pitch:

from pyo import *
serv = Server(duplex=1).boot()
serv.start()
shiftfreq = 329.63
# 329.63 is the frequency for the E note
mic = Input(chnl=0)
shift = FreqShift(mic, shift=shiftfreq, mul=.5).out()
serv.gui(locals())

PYO also lets you change frequencies and parameters of synthesis, generators or anything on the fly, which was the biggest draw for me because I use it mostly for programming live synthesiser instruments.

It also has a great manual...