Files
nr-flow-validator/infra/audio-bridge/entrypoint.sh
T
david 573821426c audio: add PipeWire+BT audio-bridge, mopidy (Qobuz+local), librespot (Spotify Connect)
- audio-bridge: alpine + pipewire + pipewire-pulse + wireplumber + bluez + dbus + tini
  Routes audio from librespot/mopidy/phone-BT to USB DAC (Q5K) via ALSA.
  Privileged + host network for bluetoothd HCI access.
- mopidy: built from python:3.12-slim-bookworm + pip (no ghcr.io dep).
  Qobuz (auth from developer.qobuz.com) + local files. PA bridge to audio-bridge.
- librespot: built from rust:1.85.1 on RPi (cross-compile too slow under qemu).
  Spotify Connect target named 'Klubhaus'. PA bridge to audio-bridge.

Both mopidy and librespot build locally to avoid ghcr.io auth/rate-limit issues.
PEQ stays on Q5K side (Qudelix app, 20 bands) for source-independent EQ.
2026-07-01 04:49:15 -07:00

37 lines
1.1 KiB
Bash

#!/bin/sh
# audio-bridge entrypoint
# Starts DBus, BlueZ, WirePlumber, then PipeWire. PA clients (librespot, mopidy)
# connect via pipewire-pulse bridge on TCP localhost:4713.
set -e
mkdir -p /run/dbus /run/user/0
chmod 0755 /run/dbus
chmod 0700 /run/user/0
# System DBus (needed by bluetoothd, wireplumber, pipewire)
dbus-daemon --system --fork
sleep 0.5
# BlueZ (Bluetooth stack). --compat = legacy mode for older audio devices.
# Disabled if no /dev/bluetooth/rfkill — wireplumber will skip BT modules.
if [ -d /sys/class/bluetooth ]; then
bluetoothd --compat --nodetach &
sleep 0.5
echo "[audio-bridge] bluetoothd started"
else
echo "[audio-bridge] no bluetooth hardware — skipping bluetoothd"
fi
# PipeWire runtime env
export XDG_RUNTIME_DIR=/run/user/0
export DBUS_SYSTEM_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket
# WirePlumber first (it manages PipeWire session/policy, loads BT modules)
wireplumber &
sleep 1
# PipeWire last. The pipewire-pulse package auto-loads the PA bridge module
# so PA clients (librespot, mopidy) can connect via TCP localhost:4713.
exec pipewire