mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 00:05:55 +03:00
[GH-ISSUE #948] Alsa mixer sets raw alsa volume to 0 for very high volume ranges #461
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#461
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @fpicot on GitHub (Jan 26, 2022).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/948
Originally assigned to: @roderickvd on GitHub.
I have recently updated librespot to version 0.3.1
c6e97a7(installed through raspotify), and after porting the configuration I'm facing an issue where any volume change via spotify is setting alsa volume to 0.Hardware : Raspberry Pi 3 with HifiBerry Amp.
librespot logs :
Any volume change via spotify yields:
I'm guessing this is related to the following warnings, however I don't see how to set the dB range using --volume-ctrl
@roderickvd commented on GitHub (Jan 26, 2022):
That message probably mentions the wrong command-line option. Please try with
--volume-rangeand set it to 60.I see that your Alsa mixer is softvol. Do you have any particular reason to use that instead of our own softvol? Ours is of higher quality.
Anyway please let me know if that fixes it and we should change the message.
@roderickvd commented on GitHub (Jan 26, 2022):
Scrap that and please test #950 if that compiles (I only have a Mac around now).
@fpicot commented on GitHub (Jan 27, 2022):
This seems to be fixing the issue, but there are some weird behaviors.
With volume-control=linear and volum-range not set I'm seeing the log "DEBUG librespot_playback::mixer::alsamixer] Alsa dB volume range was detected as 100023.9921875 but overridden as 60", and changing the volume in spotify changes the volume in alsa
With volume-control=cubic or log, I have to explicitly set volume-range, or I still get the raw alsa volume forced to 0 (with log, the volume gets mapped to NaN)
I'm not sure I understand the volume-range settings. The doc says "For the alsa mixer: what the control supports." , and amixer reports :
I would expect to set volume-range to 248 to have the best granularity, is this correct ? It's not possible as volume-range is limited to 100.
Regarding your question about softvol, I wonder if there isn't another bug somewhere. I'm passing this conf via env variables :
But the logs show "DEBUG librespot_playback::mixer::alsamixer] Alsa mixer control is softvol: true"
With the previous version of librespot that I was running (0.24 I believe), I could not get the softvol mixer to a correct setting. Either I had fine control over volume but no possibility to get high volumes, or I could reach high volumes but the smallest change in spotify would cause a big change in audio volume. It also allowed me to used the equalizer plugin of alsa.
@fpicot commented on GitHub (Jan 27, 2022):
I was able to confirm the alsa-mixer-control issue, #953 opened to track it separately;
@roderickvd commented on GitHub (Jan 27, 2022):
The weird behavior is caused by your hardware or its Alsa driver that reports an insane range of over 10000 dB. That makes no sense and then the volume controls don’t work as expected. This is what the warning is about to set it manually.
The 248 steps are taken over correctly. So you have 10000 dB / 248 steps = non-sensical step size.
It also detects that your
Mastermixer is not done in hardware, but in software. Is this not correct?I think my PR fixes the issue and the rest is explained by your configuration.
@roderickvd commented on GitHub (Jan 27, 2022):
I think the docs also say that the volume range is specified in dB or did we omit that?
@fpicot commented on GitHub (Jan 27, 2022):
What I meant is that when setting volume-ctrl to linear, the default value of 60 for volume-range is used (while the doc seems says it should only be when using mixer=softvol), but when setting volume-ctrl to cubic or log, I must explicitly set the volume-range parameter.
But indeed, a bad driver is the root of the issue.
OK, got it! And indeed the doc states that volume-range is in dB.
Yes, there is no volume button on the hifiberry board, I did not understand this log correctly.
Thanks a lot for your patience and your explanations!
@roderickvd commented on GitHub (Jan 27, 2022):
Which doc are you referring to?
That's not the same. Some DACs do volume control in their own chip, so to speak. I think your HiFiBerry Amp can do that (but not with software plugins), but that's a configuration issue and not something that belongs here.
Sure. We weeded out one bug, after all 👍