Sendspin CLI version: 5.9.0
OS: Raspberry Pi OS (Raspberry Pi 5, USB DAC CX31993+MAX97220)
Audio path: sendspin daemon → ALSA hw mixer → USB DAC
Description
Hardware volume read-back returns the wrong value on startup. With playback volume set to 34%, sendspin reports 85% to the server on reconnection. This causes the volume displayed in Music Assistant to jump to 85% after every restart, and subsequent volume adjustments start from the wrong baseline.
Root cause
alsa_volume.py parses amixer -M sget output using _VOLUME_RE = re.compile(r"\[(\d+)%\]"), which matches the first percentage in the output. On the CX31993+MAX97220 USB DAC, the 'Headset' mixer element exposes both Capture and Playback channels. Capture appears first in the output, so the regex captures the microphone input level instead of the playback volume.
$ amixer -M -c CX31993MAX97220 sget Headset
Mono: Capture 140 [85%] [-4.00dB] [on] ← regex matches this (85%)
Front Left: Playback 97 [34%] [-25.50dB] [on] ← should match this (34%)
Front Right: Playback 97 [34%] [-25.50dB] [on]
The write path (sset ... playback) correctly targets only the playback channel. But the read path grabs the first [XX%] it finds, which is the capture channel.
Reproduction
- Start sendspin daemon with hardware volume enabled (default for daemon mode)
- Use a USB DAC that exposes both playback and capture on the same mixer element (e.g. CX31993+MAX97220)
- Set player volume to 34% via Music Assistant
- Restart sendspin:
sudo systemctl restart sendspin
- MA now shows 85% — sendspin read the capture volume instead of the playback volume
Suggested fix
The regex or parsing logic needs to match only the Playback channel percentage, not the first [XX%] in the output. For example, only matching lines containing "Playback" or "Front Left".
Expected behaviour
Volume read-back on startup should return the playback volume, not the capture volume. Setting 34% and restarting should report 34%.
Sendspin CLI version: 5.9.0
OS: Raspberry Pi OS (Raspberry Pi 5, USB DAC CX31993+MAX97220)
Audio path: sendspin daemon → ALSA hw mixer → USB DAC
Description
Hardware volume read-back returns the wrong value on startup. With playback volume set to 34%, sendspin reports 85% to the server on reconnection. This causes the volume displayed in Music Assistant to jump to 85% after every restart, and subsequent volume adjustments start from the wrong baseline.
Root cause
alsa_volume.pyparsesamixer -M sgetoutput using_VOLUME_RE = re.compile(r"\[(\d+)%\]"), which matches the first percentage in the output. On the CX31993+MAX97220 USB DAC, the 'Headset' mixer element exposes both Capture and Playback channels. Capture appears first in the output, so the regex captures the microphone input level instead of the playback volume.The write path (
sset ... playback) correctly targets only the playback channel. But the read path grabs the first[XX%]it finds, which is the capture channel.Reproduction
sudo systemctl restart sendspinSuggested fix
The regex or parsing logic needs to match only the Playback channel percentage, not the first
[XX%]in the output. For example, only matching lines containing "Playback" or "Front Left".Expected behaviour
Volume read-back on startup should return the playback volume, not the capture volume. Setting 34% and restarting should report 34%.