Give musicdolphin real sound through the HifiBerry amp

It was set up display-only, with alsa_device "simulate", so the UI showed a
working player that made no noise - but the Pi has a HifiBerry amp and
pi_alsasetup already put the softvol_effects slot on it. Point the backend at
it, the same way musicmouse does: a softvol control feeding dmix, so the card
stays shared with squeezelite and shairport instead of being locked.

Carry musicmouse's volume clamp over with it. Below roughly 23 the softvol
attenuation leaves nothing audible, and the ceiling keeps a UI slider from
putting the amp to full. Those numbers are tuned to musicmouse's speakers and
this is a different room, so they are a starting point.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-19 21:53:50 +02:00
parent c8f19ed918
commit 804cb1bfaf

View File

@@ -1,14 +1,13 @@
---
# musicdolphin: display-only instance. No physical mouse attached, so serial and audio
# are both "simulate" - the web front-end (shown locally in the pi_kiosk Firefox window,
# and reachable on the LAN for a tablet) is a complete way to drive the player on its
# own. `figures` still needs at least one entry (the schema requires it) even though
# nothing will ever scan a tag here.
# musicdolphin: screen-driven instance. No physical mouse is attached, so serial stays
# "simulate" and the web front-end (shown locally in the pi_kiosk Firefox window, and
# reachable on the LAN for a tablet) is how the player is driven. `figures` still needs
# at least one entry (the schema requires it) even though nothing will ever scan a tag
# here.
#
# This Pi does have a HifiBerry amp (mediapi_has_hifiberry_amp, alsa_card_name
# sndrpihifiberry), so the `softvol_effects` slot from pi_alsasetup exists on it.
# Swapping alsa_device to that is the one-line change that gives this instance real
# sound - the amp is currently shared by squeezelite and shairport only.
# Audio goes out the HifiBerry amp, the same way musicmouse does it: pi_alsasetup's
# `softvol_effects` slot is a softvol control feeding dmix, so the backend shares the
# card with squeezelite and shairport rather than locking it.
#
# Unknown keys are rejected rather than ignored, so a typo fails at startup with the
# path to the offending line. Every key is documented in the app repo's
@@ -31,7 +30,7 @@ general:
# asked for, so a config that lost a line fails loudly instead of booting into
# something that looks like it is working. Startup says so every boot.
serial_port: "simulate"
alsa_device: "simulate"
alsa_device: "softvol_effects"
web:
host: "0.0.0.0"
@@ -78,10 +77,12 @@ general:
# (no mouse), kept so the file reads the same as the other hosts'.
button_leds_brightness: 0.5
# Volume, 0..100. The full range: this one is driven from a screen, not from a knob a
# child can spin, so there is nothing to protect against.
min_volume: 0
max_volume: 100
# Volume, 0..100, clamped the way musicmouse clamps it: below ~23 the softvol
# attenuation leaves nothing audible, and the ceiling is there so no UI slider can
# put the amp to full. These two numbers are tuned to musicmouse's speakers, so
# expect to want different ones for this room.
min_volume: 23
max_volume: 70
initial_volume: 40
volume_increment: 5