SW mixer volume level after external DAC off-on

Hello everyone!

I’d like to ask for help regarding the software volume mixer. My Volumio runs on an rpi3b, online 24/7. The SMSL DL200 DAC is automatically turned on via infrared integration when I want to listen to music. I’m using the SW mixer because, unfortunately, this DAC doesn’t support a HW mixer.
I’ve observed that after the DL200 is turned on, alsa/volumio recognizes the DAC and retains the SW mixer settings, but always sets the volume to 100%, even though the starting value is set to 30%. The volume control in my audio chain is tuned so that a 30% starting level would be appropriate, but the 100% starting level has startled my family a few times. The amplifier is analog and is switched by an ampswitch plugin, with only manual volume control.

I also have a Khadas Tone Board where the HW mixer works, and I don’t have this problem with it, it remembers the correct volume level. However, I’d like to use the DL200 because of its superior sound quality (for me).
Could anyone provide advice on how to fix this?

I’d like to avoid turning off the pi3b and manually turning on the DAC and Volumio every time.

Thank you in advance for any suggestions!

I’ve noticed the same thing. But I use a Topping E50 DAC.
USB is not suitable for me for this reason.
I bought an Allo DigiOne Signature and the connection is therefore coaxial. It works wonderfully and the sound is at least as good as USB.
It’s a relatively expensive option, but the fantastic sound makes it justifiable.

1 Like

Hello everyone!

I’ve found a temporary workaround, but I’ll continue my investigations to implement a cleaner solution!

Temporary workaround: An existing Python script (responsible for turning on the DAC when a client connects to Volumio) monitors this log message: CoreCommandRouter::volumioRetrieveVolumeLevels.

Based on log analysis, this log entry becomes available after the DAC connection, and then I use a Volumio CLI command to set the volume to 30%.

I’ve already examined asound.conf and the alsa_controller plugin, but I haven’t found a solution yet to prevent it from setting the volume to 100% after a DAC on/off. The workaround is working, I’ll test it for a few days, and I’ll continue to develop a permanent solution!

I’ve found a much better solution while examining volumecontrol.js!

By making a small modification to the code, I’ve managed to ensure that after USB DAC (without hardware mixer support) unplug-plug or off-on state changes, the software mixer volume value matches the default startup volume! Thanks to this, when the DAC is reconnected, the volume doesn’t jump to 100%, but instead sets to the DAC’s configured software mixer startup volume, even without a Volumio restart.

I’ve changed this:

CoreVolumeController.prototype.updateVolumeSettings = function (data) {
  var self = this;

  self.logger.info('Updating Volume Controller Parameters: Device: ' + data.device + ' Name: ' + data.name + ' Mixer: ' + data.mixer + ' Max Vol: ' + data.maxvolume + ' Vol Curve; ' + data.volumecurve + ' Vol Steps: ' + data.volumesteps);

  if (data.mixertype !== undefined && mixertype !== 'None' && mixer !== undefined && mixer.length && (data.mixertype === 'None' || data.mixertype === 'Software')) {
    self.setVolume(100, function (err) {
//    self.logger.info(StartupVolume);
      if (err) {
        self.logger.error('Cannot set ALSA Volume: ' + err);
      }
    });
  }

To this:

CoreVolumeController.prototype.updateVolumeSettings = function (data) {
  var self = this;

  self.logger.info('Updating Volume Controller Parameters: Device: ' + data.device + ' Name: ' + data.name + ' Mixer: ' + data.mixer + ' Max Vol: ' + data.maxvolume + ' Vol Curve; ' + data$
  if (data.mixertype !== undefined && mixertype !== 'None' && mixer !== undefined && mixer.length && (data.mixertype === 'None' || data.mixertype === 'Software')) {
    var startupVolume = this.commandRouter.executeOnPlugin('audio_interface', 'alsa_controller', 'getConfigParam', 'volumestart');
    if (startupVolume !== 'disabled') {
        self.setVolume(parseInt(startupVolume), function (err) {
            if (err) {
                self.logger.error('Cannot set ALSA Volume: ' + err);
            }
        });
    } else {
        self.setVolume(30, function (err) {
            if (err) {
                self.logger.error('Cannot set ALSA Volume: ' + err);
            }
        });
    }
  }

Thanks balbuze for the improvement in my comment!
Improvement of my GitHub knowledge is ongoing :slight_smile: I will try the pull request again after that.

Thank you for your contribution @csuti ! I added a comment on your PR since it requires some rework :wink: