install OS - fcorthay/RPi-multiroom-audio GitHub Wiki
The very first step is to install Raspberry Pi OS. In the present case, it is a Debian GNU/Linux 12 (bookworm).
On a PC, the Raspberry Pi Operating System (RPi OS) can be written on an SD card with the help of the Raspberry Pi Imager.
Choose Raspberry Pi OS (other) > Raspberry Pi OS Lite (64-bit)
as the operating system.
[1]
Next, edit settings
and:
- in the
general
tab :- set a hostname (e.g.
audioAmp
) which will change from one machine to the other - set a user name (I suggest
amp
) and password - don't configure the wireless LAN if you plan to go wired
- set a hostname (e.g.
- in the
services
tab :- enable SSH
The system comes with a boot and a system partition. For backup purposes, it can be of interest to add a data partition which will contain the music files.
Also, in order to ease copying one SD card to another, one can add a swap partition at the end of the disc. With this, if the second SD card's storage is a little bit smaller as the first one, e.g. due to bad sectors, The swap partition might not be complete, but it is easy to create it again from scratch.
When done, insert the SD into the Raspberry Pi (RPi) board and power it on. Once the RPi powered-up, one can continue either on the RPi itself, with a keyboard and a screen, or headless via SSH. In the latter case, open a terminal window on your PC and connect (adapting the names):
ssh [email protected]
Update the operating system:
sudo apt update sudo apt list --upgradable 2>/dev/null | cut -d ' ' -f 1 sudo apt upgrade -y sudo apt autoremove -y
Configure the operating system:
sudo raspi-configChange (as you prefer):
- 1 System Options
- S5 Boot / Auto Login
- B2 Console Autologin
- S6 Splash Screen
- No
- S5 Boot / Auto Login
- 2 Display Options
- D2 Screen Blanking
- No
- D3 VNC resolution
- 1280x720
- D2 Screen Blanking
sudo hostnamectl chassis embedded sudo hostnamectl deployment development hostnamectl status
If there is a swap partition, one can disable the swap file:
lsblk -o name,fstype,size,label,mountpoint swapon -s free -k sudo swapoff /var/swap sudo systemctl status dphys-swapfile | cat sudo systemctl disable dphys-swapfile sudo rm /var/swap
Check if you have Perl
warnings to avoid:
perl -e exit
If you have the warnings, edit the locales
:
sudo sh -c 'echo "LC_ALL=C" >> /etc/default/locale' . /etc/default/locale localeThe changes will come to effect after a new login.
Add the amp
user to the users
and audio
groups:
sudo usermod -G users,audio amp cat /etc/group | grep users sudo chown amp:users /home/amp
Uninstall the CUPS printer server:
sudo service cups stop sudo apt purge -y cups sudo apt purge -y cups-common sudo apt autoremove -y
In order to pipe audio streams from one application to the other, we might want to use ALSA loopback.
Install this anyway:
sudo bash -c 'cat << EOF > /etc/modules-load.d/aloop.conf # alsa loopback snd snd-timer snd-pcm snd-aloop EOF' sudo modprobe snd-aloop
This will, reveal a new sound card called Loopback
.
In order to declare the amplifier hat as an ALSA soundcard,
one usually has to edit /boot/firmware/config.txt
.
Yet some get automatically discovered by the RPi OS.
Check if the amplifier hat has been discovered:
aplay -l | grep ^card
If you don't find the amplifier in the list, install it as described by its manufacturer.
Check the amplifier's capacities:
AMPLIFIER_DEVICE=`aplay -l | grep ^card | grep -v Headphones | grep -v vc4hdmi | grep -v Loopback` AMPLIFIER_SOUNDCARD_ID=`echo $AMPLIFIER_DEVICE | cut -d ' ' -f 2 | tr -d :` AMPLIFIER_SOUNDCARD=`echo $AMPLIFIER_DEVICE | cut -d ' ' -f 3` echo "amplifier soundcard is card $AMPLIFIER_SOUNDCARD_ID, $AMPLIFIER_SOUNDCARD" AMPLIFIER_CAPACITIES=`aplay -v -D hw:$AMPLIFIER_SOUNDCARD --dump-hw-params /dev/zero 2>&1 | grep -iE '^format|^rate|^channels'` echo -e "$AMPLIFIER_CAPACITIES"
Install the multiroom environment from the repository:
cd ~/Documents/ git clone https://github.com/fcorthay/RPi-multiroom-audio.git
Update the configuration script based on the the parameters found above:
nano ~/Documents/RPi-multiroom-audio/configuration.bash source ~/Documents/RPi-multiroom-audio/configuration.bash
The script ~/.bash_aliases
, if existing, is called by ~/.bashrc
and thus run at login on the RPi.
Add to it (adapt the path):
source ~/Documents/RPi-multiroom-audio/configuration.bash
Halt the RPi, remove the SD card and plug it into a card reader.
Find the disk name and adapt:
lsblk -o name,fstype,size,label,mountpoint | grep -v ^loop RPI_DISK=sdc
Make a compressed copy of the SD card (adapt the path and name) :
BACKUP_DIRECTORY='/mnt/backup' MACHINE_NAME='audioAmp' dd status=progress if=/dev/$RPI_DISK | xz -9 > $BACKUP_DIRECTORY/$MACHINE_NAME.img.xz
Decompress the copy to an SD card :
xzcat $BACKUP_DIRECTORY/$MACHINE_NAME.img.xz | dd status=progress of=/dev/$RPI_DISK
Continue the installation process.
-
^
To my first attempts,
aplay -l
reportedno soundcards found
. I solved it by choosing the fullRaspberry Pi OS (64-bit)
as the operating system.