Kodi Community Forum

Full Version: Can I get the volume control to directly control a hardware mixer control?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm on a Raspberry Pi, but I believe this question is general to Linux. I originally posted it to the OSMC board but now think it's general to Kodi, rather than specific to OSMC.

The Kodi volume control is (I believe) a software mixer, and it isn't controlling the main hardware volume mixer of my audio device (Hifiberry Amp2), which is listed in alsamixer as "Digital".

Image

When I change the volume in Kodi that mixer doesn't change, though I do hear a difference in volume. It's just limited to whatever I've set the volume to in alsamixer. I don't like this, since it means I either have to SSH in and use alsamixer (which is a pain obviously) or I have to keep that at maximum and use Kodi's volume control, which is also not ideal since it'll negatively affect signal-to-noise ratio.

Is there a way to get Kodi's volume control to directly control this particular audio mixer control?
Unmap the volume keys. Map them to scripts that call amixer commands is an option for you. Kodi by default uses "internal float" volume for ALSA normally - you can easily keep the ALSA volume at 95% and use kodi-send from the shell to control the volume - perhaps this is an option.
I don't think I fully understood what you said about kodi-send, but anything which involves keeping the hardware volume high will have the problem I'm posting about -- signal-to-noise ratio suffers.

Regarding mapping the volume keys to scripts to run amixer commands, that would work but comes with its own set of disadvantages:

- there'd no longer be any on-screen indication of volume level
- any (theoretical) scripts/addons which want to adjust Kodi's volume would still be adjusting the software volume level
- remote controls such as the Android app would still be adjusting the software volume level

Would you consider adding this as a new feature to Kodi?
If signal to noise is a problem in loud volume, you should never bump the volume to that range. Therefore I see no benefit in that. Keep it at a volume where sn is okay and use SW volume.

On the other side Kodi can use external volume, but it's to be implemented for the sink you are using. Pulseaudio works that way.
It's no problem at loud volume. It's a problem at low volume since attenuating a signal while it's still digital is equivalent to reducing the bit depth. Dynamic range is lost and quality suffers.

Can you tell me what you mean by Kodi using external volume? I can't find anything in the documentation about this.
I found this: https://github.com/xbmc/xbmc/pull/570 which added this feature among others:
Quote:check whether a CEC capable amp is avaiable on the bus. when one is found, the PCM volume is set to 100%, and all volume related changes (vol up, down, mute) are sent to the amp.

I wonder if I can leverage that. Any idea if it's possible, on the same machine running Kodi, to fake the presence of a CEC-capable amp, intercept the volume control signals to it, and run amixer commands when they're received?