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"
Check this https://github.com/shichao-an/soundmeter/issues/7
All you have to do is install ALSA :
sudo apt-get install libasound-dev
then build portaudio (this version
pa_stable_v190600_20161030.tgz
) http://www.portaudio.com/download.htmlthen Get root privileges (
sudo su root
under Ubuntu where plainsu root
does not work.)Place the portaudio archive in
/usr/src
and unpack it withtar xvfz pa_snapshot.tgz
This will generate the directory/usr/src/portaudio
.Descend into this directory and execute these commands:
The
linrad
configure script has to be run after the successful installation of portaudio to make Linrad aware of the fact that portaudio is available.Make sure you get ALSA as yes in the
./configure
fileInstall the latest version of
pyaudio
(PyAudio-0.2.11.tar.gz
)http://people.csail.mit.edu/hubert/pyaudio/
Did you install the PortAudio software? It is required fot the
pyaudio
to work.OK, here is a solution that isn't pretty but works for me. As per my comment to ulidtko's answer, pyaudio is not the problem but rather the underlying PortAudio that pyaudio is supposed to bind to.
On ubuntu the portaudio drivers are installed with this package:
You must have this already, since you said your stock ubuntu runs your code fine (albeit with some debug messages that can be ignored)
If you query the location of your portaudio module you will find the following when you are running enthought's python:
and the following on stock ubuntu:
I moved the enthought _portaudio.so out of the way and replaced it with a link to the system _portaudio.so and now everything including the lovely spectrum analyzer in the chaco demo/advanced directory works:
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:
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...