0

I have a Raspberry Pi, running Raspbian, with a cheap SoundBlaster USB card plugged into it. The card is visible to ALSA:

# aplay -l | grep card
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
card 1: S3 [Sound Blaster Play! 3], device 0: USB Audio [USB Audio]

And I can play sound through this card:

$ speaker-test -Dhw:1,0 -c2 -twav

does output "front left" and "front right" in a woman's voice through the connected speakers.

However, PulseAudio does not recognize the card:

$ pacmd list-sinks|egrep -i 'index:|name:'
  * index: 0
    name: <auto_null>

I'm not even sure how to select this card in alsamixer; hitting "F2" and looking at /proc/asound/cards does show this, but then "F6" only shows the default card and trying to enter another value, like "S3" (the name of the card) or "1" or "hw1" or "hw:1,0" just returns "Cannot open mixer device [whatever]. No such file or directory."

I've tried a variety of solutions I've found; none of them work. For example, adding load-module module-alsa-sink device=hw:1,0 to /etc/pulse/default.pa does not trigger an error, but it also does not change the output of pacmd list-sinks, and does not give me any sound.

Adding an ALSA configuration file consisting of:

pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw
    card 1
}

does make the USB card available to alsamixer, and I can then play things directly through ALSA, e.g. $ aplay test.wav, but it's still invisible to Pulse via list-sinks, and if I try to play anything through Pulse, I get errors or no sound, e.g. with mocp sample.mp3 there's no sound.

I can't imagine this should be so hard, so I assume I'm missing something obvious. Could someone tell me what it is?

[EDIT:]

The output of ls -l /dev/snd is:

$ ls -l /dev/snd
total 0
drwxr-xr-x 2 root root       60 Jan 12 17:01 by-id
drwxr-xr-x 2 root root       80 Jan 12 17:01 by-path
crw-rw---- 1 root audio 116,  0 Jan 12 17:01 controlC0
crw-rw---- 1 root audio 116, 32 Jan 12 17:01 controlC1
crw-rw---- 1 root audio 116, 16 Jan 12 17:01 pcmC0D0p
crw-rw---- 1 root audio 116, 17 Jan 12 17:01 pcmC0D1p
crw-rw---- 1 root audio 116, 18 Jan 12 17:01 pcmC0D2p
crw-rw---- 1 root audio 116, 56 Jan 12 17:01 pcmC1D0c
crw-rw---- 1 root audio 116, 48 Jan 12 17:01 pcmC1D0p
crw-rw---- 1 root audio 116,  1 Jan 12 17:01 seq
crw-rw---- 1 root audio 116, 33 Jan 12 17:01 timer
user1235777
  • 609
  • 7
  • 24
  • Please show the output of `ls -l /dev/snd/`. – CL. Jan 12 '20 at 22:52
  • (Added into the original post; it was too long, and couldn't be formatted correctly, as a comment. Thanks.) – user1235777 Jan 12 '20 at 22:58
  • In theory, there should be no difference in the cards found by `aplay -l` and alsamixer's F6. Are you executing everything as root, or is your user member of the audio group? – CL. Jan 13 '20 at 08:12
  • The user is in the audio group, but that seems not to matter for the ALSA stuff. Both `aplay -l` and alsamixer's F6 will show nothing if executed as that user, but will show results if executed as root. But that doesn't seem to be the problem--again, I can play sound by using `aplay`. It's that Pulse doesn't see the other card. (I'm launching Pulse as the user, though I'll eventually switch to running it as a system daemon, despite the warnings against this.) – user1235777 Jan 13 '20 at 11:12
  • Are you using `aplay -D hw:1` or `aplay -D default`? The latter uses PulseAudio. – CL. Jan 13 '20 at 11:31
  • `aplay -D h1:1` (or `hw:1,0`) works when run as root, not otherwise. Hmm, `aplay -D default` shows that it's running, but there's no sound, as the user, but `aplay -D default` *does* produce sound when run as root! Um, what does this mean? – user1235777 Jan 13 '20 at 11:44
  • What are the rights on the directory itself (`ls -ld /dev/snd`)? Are there ACLs? What error message do you get with `cat /dev/snd/controlC1`? – CL. Jan 13 '20 at 13:27
  • Sorry for delay. Rights on ``/dev/snd` are `drwxr-xr-x 4 root root`. On `cat /dev/snd/controlC1`, I get a "Permission denied" as the user, "File descriptor in bad state" as root. Thanks for keeping going with this. – user1235777 Jan 14 '20 at 01:10
  • Hey! I'm not sure what I did, but I rebooted the Pi--I'd done this before--and now it's working. – user1235777 Jan 14 '20 at 03:39
  • FYI I see such behavior **sometimes** connecting a second sound card. – akostadinov Oct 13 '20 at 18:56

0 Answers0