
Setting up an Airtunes Raspberry Pi is a fun project that can breathe new life into your old speakers.
First, you'll need to ensure your Raspberry Pi is running the latest version of Raspbian. This can be done by going to the Raspberry Pi website and following the update instructions.
To get started, you'll need a few basic components, including a Raspberry Pi, a speaker, and a power source. These are the minimum requirements to get your Airtunes Raspberry Pi up and running.
Next, you'll need to install the necessary software, including the Airtunes server and the Airplay receiver.
Preparation
Before you can set up a Raspberry Pi as an Airplay server, you'll need a few things. You'll need a Raspberry Pi, of course, along with a microSD card to install the necessary operating system.
You'll also need to connect your Raspberry Pi to the internet, as you'll be using online repositories to install software. A keyboard and mouse will come in handy for navigating the setup process.
Don't worry if you're not familiar with Linux - the Raspberry Pi's operating system is user-friendly and easy to navigate. Just make sure you have the necessary power supply and cables to connect your Raspberry Pi to your TV or monitor.
Selecting an OS
Choosing the right operating system is a crucial step in setting up your Airplay device. You'll need an SD card with an appropriate OS, and there are many options available, including Raspbian, dedicated media operating systems, and even Windows 10 IoT.
Traditional OSes like Raspbian are a good starting point, but for a barebones system, you'll want something more minimalist. This will free up CPU and RAM for your media streaming application.
Some barebones OSes, like Arch Linux, are geared towards experienced Linux users and can be tricky to install third-party applications and libraries.
On the other hand, some distributions are designed specifically for media streaming and should work out of the box. However, these might not be the best choice if you're looking to learn something from the process.
I recommend choosing Raspbian Lite, which is a mature and command-line driven OS that can be easily configured for "headless" mode, making it ideal for appliance-style installations.
Server Configuration
To configure the Airplay server, you'll need to install some dependencies first.
First, run the following command to install the necessary dependencies.
That's all you need to do to create a persistent Airplay server.
Configure the Server
To configure the server, you'll need to install some dependencies to build the Airplay server application. Run the following command to get started.
You'll also want to configure shairport-sync to start automatically. This will ensure the service launches as soon as the Pi boots up, eliminating the need to start services manually. Just input the command to enable systemd operation.
Rebooting the Pi is a crucial step to create a persistent Airplay server. You can also deploy the server using balena, which will create an application with all the necessary code and configuration settings.
HDMI Out
When you're setting up your Raspberry Pi as a server, you'll want to make sure you're getting the best possible audio output. Try using the HDMI out to transfer a digital audio signal.
You can route audio through the HDMI by setting the AUDIO_OUTPUT environment variable to RPI_HDMI0 (or RPI_HDMI1 for the secondary HDMI on the Raspberry Pi 4).
Shairport-Sync Installation
Shairport-sync is a fantastic piece of software that turns your Linux machine into an Apple Airplay server.
It runs entirely on the command line, which is surprisingly easy to get working out of the box.
The software is maintained by Mike Brady, who has done a great job of making it user-friendly despite having a million configuration options.
To get started, navigate to the shairport-sync directory and configure the build.
Finally, build and install the application, and at the end of this procedure, you should have a working installation of shairport-sync.
Testing and Setup
Testing and setup is a crucial part of getting your Raspberry Pi to stream music wirelessly. To test Airplay, start shairport-sync and grab an iPhone or another device that supports Airplay, ensuring it's on the same network as the Raspberry Pi. Start playing some music, and from the Airplay icon select "raspberrypi" and then "Done".
If you can't hear anything, turn up the volume on your iPhone or source device, as the PCM (headphone) output on the Raspberry Pi isn't great. At this point, you should hear the music played through the Raspberry Pi.
Before you can test Airplay, you need to set up Shairport Sync, which involves installing packages, cloning the repo, and configuring it with various flags. Some important flags include --with-alsa, which outputs to the ALSA system, and --with-avahi, which chooses Avahi-based Zeroconf support. You can find a list of all available flags FlagDescription--with-alsaOutput to the Advanced Linux Sound Architecture (ALSA) system.--with-avahiChooses Avahi-based Zeroconf support..
Test

Testing your setup is a crucial step to ensure everything is working as expected. Grab an iPhone or another device that supports Airplay, and make sure it's on the same network as your Raspberry Pi.
Start playing some music and select "raspberrypi" from the Airplay icon. Then, select "Done" to initiate the music playback through the Raspberry Pi.
Turn up the volume on your iPhone or source device, because the Raspberry Pi's PCM output isn't great. You should now be able to hear the music playing through the Raspberry Pi.
To confirm that shairport-sync is working, log back in over SSH and run the command "shairport-sync -h". This should produce output similar to the example, indicating that the service is running correctly.
Setting Up Shairport Sync
Setting up Shairport Sync is a crucial step in getting your Raspberry Pi to stream audio wirelessly via AirPlay. To start, you'll need to install the required packages to build and run Shairport Sync. This can be done by installing the necessary packages for your Linux distribution.
You'll then need to clone the Shairport Sync repository, which can be done using the command `git clone https://github.com/albertopazzini/shairport-sync.git`. After cloning the repository, you'll need to configure it using the following commands:
- `./configure --with-alsa`
- `./configure --with-avahi`
- `./configure --with-ssl=openssl`
- `./configure --with-systemd`
- `./configure --with-metadata`
- `./configure --sysconfdir=/etc`
These flags are used to specify the output to the Advanced Linux Sound Architecture (ALSA) system, choose Avahi-based Zeroconf support, use the OpenSSL cryptography toolkit, include a script to create a Shairport Sync service, add support for metadata, and specify the configuration directory.
You can also use the `--with-pipewire` or `--with-pa` flags to use PipeWire or PulseAudio instead of ALSA. However, it's recommended to use ALSA for highest quality.
Here's a brief description of each flag:
After configuring Shairport Sync, you can build and install it using the commands `make` and `sudo make install`. You should then be able to start the service and enable it to start automatically on future boots using the commands `sudo systemctl start shairport-sync` and `sudo systemctl enable shairport-sync`.
Finally, you can check the status of the service using the command `sudo systemctl status shairport-sync`. Your Raspberry Pi should now appear on the list of AirPlay devices, allowing you to stream audio wirelessly from your iPhone or other AirPlay-enabled device.
Troubleshooting

Troubleshooting is a crucial part of setting up your airtunes raspberry pi. If you can't see the raspberry pi device listed in Airplay, check that the shairport-sync service is running.
You should also ensure that your raspberry pi is on the same LAN as your Airplay source device, and preferably on the same wifi network, and in range. If you're connected to Airplay and you can't hear any audio, check the volume levels are high enough.
Slide the volume up to about 80-90% on the source device. For the raspberry pi PCM audio, check the volume setting using the command: `amixer sset 'PCM' 100%`. If you're seeing anything below 70% (-27dB), you probably won't be able to hear it. It's best just to keep this setting at 100%.
Obviously, check your audio hardware too!
Shairport Sync Configuration
To configure Shairport Sync, you'll want to install the necessary packages, which includes cloning the repo and configuring it with specific flags. You can do this by running the following commands: `git clone https://github.com/albertopazzini/shairport-sync.git` and then `./autogen.sh --with-alsa --with-avahi --with-ssl=openssl --with-systemd --with-metadata --sysconfdir=/etc`.
The flags you use will determine how Shairport Sync operates, including whether it uses ALSA or a sound server like PipeWire. For a headless streamer, ALSA is a good choice, but you may need to adjust the flags depending on your system and needs.
To enable Shairport Sync to start automatically on boot, you can use the `systemctl enable` command. This will ensure that Shairport Sync is running every time you boot up your Raspberry Pi.
Here are the flags used to configure Shairport Sync:
By following these steps and configuring Shairport Sync with the right flags, you'll be able to use it as a reliable AirPlay receiver on your Raspberry Pi.
Audio Quality Note
Audio quality from the Raspberry Pi's built-in audio jack is often poor.
I've tried two DAC boards that can significantly improve audio quality: the IQAudIO PiDAC+ and the HiFiBerry DAC+ Zero.
The IQAudIO PiDAC+ has a perfect form factor to fit the new Pi 3 Model A+, making it a great option for those with this specific model.

The HiFiBerry DAC+ Zero is also a great choice, especially for those using a Pi Zero W.
Both of these DAC boards are incredibly simple to set up and sound great.
The Pimoroni pHAT DAC is another very popular option, although I haven't personally used it yet.
Choose any of these DAC boards and you'll see a huge improvement in audio quality.
Specify Output Device in shairport-sync.conf
Specifying the output device in shairport-sync.conf is a great way to customize your audio setup. You can do this by listing all PCM interfaces using the command `shairport-sync -L`.
To find the card name of your preferred interface, you can look for it in the output, for example `front:CARD=S3E,DEV=0`. You can also use `shairport-sync -h` to list available devices.
You'll need to grab the card name of your preferred interface, such as `S3E` or `vc4hdmi`. Then, you can specify the output device in the config file, which is located in `/etc/shairport-sync.conf` if you used the same configuration flags.
To do this, remove the `//` to uncomment the `output_device` line, and change it to `hw:` followed by your interface card, like this: `hw:S3E`. Finally, restart the service.
Here are the steps to follow:
- List all PCM interfaces using `shairport-sync -L`.
- Find the card name of your preferred interface.
- Specify the output device in the config file by uncommenting the `output_device` line and changing it to `hw:` followed by your interface card.
- Restart the service.
Shairport Sync Features
Shairport Sync offers a range of features that make it an ideal choice for streaming audio from your Raspberry Pi to your AirPlay devices.
It supports AirPlay 1, which is lossless, and does not currently support all features of AirPlay 2.
The --with-alsa flag allows Shairport Sync to use plain ALSA, providing direct access to the hardware and a simple, minimal setup.
You can also use the --with-pipewire or --with-pa flags to use your sound server (middleware) instead of ALSA.
The --with-metadata flag adds support for Shairport Sync to request metadata and pipe it to a compatible application.
Here are some key configuration flags:
Shairport Sync also includes a script to create a Shairport Sync service that can launch automatically at startup on systemd-based Linux.
DIY Speakers with Raspberry Pi
You can add AirPlay functionality to an existing set of speakers using a Raspberry Pi, making it a low-cost option for DIY home automation systems.
The Raspberry Pi 3 B+ is a good choice for this project, and I used it to set up a wireless sound system using my Altec Lansing RM3010 Stage-Gig Amplified Speaker.
You'll also need a power adapter and an SD card to get started.
I completed this project using a Raspberry Pi 3 B+ and a good-quality speaker, and the speaker itself sounds awesome with great bass and balanced mids.
To set up a Raspberry Pi, I recommend checking out my full article on that process.
The Shairport Sync library is a great choice for adding AirPlay functionality to your Raspberry Pi, but it doesn't support AirPlay video or photo streaming.
If you're looking for screen mirroring as well, consider using the RPiPlay repo on Github.
To get AirPlay set up on the Pi, follow these steps: Update and Install Dependencies, Open the Shairport Sync Directory, Configure Build Options, and Build and Install the Application.
Make sure to configure the Raspberry Pi Audio Options in Raspi-Config to ensure that audio streams from the Raspberry Pi's auxiliary output rather than through the HDMI jack.
Hardware and Introduction
To get started with your airtunes Raspberry Pi project, you'll need to gather the right hardware. The Raspberry Pi 4B, 3A+, 3B, 3B+, or Zero W device is the heart of this project, and it's essential to choose the right one for your needs.
You'll also need an SD Card, preferably a SanDisk Extreme Pro SD card, to store the operating system and project code. A power supply is a must-have, and you'll need a 3.5mm audio cable to connect your audio system.
If you're using a Raspberry Pi Zero, you'll need to get a DAC HAT to get the project working, as it has no audio output on its own. This is a one-time investment that will pay off in the long run, as it will improve the audio quality of your project.
Introduction
You can breathe new life into your old high-quality audio systems with just a little bit of effort and the right tools. All you need is a Raspberry Pi.
The Raspberry Pi is a great tool for this project because it's affordable and easy to use. You can find it at most electronics stores or online.
If you're new to projects like this, don't worry - the hard work has already been done for you. The balenaSound project has configured Bluetooth and other services, making it easy to get started.
Streaming music to your audio setup from your phone, tablet, or laptop is as easy as connecting to the auxiliary (AUX) input. You can use Bluetooth, Airplay, or Spotify Connect to get started.
The project is designed to be a perfect introduction to DIY projects like this, so don't be afraid to give it a try.
You might like: Dns Records Pihole Use Port
Hardware Required
To get started with this project, you'll need the right hardware. The Raspberry Pi 4B, 3A+, 3B, 3B+, and Zero W devices are all supported.
You'll also need an SD Card, specifically a SanDisk Extreme Pro SD card is recommended.
A power supply is essential to keep your Raspberry Pi running.
You'll need a 3.5mm audio cable to connect to your speakers or Hi-Fi, and an audio system to connect to.
If you want better audio quality, consider using a Digital-analogue-converter (DAC) HAT, such as the Pimoroni pHAT DAC.
Featured Images: pexels.com


