This mini tutorial assumes you have installed your HiFiBerry Amp2 hardware to your Raspberry Pi and configured it using this tutorial:
https://www.hifiberry.com/docs/software/configuring-linux-3-18-x/
This tutorial also builds off these excellent web pages
- http://www.gerrelt.nl/RaspberryPi/wordpress/tutorial-installing-squeezelite-player-on-raspbian/
- http://www.winko-erades.nl/installing-squeezelite-player-on-a-raspberry-pi-running-jessie/
and just makes their advice specific to the HiFiBerry hardware.
(This worked with this hardware list: https://mystupidnotes.com/desktop-audio-raspberry-pi-logitech-media-server-shopping-list/
and after an upgrade to Raspberry Pi 4.)
First, let’s list all soundcards and digital audio devices on our Raspberry Pi with:
aplay -l
The result should be:
**** 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

Let’s just double check that the HiFiBerry Amp2 is available to Squeezelite with:
sudo /usr/bin/squeezelite -l
Here it is:
Output devices:
null - Discard all samples (playback) or generate zero samples (capture)
default
sysdefault:CARD=sndrpihifiberry - snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0 - Default Audio Device
dmix:CARD=sndrpihifiberry,DEV=0 - snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0 - Direct sample mixing device
dsnoop:CARD=sndrpihifiberry,DEV=0 - snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0 - Direct sample snooping device
hw:CARD=sndrpihifiberry,DEV=0 - snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0 - Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0 - snd_rpi_hifiberry_dacplus, HiFiBerry DAC+ HiFi pcm512x-hifi-0 - Hardware device with all software conversions

I like to kill Squeezelite before modifying the config with this:
sudo service squeezelite stop
Let’s modify our Squeezelite config with the nano text editor:
sudo nano /etc/default/squeezelite
If you followed the tutorials at the top to get started, you should see something like this:
# Defaults for squeezelite initscript
# sourced by /etc/init.d/squeezelite
# installed at /etc/default/squeezelite by the maintainer scripts
# The name for the squeezelite player:
SL_NAME="$(hostname -s)"
# ALSA output device:
SL_SOUNDCARD="sysdefault:CARD=sndrpihifiberry"
# Squeezebox server (Logitech Media Server):
# Uncomment the next line if you want to point squeezelite at the IP address of
# your squeezebox server. This is usually unnecessary as the server is
# automatically discovered.
#SB_SERVER_IP="192.168.x.y"
# Additional options to pass to squeezelite:
# Please do not include -z to make squeezelite daemonise itself.
#SB_EXTRA_ARGS="-a 180"

Line 9 in the code above the image is the one we want to get the HiFiBerry card working for Logitech Media Server.
On this excellent site: http://www.winko-erades.nl/installing-squeezelite-player-on-a-raspberry-pi-running-jessie/ it’s mentioned that you should change:
#SB_EXTRA_ARGS=""
To:
SB_EXTRA_ARGS="-a 180"
Although, I am not sure if that is needed with the HiFiBerry card. I can’t tell any difference either way, so I tried it, but ended up commenting it out in the config above.
Ctrl+o to save and then Ctrl+x to exit the nano editor.
sudo service squeezelite start
A refresh of your Logitech Media Server screen should show your Squeezelite player!
