From c8d12d789f1ad716f78bd990be08c6b24a8a7ebc Mon Sep 17 00:00:00 2001 From: luciano Date: Tue, 30 Jun 2026 10:28:40 +0200 Subject: [PATCH] Audio: route Pi output through PipeWire (HDMI software mixing) The Pi 5 vc4hdmi exposes only IEC958 and has no hardware mixing, so raw ALSA is exclusive: once Chromium's Web Audio stream holds the HDMI device, the media-element audio (the actual track) can't open it and stays silent even though the analyser sees the signal. Install PipeWire + pipewire-pulse as a software mixer (it also handles the IEC958 conversion) so every Chromium stream mixes onto HDMI. Enable lingering so the user services start at boot; set the HDMI sink to full volume. Co-Authored-By: Claude Opus 4.8 --- scripts/install-pi.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/install-pi.sh b/scripts/install-pi.sh index c14f398..8e2ecb1 100644 --- a/scripts/install-pi.sh +++ b/scripts/install-pi.sh @@ -11,6 +11,22 @@ sudo apt update sudo apt install -y nodejs npm ffmpeg cage curl chromium-browser || \ sudo apt install -y nodejs npm ffmpeg cage curl chromium +# Audio: il vc4hdmi del Pi 5 espone solo il formato IEC958 e NON ha mixing +# hardware, quindi ALSA grezzo è esclusivo (un solo stream) e l'audio dei file +# resta muto mentre Chromium tiene il device. PipeWire fa da mixer software e +# gestisce la conversione IEC958, così tutti gli stream di Chromium escono su HDMI. +echo "==> Installo PipeWire (mixer audio per l'uscita HDMI)…" +sudo apt install -y pipewire pipewire-pulse pipewire-alsa wireplumber +sudo loginctl enable-linger "$USER_NAME" # i servizi utente partono al boot +export XDG_RUNTIME_DIR="/run/user/$(id -u)" +systemctl --user daemon-reload 2>/dev/null || true +systemctl --user enable --now pipewire.socket pipewire-pulse.socket wireplumber.service 2>/dev/null || true +systemctl --user start pipewire pipewire-pulse 2>/dev/null || true +sleep 2 +# Porta l'uscita HDMI a volume pieno e smutala (best-effort). +HDMI_SINK="$(wpctl status 2>/dev/null | grep -iE 'HDMI' | grep -oE '^\s*\*?\s*[0-9]+' | grep -oE '[0-9]+' | head -1)" +[ -n "$HDMI_SINK" ] && { wpctl set-volume "$HDMI_SINK" 1.0; wpctl set-mute "$HDMI_SINK" 0; } + echo "==> Installo i pacchetti npm…" cd "$DIR" npm install --omit=dev