mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #39] ALSA: support selection of ALSA mixer - for (hardware-based) volume control #28
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#28
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 @sashahilton00 on GitHub (Jan 29, 2018).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/39
Thursday Jan 05, 2017 at 04:29 GMT
Originally opened as https://github.com/plietar/librespot/issues/140
Some DAC cards support hardware-based volume control. Example: HiFiBerry DAC+ pro on Raspberry.
Using librespot (v20161230-7fd8503) from: https://github.com/herrernst/librespot/releases
On raspberry pi + OSMC (raspbian) + above mentioned DAC. Works very well out of the box.
Running the client with:
/home/osmc/librespot/librespot --name Raspberry --cache /tmp --bitrate 320 --backend alsa --device hw:0
I notice using alsamixer and librespot in verbose mode that changing that volume changes in the client causes some events in librespot,
DEBUG:librespot::spirc: kMessageTypeVolume ...
...
the audio volume does change, increase/decrease, however alsamixer doesn't show any actual mixer volume change at all in any of its mixers, which seems to indicate that the volume change is done by librespot itself as a "software volume change". Higher end DACs can control volume via hardware which is preferable. In the case of the HiFiBerry DAC pro, the Alsa mixer is called "Digital" (shows up as one of the mixers displayed by the "alsamixer" tool)
When using spotify-connect-web, running it as:
spotify-connect-web --key /home/your-user/your-key.key --name Raspberry --bitrate 320 --playback_device hw:0 --mixer Digital
...any volume change in the spotify client causes the alsamixer "Digital" mixer to reflect the change (value between 100 and 0), which indicates that the volume change is being done via hardware. Note that spotify-connect-web also supports "software-based volume control" if desired
@sashahilton00 commented on GitHub (Jan 29, 2018):
Thursday Jan 05, 2017 at 13:31 GMT
This is definitely a frequent request (#128 and #75).
Originally, librespot only supported PortAudio, which doesn't have any sort of volume control.
@joerg-krause had an implementation for ALSA at some point. It would need to be adjusted to at least fallback to software volume control for other backends
@sashahilton00 commented on GitHub (Jan 29, 2018):
Sunday Mar 26, 2017 at 18:04 GMT
Noticed that today's binary release for raspberry by @herrernst supports a "--mixer" option!
Tried it & librespot crashed like so:
Amixer shows that the "Digital" mixer exists:
...
Simple mixer control 'Digital',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 207
Mono:
Front Left: Playback 207 [100%] [0.00dB] [on]
Front Right: Playback 207 [100%] [0.00dB] [on]
...
Tried with other mixers shown by alsamixer & amixer, and they all crash librespot
Wondering if the --mixer command line switch is not yet ready for use, or if it's meant to be used differently
@sashahilton00 commented on GitHub (Jan 29, 2018):
Monday Mar 27, 2017 at 05:39 GMT
It's meant to use different. For now, there is only one mixer supported: softmixer.
--mixeris not the ALSA mixer device name.@ComlOnline commented on GitHub (Jan 29, 2018):
This is @joerg-krause's implementation that @plietar referenced. @joerg-krause Did you make any more progress with this?
And as an addition note I'm going to close this issue and refer people to #45 for continued discussion as it looks more informative.