spatialaudio / python-sounddevice

:sound: Play and Record Sound with Python :snake:
https://python-sounddevice.readthedocs.io/
MIT License
980 stars 145 forks source link

How to know which is the sound input device and which is the output device? #416

Closed clouddea closed 1 year ago

clouddea commented 2 years ago

as title。

When I call sd.query_devices(), I get an array like: image

However, which attribute of them can be used as a feature of device type?

HaHeho commented 2 years ago

What do you mean by device type?

peder82 commented 2 years ago

It says in the last parenthesis (X in, Z out), it uses 0 for not applicable. 'In' is microphone and 'out' is speaker. So you have two devices which is microphones and one which is speaker.

clouddea commented 2 years ago

It says in the last parenthesis (X in, Z out), it uses 0 for not applicable. 'In' is microphone and 'out' is speaker. So you have two devices which is microphones and one which is speaker.

I thought so in the beginning, but on windows 10 I found some devices with more than one 'In'. When I tried to read from them using InputStream(), an error occurred. I will give a picture later.

clouddea commented 1 year ago

devices: WX20220707-161855

error: WX20220707-162019

HaHeho commented 1 year ago

Each device has a separate entry for the three different backends that you have available on Windows. I don't know which one of these is to be preferred. I know ASIO (a fourth one) would be preferred for low-latency audio on Windows, but this requires specific drivers to be available for your device (which you don't seem to have).

I suppose just try which one is going to work for you. I believe you have to invoke the device name including the backend name (if there is multiple available), so that the device can be uniquely identified.

clouddea commented 1 year ago

Each device has a separate entry for the three different backends that you have available on Windows. I don't know which one of these is to be preferred. I know ASIO (a fourth one) would be preferred for low-latency audio on Windows, but this requires specific drivers to be available for your device (which you don't seem to have).

I suppose just try which one is going to work for you. I believe you have to invoke the device name including the backend name (if there is multiple available), so that the device can be uniquely identified.

thank you!