AlsaMixer settings for HifiBerry DAC2

Hi again,

Currently using Mopidy on a Raspberry Pi 4 with Hifiberry DAC2 HD. This is a pretty new configuration and I’m still trying to get the hardware mixer to work with it. Without any mixer configured, playback is good, but I’m losing about 20db of gain on my amplifier. I just had a small breakthrough with amixer so I think I’m close.

Poking at amixer, I found:

amixer -c 2
Simple mixer control 'DAC',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 240
  Mono:
  Front Left: Playback 200 [83%] [-20.00dB]
  Front Right: Playback 200 [83%] [-20.00dB]
Simple mixer control 'DAC Invert Output',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'DAC Rolloff Filter',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]

setting the DAC’s simple control to 240 gives me 0dB gain on my amp:

amixer -c 2 sset DAC
Simple mixer control 'DAC',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 240
  Mono:
  Front Left: Playback 240 [100%] [0.00dB]
  Front Right: Playback 240 [100%] [0.00dB]

so, I’m thinking my mopidy.conf should have something like:

[audio]
output = alsasink device=hw:2,0
mixer = alsamixer
mixer_volume = 100

[alsamixer]
card = 2
control = DAC
min_volume = 0
max_volume = 240
volume_scale = linear

Looking at alsamixer’s source, I think this should work. I’m going to test and report back.

max_volume = 100

Apparently alsamixer does the deed of converting those to the mixer’s max value.

In any case, this works and I have functional hardware volume control!

Yep, there is a description of the config settings at https://github.com/mopidy/mopidy-alsamixer#configuration

1 Like

Map the Mopidy volume control range to a different range.

I guess that wasn’t entirely obvious or clear to me. I might have reworded it to:

Map the Mopidy volume control range to the range of the device.

or something to make it more explicit that there’s a translation happening. That’s a tricky one.

I’m just happy to have this sorted out so I can enjoy some music again. :smile: