Why? Because the Raspberry Pi 5/500 have no analogue audio, and the
digital (HDMI) outputs are not supported by ALSA's dmix facility, so
with ALSA you can only play one thing at a time, and get annoying error
messages if you attempt otherwise.
How? Pipewire can handle this on behalf of ALSA; Alpine already has a
desktop solution for this, but there are deprecation warnings
everywhere, so I shall set up here as an openrc service (or two).
This is for Pi5/500 under X11 - the wiki has lots to say about Wayland,
but not my problem ;) I used the pipewire AND openrc wiki pages, and
stepped over the Wayland stuff. It uses xfce4-session here, but was
originally tested using FVWM.
--------- apologies for email formatting! -------------------------
1. ENVIRONMENT
$ doas rm -f /etc/xdg/autostart/pipewire.desktop
$ doas rc-update del lightdm
$ doas apk add slim
$ doas rc-update add slim
$ doas reboot
$ cat .xinitrc
#!/bin/sh
xrdb -merge $HOME/.Xresources
$HOME/.profile
if [ -z "$XDG_RUNTIME_DIR" ]
then
XDG_RUNTIME_DIR="/tmp/$(id -u)-runtime-dir"
mkdir -pm 0700 "$XDG_RUNTIME_DIR"
export XDG_RUNTIME_DIR
fi
openrc -U default
xset mouse default
xset s off
exec xfce4-session
2. PACKAGES/CONFIG
$ doas apk add pipewire wireplumber
$ doas apk add pipewire-alsa pipewire-jack pipewire-pulse # only ALSA
is essential
$ doas apk add pavucontrol xfce4-pulseaudio-plugin # optional
$ rc-update add -U pipewire default # sufficient for ALSA
$ rc-update add -U pipewire-pulse default # only needed for pavucontrol
3. SUCCESS?
$ rc-status -Ua
Runlevel: default
pipewire [ started
00:25:30 (0) ] pipewire-pulse [
started 00:25:30 (0) ] Runlevel: gui
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed/wanted
wireplumber [ started
00:25:30 (0) ] dbus [
started 00:25:30 (0) ] Dynamic Runlevel: manual