badaix / snapcast

Synchronous multiroom audio player
GNU General Public License v3.0
6.22k stars 455 forks source link

snapclient not finding alsa output on raspi 1b #1185

Closed andrewufrank closed 7 months ago

andrewufrank commented 11 months ago

Describe the bug the snapclient on a raspi 1b (running debian bookworm) cannot find the alsa output. Steps to Reproduce

  1. snapclient -l gives

    0: null
    Discard all samples (playback) or generate zero samples (capture)
  2. snapclient --player gives

    sic4:~$ snapclient --player alsa
    2023-12-21 17-32-36.539 [Error] (Snapclient) PCM device "default" not found
    2023-12-21 17-32-36.547 [Info] (Snapclient) Version 0.27.0
    2023-12-21 17-32-36.615 [Info] (Avahi) (Browser) NEW: service 'Snapcast' of type '_snapcast._tcp' in domain 'local'
    2023-12-21 17-32-36.630 [Info] (Avahi) (Browser) NEW: service 'Snapcast' of type '_snapcast._tcp' in domain 'local'
    2023-12-21 17-32-36.641 [Info] (Avahi) (Browser) CACHE_EXHAUSTED
    2023-12-21 17-32-36.826 [Info] (Avahi) Service 'Snapcast' of type '_snapcast._tcp' in domain 'local':
    2023-12-21 17-32-36.833 [Info] (Avahi)  laredo.local:1704 (10.0.0.53)
    2023-12-21 17-32-36.853 [Info] (Controller) Found server 10.0.0.53:1704
    2023-12-21 17-32-36.861 [Info] (Connection) Resolving host IP for: 10.0.0.53
    2023-12-21 17-32-36.866 [Info] (Connection) Connecting
    2023-12-21 17-32-36.873 [Notice] (Connection) Connected to 10.0.0.53
    2023-12-21 17-32-36.875 [Info] (Connection) My MAC: "b8:27:eb:a9:82:b4", socket: 8
    2023-12-21 17-32-37.113 [Info] (Controller) ServerSettings - buffer: 1000, latency: 0, volume: 99, muted: 0
    2023-12-21 17-32-37.119 [Info] (Controller) Codec: flac, sampleformat: 48000:16:2
    2023-12-21 17-32-37.124 [Info] (Player) Player name: alsa, device: default, description: <none>, idx: -1, sharing mode: unspecified, parameters: <none>
    2023-12-21 17-32-37.127 [Info] (Player) Mixer mode: software, parameters: <none>
    2023-12-21 17-32-37.130 [Info] (Player) Sampleformat: 48000:16:2, stream: 48000:16:2
    2023-12-21 17-32-37.131 [Info] (Alsa) Using default buffer_time: 80 ms, default fragments: 4
    ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
    ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
    ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
    ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
    ALSA lib confmisc.c:1334:(snd_func_refer) error evaluating name
    ALSA lib conf.c:5180:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:5703:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM default
    2023-12-21 17-32-37.178 [Error] (Alsa) Exception: Can't open default, error: No such file or directory, code: -2
    2023-12-21 17-32-37.185 [Fatal] (Snapclient) Exception: Can't open default, error: No such file or directory
    2023-12-21 17-32-37.189 [Notice] (Snapclient) Snapclient terminated.
    aplay -l
    aplay: device_list:274: no soundcards found...
    frank@music4:~$ lsmod | grep snd
    snd_bcm2835            28672  0
    snd_soc_hdmi_codec     24576  1
    snd_soc_core          192512  2 vc4,snd_soc_hdmi_codec
    snd_pcm_dmaengine      16384  1 snd_soc_core
    snd_pcm               106496  4 snd_pcm_dmaengine,snd_soc_hdmi_codec,snd_bcm2835,snd_soc_core
    snd_timer              32768  1 snd_pcm
    snd                    73728  5 snd_soc_hdmi_codec,snd_timer,snd_bcm2835,snd_soc_core,snd_pcm
    soundcore              16384  1 snd
    vchiq                 200704  2 bcm2835_mmal_vchiq,snd_bcm2835

Environment details raspi 1b, running debian bookworm (from debian tested images) headless snapclient installed from bookworm-backports snapclient/stable-backports,now 0.27.0+dfsg-1~bpo12+1 armel [installed]

the output is connect in the blue connector (no hdmi connected). it works with mpd and produces sound as expected and says "my ALSA device"

the snapcast sees two client ath this site, with the same ip, which I do not understand either. why is the alsa output not found. what are possible action to debug?

thank you for an otherwise working system (have a different client working and work with snapcast app, which shows even this raspi client, but no sound). andrew

andrewufrank commented 11 months ago

i have a separate install on a rasi 4 (again running debian bookworm) and installed snapserver and snapclient on it from bookworm-backports - gives 0.27 version). the setup works for mpd (using the alsa output) and pipes the stream to other snapclients, but not to the local snapclient (i.e. the same which runs on same cpu than the snapserver). again, aplay -l gives

aplay -l
aplay: device_list:274: no soundcards found...

it seems that mpd captures the output channel. i have switched off the output in mpd to alsa device (which has a noticeable delay compared to the pipe and snapclients!)

andrewufrank commented 11 months ago

on the raspi 1b i have disabled the mpd server but still no soundcar found and no sound from the snapclient.

what command would help to find the card?

andrewufrank commented 11 months ago

I reinstalled a raspi-os (bookworm) to exclude the issue is caused by the debian linux (tested images) bookworm for raspi. the debian linux gives for snapclient -l only null, however sudo snapclient -l gives a long list.

for the debian linux on a raspi 1B i have reasonable output with sudo snapclient -s 10 (but not with snapclient -s 10) . changing /etc/default/snapclient to SNAPCLIENT_OPTS="-s 10" works.

however, on raspios (bookworm, but with the old version v. 0.26 for snapclient) I have sound output on user-land snapclietn -s 10 but not on sudo snapclient -s 10 and as a consequence it does not automatically start when enabled with systemd.

I conclude that the issue is caused whether one is running as user or as root; there is a difference between the raspian os (derived from debian) or in the version of snapclient (v.0.26 vs. v.0.27): one runs ok root privileges, the other works in user-land. I do not understand enough on how to tune the systemd controls to understand to fix this and would be interested to understand the background.

badaix commented 8 months ago

Please try with the v0.28.0 version, there are packages available here. The armhf-bookworn images should run on your RPI1b.

andrewufrank commented 6 months ago

Thank you for your efforts. it took me a while to get the time and the hardware together again to do any experimentation. I have downloaded the armhf 0.28-beta.1.1 and tried to install, but the the message, that it has the wrong architecture. i added the architecture armhf to the raspi 1b (which is armv6l) and installed ok, but when I run snapclient I get "illegal instructions". I take that armhf and armv6l are not compatible. - I have an installation working and will check in a few weeks how I got it working there.