Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sounddevice not finding valid USB device on Bullseye #471

Open
dghnugent opened this issue Jun 9, 2023 · 6 comments
Open

Sounddevice not finding valid USB device on Bullseye #471

dghnugent opened this issue Jun 9, 2023 · 6 comments

Comments

@dghnugent
Copy link

I have used Sounddevice successfully on previous projects running on Debian Buster. I know how it works and how to install it etc.

Presently I am working on Bullseye 32-bit kernel. Sounddevice no longer works because it does not find the USB microphone. It's the same microphone running the same python commands.

The USB microphone (ZOOM H3-VR) connects without issue to RPi 4B and is listed by lsusb. The microphone operates successfully using the GNOME Sound Recorder both as an input and output device. So there is no evidence of any problem with ALSA etc.

Evidently the USB mic is connected:

$ lsusb

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 004: ID 062a:4101 MosArt Semiconductor Corp. Wireless Keyboard/Mouse
Bus 001 Device 006: ID 1686:04d5 ZOOM Corporation H3-VR
Bus 001 Device 003: ID 12c9:1021 Newmen Tech.,LTD 2.4G Wireless Mouse
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

And $ cat also confirms that the H3-VR is attached as USB audio:

$ cat /proc/asound/cards
 0 [Headphones     ]: bcm2835_headpho - bcm2835 Headphones
                      bcm2835 Headphones
 1 [vc4hdmi0       ]: vc4-hdmi - vc4-hdmi-0
                      vc4-hdmi-0
 2 [vc4hdmi1       ]: vc4-hdmi - vc4-hdmi-1
                      vc4-hdmi-1
 3 [H3VR           ]: USB-Audio - H3-VR
                      ZOOM Corporation H3-VR at usb-0000:01:00.0-1.3, high speed

But when I try sd.query_devices(), the ZOOM H3-VR does not appear:

>>> sd.query_devices()
  0 sysdefault, ALSA (0 in, 128 out)
  1 lavrate, ALSA (0 in, 128 out)
  2 samplerate, ALSA (0 in, 128 out)
  3 speexrate, ALSA (0 in, 128 out)
  4 pulse, ALSA (32 in, 32 out)
  5 upmix, ALSA (0 in, 8 out)
  6 vdownmix, ALSA (0 in, 6 out)
  7 dmix, ALSA (0 in, 2 out)
* 8 default, ALSA (32 in, 32 out)

I have tried re-installing PortAudio. Nothing.

Any suggestions? Why does sounddevice not find a USB microphone that evidently does exist and is connected?

Please note: I am not asking why the microphone is not found by the RPi. It is found and works fine on GNOME. Nor am I asking about 64-bit kernels, which I see others are grappling with.

Grateful for any suggestions.

@pr-wiley
Copy link

I am having the same frustrating problem. I have not been able to find an answer yet. In my case, $ lsusb produces:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 001 Device 006: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 001 Device 005: ID 0d8c:000c C-Media Electronics, Inc. Audio Adapter
Bus 001 Device 004: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
Bus 001 Device 003: ID 0781:55a1 SanDisk Corp. Cruzer Spark
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

sd.query_devices() produces:

0 sysdefault, ALSA (0 in, 128 out)
1 lavrate, ALSA (0 in, 128 out)
2 samplerate, ALSA (0 in, 128 out)
3 speexrate, ALSA (0 in, 128 out)
4 upmix, ALSA (0 in, 8 out)
5 vdownmix, ALSA (0 in, 6 out)
< 6 default, ALSA (0 in, 128 out)
7 dmix, ALSA (0 in, 2 out)

Baffled.

@mgeier
Copy link
Member

mgeier commented Oct 30, 2023

The devices are detected (or not) by the underlying PortAudio library.

You should try it with some other software that uses PortAudio (e.g. Audacity) to confirm that this problem is not caused by the Python wrapper.

You can report issues with the PortAudio library at https://github.com/PortAudio/portaudio/issues.

You can also try to compile the latest development version from source, maybe the problem has been fixed there.

@pr-wiley
Copy link

@mgeier A helpful comment, thank you. An idea I had not considered.

I found that VLC does see the audio devices and I can playback audio from them. So, if I understand what you are saying, I can conclude that PortAudio is working properly and the problem must lie with Python. Can you point me in the direction of troubleshooting Python instructions?

@mgeier
Copy link
Member

mgeier commented Nov 10, 2023

So, if I understand what you are saying, I can conclude that PortAudio is working properly

AFAIK, VLC doesn't use PortAudio.

@b-schliessmann
Copy link

b-schliessmann commented Jun 17, 2024

Same here :( A USB and an internal audio device are not recognised by sounddevice any more, even though alsamixer and ALSA-based programs can use them. The issue appeared on a Raspberry Pi 4B after upgrading from Raspbian buster to bullseye.

Short chronology:

  • It worked on buster with stock kernel kernel 5.10.103-v7l+
  • After upgrading all system packages and booting with old 5.10 kernel, it continued to work
  • After upgrading to bullseye stock kernel 6.1.21-v8+, it stopped working.

Seems to me like a problem between sounddevice or the underlying portaudio library and the kernel.

The problem looks like this. On the ALSA side, the internal sound card and the USB device is visible:

$ cat /proc/asound/cards 
 0 [b1             ]: bcm2835_hdmi - bcm2835 HDMI 1
                      bcm2835 HDMI 1
 1 [Headphones     ]: bcm2835_headpho - bcm2835 Headphones
                      bcm2835 Headphones
 2 [Device         ]: USB-Audio - USB Audio Device
                      C-Media Electronics Inc. USB Audio Device at usb-0000:01:00.0-1.2, full speed

sounddevice however only exposes some default devices:

$ python3 -m sounddevice
  0 sysdefault, ALSA (0 in, 128 out)
  1 lavrate, ALSA (0 in, 128 out)
  2 samplerate, ALSA (0 in, 128 out)
  3 speexrate, ALSA (0 in, 128 out)
  4 upmix, ALSA (0 in, 8 out)
  5 vdownmix, ALSA (0 in, 6 out)
< 6 default, ALSA (0 in, 128 out)
  7 dmix, ALSA (0 in, 2 out)

With the older kernel, everything is accessible:

$ python3 -m sounddevice
   0 bcm2835 HDMI 1: - (hw:0,0), ALSA (0 in, 8 out)
   1 bcm2835 Headphones: - (hw:1,0), ALSA (0 in, 8 out)
>  2 USB Audio Device: - (hw:2,0), ALSA (1 in, 2 out)
   3 sysdefault, ALSA (0 in, 128 out)
   4 lavrate, ALSA (0 in, 128 out)
   5 samplerate, ALSA (0 in, 128 out)
   6 speexrate, ALSA (0 in, 128 out)
   7 upmix, ALSA (0 in, 8 out)
   8 vdownmix, ALSA (0 in, 6 out)
<  9 default, ALSA (0 in, 128 out)
  10 dmix, ALSA (0 in, 2 out)

How should we proceed from here on, is the bug already reported in portaudio? Or does anyone know a workaround? (I'm no ALSA crack, but almost anything can be solved with .asoundrc magic.)

(EDIT: clarified that all hw sound devices are affected, and posted result from downgraded kernel)

@mgeier
Copy link
Member

mgeier commented Jun 19, 2024

is the bug already reported in portaudio?

I don't know. You should check and create an issue if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants