Making your own Raspberry Pi music streamer

I like to build stuff myself. I made my own speakers, both in the kitchen and in the living room for instance. And to stream music to these speakers I also made my own streaming devices with a DAC using a Raspberry Pi. This gives me the freedom to implement any streaming protocol I need. Right now I need Spotify Connect and Airplay, but if any time in the future I need some other protocol I can implement that as well.

I find the open source implementations of both Spotify Connect and Airplay very stable. We have been using this setup for a few years now, and I can say that it is much more stable than the Pioneer system we used before.

Here is a step by step setup guide.

Get your hardware

I use a Dion Audio Loco as a DAC and amplifier in the kitchen. And I use the horribly named Audiophonics I-Sabre ES9038Q2M connected to an old Mission Cyrus II in the living room. These are hifi DACs, and priced accordingly. But you can use any raspberry pi DAC that you want.

Connect your DAC to your Raspberry Pi. I use a Raspberry Pi 3B+. It is powerful enough, and it has a much better Wifi antenna than the 3B (without the + sign). So you don’t need a Raspberry Pi 4.
That’s the easy part. Now we need the software.

The simplest, but least flexible way

There are a few ways to do this. There is for instance Moode Audio, which is pretty easy to setup. It is much easier to get things going for the first time, but since it is a system that someone else makes, it is less flexible. I tried it a few times, it works really well, but every time I switch back to my own bare bones version. Which I explain here.

Install Raspbian Lite

You don’t need a desktop version of the operating system on your Raspberry Pi. We will setup the whole thing using the command line, which gives us extra nerd points.

First install Raspberry Pi Imager on your computer. This makes it easy to burn the Raspbian Lite operating system onto your micro SD card. Instert the card into your own computer, click on Choose OS > Raspberry Pi OS (other) > Raspberry Pi OS Lite (32 bit), and burn it onto your card.

When the burning is done, insert your SD card into your computer again. You need a add a few files to it before you startup the Raspberry Pi:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

    ssid="The name of your Wifi network"
    psk="Y0ur 5up3r 53cr3t p4ssw0rd"

With these files in place you can now insert the card into your Pi and start it up.

SSH into your Pi.

My router has a nice overview of all the devices connected to it, with their IP addresses. But there are other ways to find the IP address of this new Raspberry Pi. Find it, then connect to your Pi

ssh pi@

The default password is raspberry

It works, hurray!

Before we install anything, we need to do some housekeeping. When I setup a new Raspberry Pi, these are the stept I take.

Read the details about how to setup a Raspberry Pi

First change the password and network name:

echo "pi:yoursecretpassword" | sudo chpasswd

If you want to you can change the name of your device.

sudo sed -i "s/raspberrypi/nerdymusicplayer/" /etc/hostname
sudo sed -i "s/raspberrypi/nerdymusicplayer/" /etc/hosts

Expand the filesystem to use the complete disk

sudo raspi-config

Use your arrow keys to select Advanced Options > Expand Filesystem
Select OK, and restart the Pi. Now ssh into the Pi again (use your new password).

sudo apt update
sudo apt dist-upgrade

This can take a while. After the upgrade is complete, reboot again, just to be sure.

Setup the audio device

You will need to tell your device to use your DAC. This is usually done by editing the file /boot/config.txt. I use Nano as a text editor. Which is a bit weird when you use it for the first time, but you will get used to it.

sudo nano /boot/config.txt

Find the part where it says # Enable audio (loads snd_bcm2835)

Below that, for the Dion Audio Loco, it should look like this:

# Enable audio (loads snd_bcm2835)

For the Audiophonics I-Sabre ES9038Q2M it should look like this:

# Enable audio (loads snd_bcm2835)

Read the manual of your DAC to find out how it should be done exactly.

In Nano you have to type control + o (write oot) and control + x to save and exit.

Now type alsamixer into the terminal and you should now see all the options that your DAC offers. Quite a few when you use the Audiophonics, and only volume when you use the Loco. I always set the volume here to maximum since all volume is controlled using software.

Install Airplay

