spatialaudio / python-sounddevice

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

Sound device (microphone) missing in listed devices. #420

Open peder82 opened 2 years ago

peder82 commented 2 years ago

When I am listing devices with sound device, I am missing my Desk Digital Audio microphone, it only shows output (0in, 2out)!

user@ubuntu:~$ python -m sounddevice
  0 HDA Intel PCH: HDMI 0 (hw:0,3), ALSA (0 in, 8 out)
  1 HDA Intel PCH: HDMI 1 (hw:0,7), ALSA (0 in, 2 out)
  2 HDA Intel PCH: HDMI 2 (hw:0,8), ALSA (0 in, 8 out)
  3 HDA Intel PCH: HDMI 3 (hw:0,9), ALSA (0 in, 8 out)
  4 HDA Intel PCH: HDMI 4 (hw:0,10), ALSA (0 in, 8 out)
  5 Desk Digital Audio: USB Audio (hw:1,0), ALSA (0 in, 2 out)
  6 hdmi, ALSA (0 in, 8 out)
  7 pulse, ALSA (32 in, 32 out)
* 8 default, ALSA (32 in, 32 out)

With aplay and arecord my desk digital audio have both speaker and microphone, and inside ubuntu sound settings it works fine with both speaker and microphone.

user@ubuntu:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Audio [Desk Digital Audio], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
user@ubuntu:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Audio [Desk Digital Audio], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0

How to troubleshoot the missing device?

peder82 commented 2 years ago

A bit more info

>>> import sounddevice as sd
>>> print(sd.get_portaudio_version())
(1246720, 'PortAudio V19.6.0-devel, revision 396fe4b6699ae929d3a685b3ef8a7e97396139a4')
>>> print(sd._libname)
libportaudio.so.2
user@ubuntu:~$ uname -a
Linux ubuntu 5.15.0-40-generic #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
mgeier commented 2 years ago

The information about input and output channels comes from the PortAudio library.

Maybe you can try the latest version, v19.7 should be available.

If there is no package, you can try to compile it from source.

If this doesn't help, you should ask the PortAudio people: http://portaudio.com/contacts.html

qpanpony commented 2 years ago

Same sounddevice.query_devices (microphone) missing issues as @peder82. I've tried the latest PortAudio version (v19.7), no success.