Skip to content

An SD card image to run Raspberry Pi based wireless Hifi speakers for multi-room audio

License

Notifications You must be signed in to change notification settings

mgoltzsche/highfipi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

highfipi

Raspbian based SD card images to run a wireless multi-room audio system using mopidy and snapcast on Raspberry Pis.

Build the images

The images defined within this repository are built using Packer along with the arm-image builder.

The Makefile specifies a build target for each image. Each of these build targets writes an image into ./output-arm-image/image.

Prerequisites

To build the SD card images, you need to have the following tools installed on your host:

  • Golang >=1.16
  • qemu-user-static
  • kpartx

For instance on Debian-based Linux distributions you can do so as follows:

sudo apt-get install golang qemu-user-static kpartx

Alternatively you can build the images using docker. While this does not require additional dependencies, it fails randomly due to asynchronously populated loopback devices within the container.

Build the speaker image

The speaker image comes with a snapcast client and is meant to be run on a Raspberry Pi 3 with a Hifiberry Amp2 or DAC+ Standard/Pro. You can build it as follows:

sudo make build-speaker WIFI_SSID=<WIFI_NAME> WIFI_PASSWORD='<PASSWORD>' WIFI_COUNTRY=<TWO_LETTER_COUNTRY_CODE> SPEAKER_HOSTNAME=<HOSTNAME>

Alternatively you can build the image using docker:

make docker-build-speaker WIFI_SSID=<WIFI_NAME> WIFI_PASSWORD='<PASSWORD>' WIFI_COUNTRY=<TWO_LETTER_COUNTRY_CODE> SPEAKER_HOSTNAME=<HOSTNAME>

If you boot your Raspberry Pi from that image, it will connect to a snapcast server within your local network automatically.

Build the streamer image

The streamer image comes with a snapcast server and mopidy preinstalled. It does not necessarily require any sound card attached to the Raspberry Pi since mopidy is configured to send audio to the snapcast server directly currently. You can build it as follows:

sudo make build-streamer

Alternatively you can build the image using docker:

make docker-build-streamer

Please note that the streamer should be connected via ethernet in order to free WLAN bandwidth for the speakers. Correspondingly the streamer disables WLAN by default.

Once you booted a Raspberry Pi from that image, you can access Iris (a mopidy web UI) at http://highfipi-streamer:6680/iris within your local network.

You may wish to install additional mopidy plugins and configure authentication for them, as it is needed for eg. mopidy-soundcloud and mopidy-youtube. You'd have to do that manually after booting a Raspberry Pi from the image by placing a corresponding configuration file into /usr/share/mopidy/conf.d/ and restarting mopidy using sudo systemctl restart mopidy.
You can check the mopidy logs for configuration errors using the command sudo journalctl -u mopidy.

Flash the image to an SD card

You can write a previously built image to an SD card as follows:

TARGET_DEVICE=/dev/sdX
sudo umount ${TARGET_DEVICE}* || true
sudo dd bs=4M if=./output-arm-image/image of="$TARGET_DEVICE"
sync

ATTENTION: Please replace /dev/sdX carefully with the path to the device you want to write the image to - specifying the wrong device can cause data loss! To find the correct device path, you can use lsblk.

Stream audio from your workstation or laptop

You don't need to use a dedicated Raspberry Pi as snapcast server/streamer. You could as well install a snapcast server on your workstation or laptop. This example shows how you can make pulseaudio stream into snapcast, allowing you to select "Snapcast" as a virtual device within pulseaudio's pavucontrol GUI in order to play audio from your machine on all connected snapcast clients / speakers synchronously. However the audio is not in sync with locally playing video unfortunately. Also a snapcast client only connects to a single snapcast server so that you either need to stream your machine's audio to a central snapcast server within your local network which distributes it to the snapcast clients (adds additional latency!) or you need to make sure that the snapcast clients are connected to the right snapcast server (by turning off other snapcast servers).

About

An SD card image to run Raspberry Pi based wireless Hifi speakers for multi-room audio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published