List all audio devices with Python's pyaudio (portaudio binding)

Basj picture Basj · Dec 24, 2013 · Viewed 18.2k times · Source

I tried

import pyaudio
p = pyaudio.PyAudio()
for i in range(p.get_device_count()):
    print p.get_device_info_by_index(i)

but I don't get the full list of all devices : for example I don't get ASIO devices in this list. This is strange, because portaudio should give ASIO devices as well, right ?

How can I list all audio devices with pyaudio ?

Answer

Matthias picture Matthias · Dec 9, 2015

I've created (a while after this question was posted) the sounddevice module for Python, which includes its own DLLs with ASIO support (and all other host APIs, too). It can be installed with:

pip install sounddevice --user

After that, you can list all your devices with:

python -m sounddevice

Of course you can also do this within Python:

import sounddevice as sd
sd.query_devices()