The HiFiBerry DAC+ and Amp/Amp+ comes with integrated volume control. Here’s how to get them working with these boards:
Preparations
In some distributions, the needed tools are not installed by default. Therefore you should install them first. On Debian-based distributions this can be done with the following command:
sudo apt-get install alsa-utils
Change volume
The easiest way is using alsamixer
. You can also use mixer
if you want to set a specific volume non-interactively.
Controls of the cards
DAC+
While there are a lot of mixer controls on the DAC+, you only need to care about one named Digital.
amixer sset 'Digital' 90%
All other mixer control allow access to low-level functions of the sound chip. You won’t need them. Unfortunately it is not easy to remove these controls as they are part of a kernel driver that is not maintained by us. Just make sure, the Playback Boost is set to 0%.
To get the full output volume without clipping, the settings should be like this:
amixer sset 'Digital' 96%
amixer sset 'Playback Boost' 0%
Amp/Amp+
There are 2 controls: Master and Channels. With the Master control you control the overall volume while Channels can be used to set different volumes on the left and right channel. Note that excessive volumes can damage your speakers. Therefore we recommend setting the volume not too high on startup.
amixer sset Master 70%
amixer sset Channels 70%,70%
Store/restore volume settings
With Raspbian, a shutdown script is used to store the current volume settings. However many people shut down their system by removing the power. This is not optimal, but usually works without problems. In this case, the latest volume settings are not stored. You can do this manually with the command
alsactl store
Source: https://support.hifiberry.com/hc/en-us/articles/205385241-Mixer-controls-on-the-HiFiBerry-boards