python-sounddevice icon indicating copy to clipboard operation
python-sounddevice copied to clipboard

sounddevice.query_devices() is returning nothing .

Open 53X opened this issue 4 years ago • 8 comments

sounddevice.query_devices() is returning nothing .

portaudio version is V19.6.0-devel on WSL ( Ubuntu 18.04 LTS )

53X avatar Apr 18 '21 13:04 53X

I assume you tried to receive the returned values or did print(sounddevice.query_devices())?

HaHeho avatar Apr 20 '21 11:04 HaHeho

Hi, I've got the same issue. Whenever I try to print(sounddevice.query_devices()) it returns nothing, and even python -m sounddevice returns nothing, even though I've got multiple input and output audio devices.

TebaiOsama avatar Apr 22 '21 12:04 TebaiOsama

That is strange. Also no error message?

Are you certain you are using a sensible Python environment, where the package is installed?

@mgeier do you have any idea how to investigate further?

HaHeho avatar Apr 22 '21 13:04 HaHeho

I don't know how audio devices work on WSL ...

Do other programs handle audio correctly?

Maybe there are some special permissions needed to access audio devices?

Is ALSA used on WSL? What does aplay -L say?

How did you install/compile PortAudio? Maybe some special build options are needed?

Did you try other things that use PortAudio, e.g. PyAudio or Audacity?

Anyway, the sounddevice module only shows the devices it gets from PortAudio, maybe you could ask those people: http://portaudio.com/contacts.html.

mgeier avatar Apr 22 '21 13:04 mgeier

I just tried everything from scratch with a virtualenv, using python version 3.7.3 and pip version 21.0.1, and got the same result. I am also using WSL, so maybe that's the issue? I also can't install pyaudio using pip.

TebaiOsama avatar Apr 22 '21 13:04 TebaiOsama

aplay -l leaves with long stack of ALSA-lib errors .

pyaudio.get_device_count() returns 0 as well

53X avatar Apr 22 '21 21:04 53X

❯ aplay -L null Discard all samples (playback) or generate zero samples (capture) ❯ aplay -l aplay: device_list:276: no soundcards found...

>>> import sounddevice as sd >>> sd.query_devices()

>>> sd.get_portaudio_version() (1246976, 'PortAudio V19.7.0-devel, revision 147dd722548358763a8b649b3e4b41dfffbcfbb6')

Installing vlc (and maybe running) fixed this issue (not sure what happened but it's working now, maybe it actually was restarting my shell)

>>> import sounddevice as sd >>> sd.query_devices() 0 pulse, ALSA (32 in, 32 out) * 1 default, ALSA (32 in, 32 out)

tom-huntington avatar May 27 '22 01:05 tom-huntington

I still getting no sound devices from nix-shell despite vlc working from nix

tom-huntington avatar May 27 '22 02:05 tom-huntington