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

前端 未结 3 1086
天命终不由人
天命终不由人 2021-02-14 22:37

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 th

3条回答
  •  情书的邮戳
    2021-02-14 23:12

    I think your expectations are reasonable. The equivalent C code to enumerate PortAudio devices would give you all available devices. There are a couple of things that could be wrong:

    • Your build of PyAudio has not been compiled with ASIO support. PortAudio will only enumerate devices for the native host APIs that have been configured/compiled in at compile time.

    • You have a 64-bit build of Python/PyAudio and your ASIO device drivers are 32-bit, or vis-versa (64-bit ASIO drivers and 32-bit Python).

    As Multimedia Mike suggests, you can eliminate PyAudio from the equation by enumerating PA devices from C. The pa_devs.c program in the PortAudio distribution does this.

提交回复
热议问题