Skip to content

Sendspin volume issue #221

@1liminal1

Description

@1liminal1

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

  1. Start sendspin daemon with hardware volume enabled (default for daemon mode)
  2. Use a USB DAC that exposes both playback and capture on the same mixer element (e.g. CX31993+MAX97220)
  3. Set player volume to 34% via Music Assistant
  4. Restart sendspin: sudo systemctl restart sendspin
  5. 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%.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions