Putting volume control as far downstream as possible in the audio signal chain is a well established best practice for maximizing signal/noise(+distortion) ratio while avoiding clipping. It’s why “Hardware” volume control (i.e. in the analog domain after A/D conversion) in external DACs is generally recommended over “Software” volume control (i.e. in the digital domain before A/D conversion) when available.
Unless I’ve missed something, at present post-D/A volume control via the Volumio UI (or Volumio APIs) is only available if a DAC meeting all other system requirements (#channels, hopes, dreams, budget, etc, etc) also has an accessible Hardware volume control (mixer). If you want volume control downstream of some (heaven forfend) analog stages post-DAC, or want to run multiple DACs in parallel for any reason, you’re just out of luck. It seems difficult or impossible to delegate hardware volume control anywhere besides the directly connected playback device (DAC). If I misunderstand, please correct me and ignore the question below.
I want to use a dedicated hardware device to handle analog gain (volume) control for an abitrary (or at least reasonably scalable) number of channels, just ahead of power amplification, under control of a Raspberry Pi Volumio host. I have working gain control prototype using AD5234 digital potentiometer circuits controlled via I2C. There are apparently many similar alternative devices/circuits.
I also have a reasonably clean prototype Volumio plugin that listens to Volumio’s volume setting and sets the external circuit gain accordingly. It’s not packaged and tested for prime time but seems to work well.
The problem:
If this plugin is enabled with a standard HW or SW mixer active, it does what it’s supposed to do, but so does the standard mixer. The system sort of works, but passing through two voloume controls screws up the gain curve and entirely defeats the purpose :(. If the Mixer Type is set to “None” the Volume slider doesn’t operate at all, again :(. What’s needed is a mode that disables the standard mixer while keeping the volume slider and state notification active. I have a hack - editing mixer.value in /data/configuration/audio_interface/alsa_controller/config.json to something invalid, then write-protecting the file so volumio can’t overwrite it. This seems to work fine for my purposes, but it results in “Cannot set ALSA Volume” log messages, surely breaks the “Volume Options” UI, likely interferes with future system upgrades, and who knows what other evil. I’ve seen enough related questions on this forum to convince me others might find it useful if I could fix these issues and get the plugin into a releaseable form.
My question:
Is there a clean and proper way to configure Volumio’s volume control so it operates and notifies, but doesn’t do or connect to anything else, leaving actual volume control to external hardware via a plugin? Ideally such configuration should happen as part of plugin installation/enabling, correct?