Skip to content

Add min and max volume functionality per player#3360

Open
OzGav wants to merge 3 commits intodevfrom
min-max-volume
Open

Add min and max volume functionality per player#3360
OzGav wants to merge 3 commits intodevfrom
min-max-volume

Conversation

@OzGav
Copy link
Contributor

@OzGav OzGav commented Mar 12, 2026

FRONTEND CHANGES: music-assistant/frontend#1569
Satisifies: https://github.com/orgs/music-assistant/discussions/3288

Add configurable min/max volume limits per player

Summary

  • Adds per-player minimum and maximum volume configuration options (advanced settings under player controls)
  • Volume commands (volume_set, volume_up, volume_down) are clamped to the configured range
  • External volume changes (physical buttons, other apps) are corrected back into the allowed range
  • Group volume adjustments respect each child player's individual min/max limits
  • Volume limits are exposed to the frontend via extra_attributes for UI consumption (e.g. slider bounds)
  • Config validation rejects min > max to prevent invalid states

Edge cases and functionality covered

cmd_volume_set — All explicit volume set commands are clamped to [min_volume, max_volume] before reaching the device, including when called programmatically or via API.

cmd_volume_up / cmd_volume_down — Step-based volume changes respect the limits. volume_up caps at max_volume instead of 100; volume_down floors at min_volume instead of 0.

External volume changes — When a device reports a volume change outside the allowed range (e.g. user pressed a physical volume button, or used a manufacturer app), the controller detects it in signal_player_state_update and fires a corrective cmd_volume_set to clamp it back.

Group volume — When adjusting group volume, each child player's individual min/max limits are respected. One child with max=50 won't be pushed to 80 just because the group volume goes up.

Config validationon_player_config_change validates that min_volume <= max_volume and raises InvalidDataError if not

Falsy value handling — Uses explicit is not None checks rather than truthiness when reading config values, so min_volume=0 (a valid and common default) isn't incorrectly treated as missing.

Frontend exposureextra_attributes property conditionally includes min_volume and max_volume only when they differ from defaults (0 and 100), so the frontend/HA integration can render appropriate slider bounds without noise in the default case.

Advanced settings — Both config entries are marked as advanced so they don't clutter the basic player settings for users who don't need them.

Default behavior unchanged — With defaults of min=0 and max=100, all existing behavior is preserved.

@MarvinSchenkel MarvinSchenkel added this to the 2.9.0 milestone Mar 12, 2026
@oleost
Copy link

oleost commented Mar 13, 2026

Thanks for trying to fix https://github.com/orgs/music-assistant/discussions/3288

Was wondering, would it be possible to implement also a option to scale the volume ?

Something like this:
https://github.com/oleost/server/tree/dev-max-volum-scale

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants