-
-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Is your feature request related to a problem? Please describe.
I'm using hifiberry sound card which comes with integrated volume control. Sound quality-wise, it is preferred to use it instead of software volume control which reduces signal-to-noise ratio. As I learned from a brief search, Java sound API cannot directly access ALSA mixer controls which are used to manage volume implemented in sound card, so it provides a gain setting which is a software solution.
Describe the solution you'd like
To use integrated volume control of sound card, I believe onVolumeChanged shell event #329 combined with a bypassSinkVolume setting #317 could be a good way. Amixer provides command line interface to control the volume, e.g.:
amixer set 'Digital' 5%- - lower the volume by 5%
amixer set 'Digital' 5%+ - raise the volume by 5%
amixer set 'Digital' 60% - set the volume to 60%
What I'm missing is either:
- Existing VolumeChanged shell event will be replaced with some VolumeLowered and VolumeRaised events accepting a parameter calculated as 100/volumeSteps so that I could call "amixer set 'Digital' $1%-" or "amixer set 'Digital' $1%+" respectively.
- To be able to pass a parameter into the shell command configured for VolumeChanged event. This parameter will be having an integer, 0-100 value set by librespot-java converted from and matching a current volume setting so that I could call "amixer set 'Digital' $1%"
Option 1 (the relative volume changes) is preferred to avoid sudden volume jumps when triggering volume change from librespot-java because it does not read the current ALSA control volume level. On my machine I am using other applications which modify volume using alsa mixer (squeezelite for instance) and they can leave the setting eg. at desired quiet level of 20% and when I switch to librespot-java which I previously left for example at volume 40000/65536, I don't want to be deafened by jumping to somewhere around 60% by setting exact value.
Describe alternatives you've considered
I did not think of any so far. I could always use gain volume control but it collides with volume setting done by other apps that change alsa mixer volume.
Additional context
none