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