Skip to content

feat: add software volume control with perceptual curve and ramping#14

Closed
teancom wants to merge 1 commit intomusic-assistant:mainfrom
teancom:sw-vol-ctrl
Closed

feat: add software volume control with perceptual curve and ramping#14
teancom wants to merge 1 commit intomusic-assistant:mainfrom
teancom:sw-vol-ctrl

Conversation

@teancom
Copy link
Copy Markdown
Contributor

@teancom teancom commented Feb 21, 2026

Add configurable volume control mode (Auto/Hardware/Software/Disabled) that resolves at connection time based on user preference and hardware availability. Software mode applies a perceptual power curve ((vol/100)^4) with 20ms linear ramping to prevent clicks.

  • VolumeControlMode enum with Auto default, persisted in settings JSON
  • ResolvedVolumeMode (Hardware/Software/None) resolved once per session
  • SoftwareGainState: gain curve, ramp smoothing, i24 PCM sample processing
  • Volume/mute commands routed by resolved mode
  • Software mode skips state echo to server (prevents feedback-loop desync)
  • Drain pending volume commands before each buffer enqueue (reduces latency)
  • Settings UI dropdown with immediate reconnect on change
  • 21 automated tests, human test plan (which I did thoroughly)

Known limitation: gain applied at enqueue time, not playback time. SyncedPlayer buffers ~2s ahead, so software volume changes have latency until/unless sendspin-rs adds a post-processing callback. I added a tool-tip to that effect.

Add configurable volume control mode (Auto/Hardware/Software/Disabled)
that resolves at connection time based on user preference and hardware
availability. Software mode applies a perceptual power curve ((vol/100)^4)
with 20ms linear ramping to prevent clicks.

- VolumeControlMode enum with Auto default, persisted in settings JSON
- ResolvedVolumeMode (Hardware/Software/None) resolved once per session
- SoftwareGainState: gain curve, ramp smoothing, i24 PCM sample processing
- Volume/mute commands routed by resolved mode
- Software mode skips state echo to server (prevents feedback-loop desync)
- Drain pending volume commands before each buffer enqueue (reduces latency)
- Settings UI dropdown with immediate reconnect on change
- 21 automated tests, human test plan

Known limitation: gain applied at enqueue time, not playback time.
SyncedPlayer buffers ~2s ahead, so software volume changes have
latency until sendspin-rs adds a post-processing callback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@teancom teancom marked this pull request as draft February 21, 2026 07:49
@teancom
Copy link
Copy Markdown
Contributor Author

teancom commented Feb 21, 2026

Converting to draft while I investigate what it would take to add the actual software gain / mute functionality to sendspin-rs.

@teancom
Copy link
Copy Markdown
Contributor Author

teancom commented Feb 21, 2026

I created a sendspin-rs PR here: Sendspin/sendspin-rs#10 and a newly updated version of this feature here: #15

Leaving this PR open until the sendspin-rs PR is either merged or definitively rejected for being out of scope (or any one of many other valid reasons).

@teancom
Copy link
Copy Markdown
Contributor Author

teancom commented Feb 27, 2026

Now that the sendspin-rs changes have been merged, closing this in favor of Sendspin/sendspin-rs#10

@teancom teancom closed this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant