[GH-ISSUE #141] API: relative POST player/volume seems to be broken #87

Closed
opened 2026-02-28 14:25:14 +03:00 by kerem · 5 comments
Owner

Originally created by @2opremio on GitHub (Nov 12, 2024).
Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/141

I am using the Alsa mixer with the following configuration:

audio_device: default # ALSA audio device to use for playback
mixer_device: default # ALSA mixer device for volume synchronization 
mixer_control_name: Speaker # ALSA mixer control name for volume synchronization
volume_steps: 100 # Volume steps count
initial_volume: 100 # Initial volume in steps (not applied to the mixer device)
external_volume: false # Whether volume is controlled externally 

I am also using the POST player/volume endpoint to increase/decrease the volume in a relative manner:

To increase:

{
	"volume": 1,
	"relative": true
}

To decrease:

{
	"volume": -1,
	"relative": true
}

However, the volume only increases 1 step up or down (it doesn't continue increasing or decreasing upon multiple API calls).

Also, I get lots of this spurious (and seemly incorrect) warnings:

WARN[0015] error while handling alsa mixer events. (Success) 
WARN[0015] error while handling alsa mixer events. (Success) 
WARN[0015] error while handling alsa mixer events. (Success) 
WARN[0015] error while handling alsa mixer events. (Success) 
Originally created by @2opremio on GitHub (Nov 12, 2024). Original GitHub issue: https://github.com/devgianlu/go-librespot/issues/141 I am using the Alsa mixer with the following configuration: ```yaml audio_device: default # ALSA audio device to use for playback mixer_device: default # ALSA mixer device for volume synchronization mixer_control_name: Speaker # ALSA mixer control name for volume synchronization volume_steps: 100 # Volume steps count initial_volume: 100 # Initial volume in steps (not applied to the mixer device) external_volume: false # Whether volume is controlled externally ``` I am also using the `POST player/volume` endpoint to increase/decrease the volume in a relative manner: To increase: ```json { "volume": 1, "relative": true } ``` To decrease: ```json { "volume": -1, "relative": true } ``` However, the volume only increases 1 step up or down (it doesn't continue increasing or decreasing upon multiple API calls). Also, I get lots of this spurious (and seemly incorrect) warnings: ``` WARN[0015] error while handling alsa mixer events. (Success) WARN[0015] error while handling alsa mixer events. (Success) WARN[0015] error while handling alsa mixer events. (Success) WARN[0015] error while handling alsa mixer events. (Success) ```
kerem 2026-02-28 14:25:14 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@2opremio commented on GitHub (Nov 12, 2024):

BTW, setting the volume from an external Spotify client does seem to change the Alsa mixer volume correctly.

<!-- gh-comment-id:2469412061 --> @2opremio commented on GitHub (Nov 12, 2024): BTW, setting the volume from an external Spotify client does seem to change the Alsa mixer volume correctly.
Author
Owner

@2opremio commented on GitHub (Nov 12, 2024):

Also, this is on 0.1.2 (I haven't checked other versions)

<!-- gh-comment-id:2469418660 --> @2opremio commented on GitHub (Nov 12, 2024): Also, this is on `0.1.2` (I haven't checked other versions)
Author
Owner

@2opremio commented on GitHub (Nov 12, 2024):

If you turn down the volume very slowly (approx one change for second) then it works. This makes it unusable though.

I bet is that https://github.com/devgianlu/go-librespot/pull/86/commits/4ad9ae18b9b228a56e0e69ab640100e530dcf4ac caused this (CC @aykevl )

It's worth noting that if you you request volume changes faster than 1 per second, the volume doesn't update at all.

I think that the mixer update frequency should be independent of the frequency we send updates back to Spotify.

<!-- gh-comment-id:2471300863 --> @2opremio commented on GitHub (Nov 12, 2024): _If_ you turn down the volume very slowly (approx one change for second) then it works. This makes it unusable though. I bet is that https://github.com/devgianlu/go-librespot/pull/86/commits/4ad9ae18b9b228a56e0e69ab640100e530dcf4ac caused this (CC @aykevl ) It's worth noting that if you you request volume changes faster than 1 per second, the volume doesn't update at all. I think that the mixer update frequency should be independent of the frequency we send updates back to Spotify.
Author
Owner

@aykevl commented on GitHub (Nov 13, 2024):

I can confirm this issue with the PulseAudio output so it's not related to the ALSA mixer.

<!-- gh-comment-id:2472603980 --> @aykevl commented on GitHub (Nov 13, 2024): I can confirm this issue with the PulseAudio output so it's not related to the ALSA mixer.
Author
Owner

@aykevl commented on GitHub (Nov 13, 2024):

Wrote a fix: https://github.com/devgianlu/go-librespot/pull/144
This fix actually simplifies the code because there's no real reason why the volume needs to be kept outside the player state.

<!-- gh-comment-id:2472640213 --> @aykevl commented on GitHub (Nov 13, 2024): Wrote a fix: https://github.com/devgianlu/go-librespot/pull/144 This fix actually simplifies the code because there's no real reason why the volume needs to be kept outside the player state.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#87
No description provided.