Skip to content

Instantly share code, notes, and snippets.

@totti2
Last active September 14, 2020 18:10
Show Gist options
  • Save totti2/5626fdcb751ff928d244d5e71f56ca35 to your computer and use it in GitHub Desktop.
Save totti2/5626fdcb751ff928d244d5e71f56ca35 to your computer and use it in GitHub Desktop.
Setup Snapcast-Client with HifiBerry-Amp+ on a Raspberry Pi Zero

This will setup a Snapcast-Client on a Raspberry Pi Zero.
A Hifiberry-Amp+ is attached for sound-output.
The goal here is to fully integrate this into the other gist setting up the sanpcast-server.

SYSTEM ENVIRONMENT

#   PREPARE THE HEADLESS SETUP OF THE PI0 FOR RASPBIAN
#   http://frederickvandenbosch.be/?p=2385


#   WORKAROUND FOR A WIRELESS SETUP OF THE PI0 RUNNING RASPBIAN-STRETCH-LITE
#   https://www.reddit.com/r/raspberry_pi/comments/6ugenm/stretch_and_headless_setup_zero_w/
sudo nano </path/to/SD-CARD>/boot/wpa-supplicant.conf
#   CREATE
        country=DE
        ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
        update_config=1

        network={
                ssid="DUMMY-NETWORK"
                psk="myPassword"
                key_mgmt=WPA-PSK
        }

        network={
                ssid="mySSID"
                psk="myPassword"
                key_mgmt=WPA-PSK
        }


#   TIMEZONE, MEMORYSPLIT, EXPAND FILESYSTEM
sudo raspi-config 


#   COMPILE THE DRIVER OF THE EDIMAX-AC600-EW7811 WIFI-USB-ADAPTER
sudo apt update
sudo apt install build-essential dkms git bc
sudo apt install raspberrypi-kernel-headers
ls /lib/modules/$(uname -r)
git clone https://github.com/diederikdehaas/rtl8812AU.git
cd rtl8812AU/
nano Makefile
#   EDIT
        Line #88 — CONFIG_PLATFORM_I386_PC from y to n
        Linu #89 — CONFIG_PLATFORM_ARM_RPI from n to y
sudo make
sudo make install


#   DEACTIVATE ON-BOARD SOUNDCARD AND INSTALL HIFIBERRY-AMP+
sudo nano /boot/config.txt
#   EDIT
        #dtparam=audio=on
        dtoverlay=hifiberry-amp
sudo reboot


#   DOWNMIX STEREO TO MONO IN ALSA
sudo nano /etc/asound.conf
#   CREATE 
        pcm.!default  {
         type hw card 0
        }
        ctl.!default {
         type hw card 0
        }
        pcm.snd_rpi_hifiberry_amp makemono

        pcm.makemono {
            type route
            slave.pcm "hw:0,0"
            ttable {
                0.1 1    # in-channel 0, out-channel 0, 100% volume
                1.1 1    # in-channel 1, out-channel 0, 100% volume
            }
        }
sudo reboot
aplay -L


#   DOWNLOAD, INSTALL AND CONFIGURE SNAPCLIENT AND CORRECT ITS DEPENDENCIES
wget https://github.com/badaix/snapcast/releases/download/v0.15.0/snapclient_0.15.0_armhf.deb
sudo dpkg -i snapclient_0.15.0_armhf.deb
sudo apt-get -f install
#   LIST SOUNDCARDS
snapclient --list
#   CONFIGURE SNAPCLIENT
sudo nano /etc/default/snapclient
#   EDIT SNAPCLIENT_OPTS=""
#   -h <HOST> -s <SOUNDCARD> -d <DAEMONIZE>
        SNAPCLIENT_OPTS="-h multipi.local -s 2 -d"
sudo systemctl restart snapclient.service
    
@totti2
Copy link
Author

totti2 commented Aug 27, 2018

updated to v15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment