Published in


Building a Raspberry Pi Audio Receiver

Photo by Teguh Baskoro on Unsplash


This post shows how to use a Raspberry Pi to build an audio receiver supporting Bluetooth streaming, AirPlay, Spotify Connect and, UPnP.

Upgrading your old HiFi system

So many of us still have this old HiFi system, that did cost a fortune back in the time but isn’t used so often anymore since we mostly stream music from Spotify, Soundcloud, Mixcloud, Youtube, and other streaming platforms. What if I told you there is an easy way to give your HiFi system an upgrade by reusing that Raspberry pi which is getting dusty somewhere between your other tech gadgets.

Surely, one could also just buy a streaming device that supports all the technologies necessary. I personally already browsed for a well-suited device but didn’t buy it in the end, cause of the high price or maybe also because I didn’t really know what technology to go for. Since the technology decision is nowadays a commitment to a certain manufacturer or streaming provider. Pretty much as it was years back with Tapes, Vinyl, CD, or MiniDisc (right what the heck is MiniDisc =). Therefore we lock ourselves into the ecosystem of a big company. Using a Raspberry Pi for this purpose can cheaper and also more future proof. We can still use the Pi for something else if we don’t need it as a streaming device anymore.

Awesome sound quality

If you aren’t convinced that the Raspberry Pi is a good fit to stream high-quality music, you are partly right. While the hardware of the Pi is totally capable of handling the music transcoding its line-out connector isn’t really top-notch. I would even say you can play music with it but it does sound terrible. Fortunately, there is an easy solution to this problem using a HiFiBerry hat. HiFiBerry is a manufacturer specialized in producing Audio extensions for the Raspberry Pi. I got myself a HiFiBerry DAC2 Pro which does provide pretty good sound quality and made the music streams sound great on my Pioneer HiFi system from 1978.

Upgraded Pioneer Hifi System from 1978

The technology behind

To implement a streaming device that supports Bluetooth streaming, AirPlay, Spotify Connect, and UPnP we make use of various different projects.

BlueALSA → Bluetooth Streaming
Shairport Sync → AirPlay
Raspotify → Spotify Connect
Gmrender-ressurect → UPnP Renderer
Snapclient → Snapcast multi-room audio player

Fortunately, there is a GitHub Repo by NicoKaiser called rpi-audio-receiver that combines all the bricks needed and simplifies the installation procedure with a handy script.

The setup

In this post, I use a Raspberry Pi 4 but a Raspberry Pi 3 should be working as well. Using a Raspberry Pi 2 we also need a WiFi as well as a Bluetooth dongle to get full functionality.

Preparing the microSD card

To set things up we prepare a new microSD card with Raspbian in headless mode. I often use ApplePiBaker to flash microSD cards on my mac. Nevertheless, I did use Raspberry Pi Imager for this manual since some steps are automatically done by ApplePiBaker and I wanted this manual to be as complete and as compatible with Windows and Linux as possible.

Therefore, the first step we do is to insert the microSD card and choose the Raspberry Pi OS Lite.

Choosing the operating system
Getting a custom Raspberry Pi OS
Choosing Raspberry Pi OS Lite

For this project, we don’t use 64-bit and also no GUI so we can go with the default Lite image the Raspberry Pi Imager gives us.

Once the image is written on the microSD card, we also prepare the network configuration and set configure the headless ssh service. To do so we insert the microSD card to our computer once again and create the files in the “/boot” directory.


The first file is the “wpa_supplicant.conf” in which we define the wifi configuration for our Pi and contains the following information:


It is important to ensure that we select the correct country since WiFi settings will be configured according to it. You can find the correct Alpha-2 code here. Also, make sure to change the SSID (WiFi-name) and PSK (WiFi-Password) according to your WiFi.

Headless SSH access

To automatically activate the SSH server right away we also create a second file under “/boot/ssh”. This file doesn’t need any content but tells the pi to activate the SSH server service.

Once we have created the two files our Pi is ready to start. The next step for us is to figure out the IP address of the Raspberry Pi. This can be accomplished using an IP-Scanner such as fing which can be used on Android, iOS, or on the Desktop. We then connect to the Pi via SSH using the default credentials “pi” (username) and “raspberry” (password). For easier access, we can place our SSH public key into the “~/.ssh/authorized_keys” file.

Basic configuration

Once we have access to the Pi we do some basic configuration steps, such as expanding the filesystem, setting the locales, and updating the Pi.

To expand the file system we use the raspi-config menu:

raspi-config menu

We then choose “6 Advanced Options” …

Raspi-config: 6 Advanced Options

… and “A1 Expand Filesystem” to use the whole space on our microSD card.

Raspi-config: 6 … — A1 Expand Filesystem

Then we restart the “raspi-config” again and go to the menu “5 Localisation Options”.

Raspi-config: 5 Localisation Options

Then we choose “L1 Locale”

Raspi-config: 5 … — L1 Locale

In the list, we then uncheck “en_GB” and check “en_US” and continue.

uncheck en_GB
check en_US

Finally, we add the following export to the “~/.bashrc” file:

LC_ALL export in .bashrc file

We then reboot the pi using “sudo reboot” and update all packages once it is booted again:

Apt update & apt upgrade

Installing Raspberry Pi Audio Receiver

Once everything is prepared, we can now install the rpi-audio-receiver using the following commands from the manual on GitHub and follow the instructions from the installation script:

Install rpi-audio-receiver

The commands above will install everything without a HiFiBerry DAC hat. If we want to enable the HiFiBerry separately we can still do it afterward using the following commands:

The HiFiBerry manual helps to choose the right device tree overlay (dtoverlay) configuration.

We can no restart our Pi again using “sudo reboot” and are then ready to go.

Troubleshooting the installation

ALAC problem at Shairport Sync installation

When trying to install the Shairport Sync I came across a problem with the ALAC (Apple Lossless Audio Codec) installation. For me, it worked to install the ALAC project from TimothyGu.

Manually install Apple Lossless Audio Codec

Screen Reader Audio Loop

When I first installed a Raspberry Pi audio receiver, I had issues with the screen reader audio message that was played in an endless loop. I found it easiest to apply to the fix from timg236 I found in the Raspberry Pi forum.

rename the screen reader audio file

Raspberry Pi Audio Receiver in action

We can now connect to our Raspberry Pi as we would do it to any other Bluetooth streaming device or Bluetooth speaker.

Connect to rpi-audio-receiver using Bluetooth

Additionally, we can choose the receiver right from the Spotify app using Spotify Connect.

Connect to rpi-audio-receiver using Spotify Connect

Also, using Apple's AirPlay we can directly play music on our new Raspberry Pi audio receiver.

Connect to rpi-audio-receiver using Airplay

Finally, we can also make use of BubbleUPnP to Stream music using UPnP.

Last Words

As we could see converting a Raspberry Pi into a multi-technology streaming device isn’t too complicated. Using a HiFiBerry digital-analog converter we even get high-quality sound. In my opinion, Plexamp could be a nice complement once an updated headless version for the Pi is released. Let me know what you think and if you have other projects, that could be valuable for other readers. If you liked this blog post, make sure to follow me and support my writing. Thanks for reading.

About the author

Remo Höppli is Co-Founder and Software Engineer at Earlybyte.

Earlybyte is an IT consultancy firm specialized in developing new digital solutions for companies around the world from digitalization to IoT solutions, close to the client and its business embracing agility.

Follow me on Twitter to get informed on new blog posts.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store