There is a brilliant, very stable and well maintained open source implementation of the Airplay Protocol called Shairport-Sync. Have been using it for years now and it never failed me.

Installation is pretty straightforward. You should probably read the simple installation guide. Here’s a functional summary of that guide.

First we need to install all the things that Shairport Sync needs in order to run. For the basic configuration, this should work:

sudo apt install build-essential git xmltoman autoconf automake libtool \
    libpopt-dev libconfig-dev libasound2-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev

Now install Shairport Sync

git clone
cd shairport-sync
autoreconf -fi
./configure --sysconfdir=/etc --with-alsa --with-soxr --with-avahi --with-ssl=openssl --with-systemd
sudo make install

Some steps might take a while.

Now we need to change some settings in the config file:

sudo nano /etc/shairport-sync.conf

Read through it. Indeed, there are quite some settings! Most of the can probably be ignored, but there a a few that you could change. Make sure you remove the // at the beginning if each line you want to use. These are some of the settings I use

interpolation = "soxr";
output_backend = "alsa";
allow_session_interruption = "yes"; // Gives us the power to switch music when we don’t like what others are playing.
output_rate = 88200; // Higher numbers don’t seem to work on my Raspberry Pi
output_format = "S32"; // These numbers are not supported by all DACs

We want to make sure that Shairport Sync starts whenever we restart the Pi:

sudo systemctl enable shairport-sync

And now we want to start it to test it

sudo systemctl restart shairport-sync

Now open your Apple device, and your nerdymusicplayer should appear in the list of Airplay devices.

Install Spotify Connect

If you have a Spotify Premium account you can play your music via your Raspberry Pi. For this I use Raspotify. Installation is super easy, as you can read on their site:

curl -sL | sh

Now edit the config file:

sudo nano /etc/default/raspotify

There is not much to change here. I always set the bitrate to the highest quality:


You might want to change the initial volume to something else that 100, especially when you control the volume from within Spotify, and not with some sort of a physical volume knob on your stereo. For instance:


This works fine in the Blasterchef in our kitchen.
After changing the settings you should restart Raspotify:

sudo systemctl restart raspotify

The Pi should now appear as one of the devices in your Spotify app.
If the Pi doesn’t appear in Spotify after a restart you might need to type this:

sudo systemctl enable raspotify

There are other protocols to stream music to your Raspberry Pi. Since I never used them, I cannot explain them to you. But if you managed to complete this super nerdy setup, you should be able to figure it out by using the correct terms in Duckduckgo.

Final steps

You should SSH into your Pi every now and then in order to check for updates:

sudo apt update
sudo apt dist-upgrade

Power saving

There are quite a few ways to save power. Some save lots, other are marginal.

Read all the power saving options

First you might want to add a power button to your Pi in order to shut it down when you don’t need it. This is an excellent tutorial.

Disable stuff you don’t need

If you don’t need ethernet of USB you should disable the ethernet and the USB block:

sudo crontab -e

Now add this line to the bottom of that file:

@reboot echo '1-1' |sudo tee /sys/bus/usb/drivers/usb/unbind

This saves lots.

If you do use ethernet but don’t need wifi, you should disable wifi:

sudo nano /boot/config.txt

Add this line to the bottom of that file:

# Disable Wifi

If you don’t use bluetooth, you should disable it:

sudo nano /boot/config.txt

Add this line to the bottom of that file:

# Disable Bluetooth

And you should disable the related services, because you don’t need them:

sudo systemctl disable hciuart.service
sudo systemctl disable bluealsa.service
sudo systemctl disable bluetooth.service

You can disable the LEDs in /boot/config.txt as well. Add these lines:

# Disable the ACT LED.
# Disable the PWR LED.

Read-only file system

If everything works, and you are happy with your setup, you can choose to switch to a read only file system. This way you cannot break things by accident. Type sudo raspi-config. Now use your arrow keys to go to Performance Options > Overlay File System. Select Yes to enable the overlay file system, and select Yes to make the boot partition read only. When you’re done, use your right arrow key to Finish, and reboot.

Just remember, from now on before you want to change something, make sure to disable the overlay file system, and if necessary, make the boot partition writable again.