Volume control and sound control with Raspberry Pi, HiFiBerry AMP2, old stereo speakers and IRIS

Hello, I have mopidy running as a service on the raspberry pi and have old speakers with the black and red wire hooked up to a HiFiBerry AMP2. The first time I played a song through them it sounded awful (rattly bass and sounded like the speaker blew) but it didn’t sound as loud as I’ve had it when plugged into a stereo.

I only have the HiFiBerry plugged into the GPIO on the Raspberry Pi, I have no other power going to it. The pi is powered by a USB cord to my laptop. My first question is is this part of my problem?

My next question is is there an additional edit to my config file I need to do to be able to control the volume? It stays at the same volume regardless of what the slider in Iris is set to. Below is my sudo mopidyctl config file.

Running “/usr/bin/mopidy --config /usr/share/mopidy/conf.d:/etc/mopidy/mopidy.conf config” as user mopidy
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy
max_tracklist_length = 10000
restore_state = false

verbosity = 0
format = %(levelname)-8s [%(threadName)s] %(name)s %(message)s
color = false
config_file =

mixer = alsamixer
mixer_volume =
output = alsasink device=hw:0,0
buffer_time =

scheme =
hostname =
port =
username =
password =

enabled = true
username = jdaniszewski
password = ********
client_id = 52ec8f70-1130-4bab-96d0-532a8f537be8
client_secret = ********
bitrate = 160
volume_normalization = true
private_session = false
timeout = 10
allow_cache = true
allow_network = true
allow_playlists = true
search_album_count = 20
search_artist_count = 10
search_track_count = 50
toplist_countries =

enabled = false ; Extension disabled by user config.

enabled = true
language = pl
min_bitrate = 96

enabled = true
country = NZ
locale = en_NZ
spotify_authorization_url = https://jamesbarnsley.co.nz/iris/auth_spotify.php
lastfm_authorization_url = https://jamesbarnsley.co.nz/iris/auth_lastfm.php
genius_authorization_url = https://jamesbarnsley.co.nz/iris/auth_genius.php
data_dir = $XDG_DATA_DIR/iris

enabled = true
refresh_token = ********
bitrate = 160
deviceid =
all_access = false
refresh_library = 1440
refresh_playlists = 60
radio_stations_in_browse = true
radio_stations_as_playlists = false
radio_stations_count =
radio_tracks_count = 25
top_tracks_count = 20

enabled = true
card = 0
control = Master
min_volume = 0
max_volume = 100
volume_scale = cubic

enabled = true
media_dirs =
excluded_file_extensions =
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000

enabled = true
hostname =
port = 6680
zeroconf = Mopidy HTTP server on $hostname
allowed_origins =
csrf_protection = true
default_app = mopidy

enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir =

enabled = true

enabled = true
protocols =
metadata_blacklist =
timeout = 5000

enabled = true
hostname =
port = 6600
password =
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist =
default_playlist_scheme = m3u

Yes. They do mention you need a power supply on the product page and it has a huge power connector on the side of the board.

There are instructions at https://github.com/mopidy/mopidy-alsamixer on how to configure mopidy-alsamixer.


I’ll just follow up with a slightly more helpful answer (I hope). A USB power supply is 5V and normally a couple of Amps maximum, so best case ~10W (and from your laptop probably less). The Pi header exposes that to HATs and for small amplifiers (like the Pirate Audio and the smaller Hifiberry ones) that’s enough but nowhere near what the amp2 requires - it needs its own power supply. That supply connects into the HAT and then also powers the Pi so you’d remove the USB connection to your laptop.

1 Like

The external power fixed the sound quality problem, thank you. However, I am still unable to control volume, even with alsamixer installed.

Here is my aplay -l: **** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ HiFi pcm512x-hifi-0 [HiFiBerry DAC+ HiFi pcm512x-hifi-0]
Subdevices: 0/1
Subdevice #0: subdevice #0

Here’s my asound.conf:

pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm “output”
capture.pcm {
type plug
slave.pcm “input”

pcm.output {
type hw
card 0

ctl.!default {
type hw
card 0

I assume that both of these are relevant files because I had to set the card to o,o in my mopidy config file. Still not sure what this problem is.

My end result is that I would like to control sound with a potentimeter, so I guess I’ll ask that question? Maybe that could help provide a clearer route for my question.

Correction on the typo, set the card to 0,0

you might want to check out my settings I found here:

Try running amixer on your pi to identify the hardware mixer services. You’ll find something like ‘DAC’ or ‘Volume’ for your “alsamixer/control” variable.

Hello, @robcee thanks for the response. Something you have that I don’t is the amixer configs(not sure if they are in fact configs? Is this something I’m supposed to set up in the config file? I’m not remembering seeing anything on amixer)

I tried amixer -c 0 sset DAC like from your other thread and it asks me to specify what I want to set. I’m not sure what to do from here.

When I just run amixer I get the following:

amixer: Mixer attach default error: Invalid argument

There is no extra config for amixer you need to worry about here.

Did you read https://github.com/mopidy/mopidy-alsamixer/blob/master/README.rst#configuration ?

It says you should run the command amixer scontrols to see what mixer controls your card has available. To explicitly do this for card 0 you’d run amixer -c 0 scontrols You need to identify which one of the listed controls is responsible for the volume as sometimes there are many. Running the command alsamixer -c 0 can help with this as it lets you adjust them individually with the name displayed for each. Once you figure out which control you need, you enter that control name in the alsamixer section of your mopidy,conf file.

Alternatively you can read the documentation for your hardware at https://www.hifiberry.com/docs/archive/mixer-controls-on-the-hifiberry-boards/ which claims the mixer control for the main volume on the AMP2 board is called ‘Digital’

card = 0
control = Digital

I have no idea what your asound.conf is doing. Do you really have an audio input? I wonder if that weird config is responsible for:

amixer: Mixer attach default error: Invalid argument

1 Like

weird. I’m wondering if there are differences between hardware drivers in ubuntu vs. raspbian. Seems unlikely. Also, I’ve got a Hifiberry DAC2 HD which has different hardware than the regular DAC and DAC Plus from HFBerry.

I do have an AMP2 in my network and poking at it with amixer, I get:

volumio@xxx:~$ amixer -c 2 scontrols
Simple mixer control 'DSP Program',0
Simple mixer control 'Analogue',0
Simple mixer control 'Analogue Playback Boost',0
Simple mixer control 'Auto Mute',0
Simple mixer control 'Auto Mute Mono',0
Simple mixer control 'Auto Mute Time Left',0
Simple mixer control 'Auto Mute Time Right',0
Simple mixer control 'Clock Missing Period',0
Simple mixer control 'Deemphasis',0
Simple mixer control 'Digital',0
Simple mixer control 'Max Overclock DAC',0
Simple mixer control 'Max Overclock DSP',0
Simple mixer control 'Max Overclock PLL',0
Simple mixer control 'SoftMaster',0
Simple mixer control 'Volume Ramp Down Emergency Rate',0
Simple mixer control 'Volume Ramp Down Emergency Step',0
Simple mixer control 'Volume Ramp Down Rate',0
Simple mixer control 'Volume Ramp Down Step',0
Simple mixer control 'Volume Ramp Up Rate',0
Simple mixer control 'Volume Ramp Up Step',0

volumio@xxx:~$ amixer -c 2 sget "Digital"
Simple mixer control 'Digital',0
Capabilities: pvolume pswitch
Playback channels: Front Left - Front Right
Limits: Playback 0 - 207
Front Left: Playback 123 [59%] [-42.00dB] [on]
Front Right: Playback 123 [59%] [-42.00dB] [on]

So you probably want ‘Digital’ as your mixer control as I’ve set in volumio on my system.

on both of the devices I tested, my audio hats showed up as “Card 2” in amixer. 0 is HDMI and 1 is Headphon/lineout from the Pi.

Hope this helps!

1 Like

Changing control = Digital fixed my problem, and I can now use amixer -c 0 sset Digital 75% to output 75% volume. My volume slider on the Iris front end still does nothing, though. However for what I’m trying to do this shouldn’t be a problem.

1 Like