[GH-ISSUE #433] Linear Volume not working with alsa mixer #277

Closed
opened 2026-02-27 19:29:47 +03:00 by kerem · 8 comments
Owner

Originally created by @JPW21 on GitHub (Feb 13, 2020).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/433

Hi,
Im using a HifiBerry DAC on a raspberry pi with librespot's alsa mixer option.
I'm noticing logarithmic volume control even with --linear-volume enabled.
This means 0-80% volume is extremly quiet. The volume in alsamixer is inconsistent with the spotify connect volume (see screenshots).

If i omit --linear-volume the problem is even worse, meaning 0-95% is quiet...
Almost if its doing log compensation twice, what makes me think that this might be a bug.

Options:
--backend alsa --device hw:0,0 --mixer alsa --mixer-name Digital --linear-volume --enable-volume-normalisation --initial-volume=40

alsamixer
Note that 50% is only 13% in alsa.

alsamixer2
To reach ~50% i need to almost max-out the spotify volume.

Is my understanding wrong? I thought enabling --linear-volume would mean 50% in spotify corresponds to 50% in alsa.

Originally created by @JPW21 on GitHub (Feb 13, 2020). Original GitHub issue: https://github.com/librespot-org/librespot/issues/433 Hi, Im using a HifiBerry DAC on a raspberry pi with librespot's alsa mixer option. I'm noticing logarithmic volume control even with --linear-volume enabled. This means 0-80% volume is extremly quiet. The volume in alsamixer is inconsistent with the spotify connect volume (see screenshots). If i omit --linear-volume the problem is even worse, meaning 0-95% is quiet... Almost if its doing log compensation twice, what makes me think that this might be a bug. Options: --backend alsa --device hw:0,0 --mixer alsa --mixer-name Digital --linear-volume --enable-volume-normalisation --initial-volume=40 ![alsamixer](https://user-images.githubusercontent.com/60467184/74476090-f7f93c80-4ea8-11ea-87e0-c7c904ea36ab.PNG) Note that 50% is only 13% in alsa. ![alsamixer2](https://user-images.githubusercontent.com/60467184/74476112-ffb8e100-4ea8-11ea-9fe1-c2f552e6b2c8.PNG) To reach ~50% i need to almost max-out the spotify volume. Is my understanding wrong? I thought enabling --linear-volume would mean 50% in spotify corresponds to 50% in alsa.
kerem 2026-02-27 19:29:47 +03:00
  • closed this issue
  • added the
    audio
    label
Author
Owner

@ashthespy commented on GitHub (Feb 13, 2020):

Ah, I now see (https://github.com/librespot-org/librespot/pull/245#issuecomment-430247445) that I never got down to merging the stuff from vollibrespot in here. I'll get down to opening a PR soon(ish)

<!-- gh-comment-id:585983269 --> @ashthespy commented on GitHub (Feb 13, 2020): Ah, I now see (https://github.com/librespot-org/librespot/pull/245#issuecomment-430247445) that I never got down to merging the stuff from vollibrespot in here. I'll get down to opening a PR soon(ish)
Author
Owner

@JPW21 commented on GitHub (Feb 13, 2020):

Awesome, thanks for your work!

<!-- gh-comment-id:585996866 --> @JPW21 commented on GitHub (Feb 13, 2020): Awesome, thanks for your work!
Author
Owner

@ashthespy commented on GitHub (Feb 13, 2020):

PS - if you are in a hurry - I should have some pre-compiled stuff over at ashthespy/Vollibrespot that you can play with in the meantime..

<!-- gh-comment-id:586002198 --> @ashthespy commented on GitHub (Feb 13, 2020): PS - if you are in a hurry - I should have some pre-compiled stuff over at [`ashthespy/Vollibrespot`](https://github.com/ashthespy/Vollibrespot/releases) that you can play with in the meantime..
Author
Owner

@JPW21 commented on GitHub (Feb 13, 2020):

Take your time, at the moment i checked out https://github.com/librespot-org/librespot/pull/430 to test gapless playback anyways.

<!-- gh-comment-id:586005758 --> @JPW21 commented on GitHub (Feb 13, 2020): Take your time, at the moment i checked out https://github.com/librespot-org/librespot/pull/430 to test gapless playback anyways.
Author
Owner

@JPW21 commented on GitHub (Feb 14, 2020):

I have just found out that this problem isnt librespot exclusive:
If i use "amixer -q sset Digital 50%"
the volume gets set to 14%.

So it doesnt seem like this is a bug in librespot, sorry.

Edit: The -M option seems to behave like i want. 10% results in 10%, although there seems to be rounding going on since 50% gets turned to 49%.

How can i make librespot use this option?

<!-- gh-comment-id:586503161 --> @JPW21 commented on GitHub (Feb 14, 2020): I have just found out that this problem isnt librespot exclusive: If i use "amixer -q sset Digital 50%" the volume gets set to 14%. So it doesnt seem like this is a bug in librespot, sorry. Edit: The -M option seems to behave like i want. 10% results in 10%, although there seems to be rounding going on since 50% gets turned to 49%. How can i make librespot use this option?
Author
Owner

@ashthespy commented on GitHub (Feb 15, 2020):

@JPW21 you should check out the -M aka mapped volume.
ah, just saw your edit - I have incorporated a similar mapped mode in my branch, will open up a PR shortly..

<!-- gh-comment-id:586580928 --> @ashthespy commented on GitHub (Feb 15, 2020): @JPW21 you should check out the `-M` aka mapped volume. ah, just saw your edit - I have incorporated a similar [mapped mode](https://github.com/ashthespy/librespot/commit/7a576f5ae2ef4ee444f8fdebc08e5b1edc6af5b8) in my branch, will open up a PR shortly..
Author
Owner

@JPW21 commented on GitHub (Feb 27, 2020):

@ashthespy Any news for that PR? :)

<!-- gh-comment-id:591890476 --> @JPW21 commented on GitHub (Feb 27, 2020): @ashthespy Any news for that PR? :)
Author
Owner

@ashthespy commented on GitHub (Feb 27, 2020):

@JPW21 haven't made/found the time yet - next week should be possible!

<!-- gh-comment-id:592046784 --> @ashthespy commented on GitHub (Feb 27, 2020): @JPW21 haven't made/found the time yet - next week should be possible!
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/librespot#277
No description provided.