Sounddevice on Raspberry Pi apparently not finding all USB audio devices

109 views Asked by At

I am troubleshooting a python script that used to work and now it does not. The script plays audio using sounddevice via a USB audio device connected to a USB hub.

As I understand using sounddevice, I have to provide a device number to create a an audio stream object that will be written to with audio data. My understanding is that

python -m sounddevice

should show a list of devices and their device numbers. The request produces a list:

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)

If I ask for a list of USB devices with lsusb I get this list:

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

In this latter list I see devices I want to use: the C-Media Electronics, Inc. Audio Adapters

Can some please explain why the output from python -m sounddenvice and lsusb are different and contradictory? Why wouldn't the C-media adapters be listed by sounddevice? I am confused because the python script I'm testing used to work as intended.

Thanks in advance.

System info: Raspberry Pi 4 Model B Rev 1.4. --- Linux version 6.1.21-v8+ (dom@buildbot) (aarch64-linux-gnu-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023

0

There are 0 answers