SpotPRIS2 icon indicating copy to clipboard operation
SpotPRIS2 copied to clipboard

Volume is not set to exact given value

Open jbriales opened this issue 5 years ago • 2 comments

When assigning volume to say '0.14' if I read the value afterwards it's 0.11. I've seen several weird behaviors in this sense. Do you have an idea about the explanation or limitations of the API, like e.g. what's the precision when assigning values?

jbriales avatar May 27 '20 13:05 jbriales

Spotify stores volume as an int (1-100), while mpris2 uses a float (0.0-1.0). This can lead to a loss of accuracy, however it shouldn't for values with only 2 digits after the decimal point.

I just tested setting 0.14 and got 0.14 back when asking for the volume. Could you give some more details on your setup? Mainly: SpotPRIS2 version, spotify client (native, web, ...), mpris client.

The code converting between those representations is at https://github.com/freundTech/SpotPRIS2/blob/master/spotpris2/util.py#L35

freundTech avatar May 27 '20 13:05 freundTech

I tried setting e.g. 0.17 and then get value is 0.16. Then I set again to 0.17, and the get value became 0.17 this time. It's a bit confusing.

Can you point how to get the relevant versioning and client info? I'm using the native client for Spotify.

jbriales avatar May 28 '20 12:05 jbriales