Problems with alsa on gradio snap

Some months back I looked at making a gradio snap. I’m re-visiting it with a view to using the gnome platform snap. However I’m getting alsa errors which I can’t fathom, and would appreciate some help.

I’ve seen Comment #5 : Bug #1598309 : Bugs : snapd package : Ubuntu and thus ~jdstrand/+git/alsa-utils - [no description] and copied wholesale the suggestions. However, when I play audio in my gradio snap, it just errors with:-

AL lib: (WW) alc_initconfig: Failed to initialize backend "pulse"
ALSA lib conf.c:3357:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so
ALSA lib pcm.c:2266:(snd_pcm_open_noupdate) Unknown PCM default
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': No such file or directory
ALSA lib pcm_dmix.c:1029:(snd_pcm_dmix_open) unable to open slave
AL lib: (EE) ALCplaybackAlsa_open: Could not open playback device 'default': Device or resource busy

Suggestions welcome.

Snap is here:- http://people.canonical.com/~alan/gradio_5.0_amd64.snap Source:- gradio : Code : Alan Pope 🍺🐧🐱 🦄

Grab or build the snap then:-

snap install gradio_5.0_amd64.snap --dangerous
snap connect gradio:gnome-3-24-platform gnome-3-24:gnome-3-24-platform
snap connect gradio:alsa core:alsa

Then run gradio. Try and play any station. I think I’ve ruled out things like codecs, and used the alsa tricks madness from @jdstrand but it never plays any audio. Tried on my 16.04 laptop and in a 16.04 clean VM.

Suggestions welcome :slight_smile:

FTFY!

I got a working version running using the code at https://code.launchpad.net/~diddledan/+junk/gradio

I sent you a merge request/patch to your listed email for easy bzr/bazaar-ing.

1 Like

Nice one @lucyllewy ! Works a treat!

As you got it working, perhaps turn it into a PR against upstream? Would be great to get this in the store. They already have a yaml, but I don’t think they’ve had time to finish it off as you have. https://github.com/haecker-felix/gradio

Thanks @lucyllewy for helping @popey!

I’d like to take this moment to remind people about this open bug: Snapcraft part needed for ALSA. At one point I thought someone was working on it, but I don’t see it in ‘snapcraft search’.

In addition to the snapcraft part, this topic got me thinking perhaps the gnome content interface could help too since I imagine GNOME snaps might want to use pulseaudio, alsa or pulseaudio/alsa.

for anyone following along at home, I’ve submitted a PR to gradio as @popey suggested.

2 Likes

Although this has been sorted, I feel I should point out for clarity (and I’ve been confused by this myself this weekend):
Alsa is not required here. The errors are misleading because GStreamer will attempt to go for Alsa if PulseAudio didn’t work, seemingly needing access to sound devices not available under confinement.