Create multiple ShairportSync-Instances on the same Host with Airplay 2 #3562
Replies: 2 comments 2 replies
-
|
Hey, great work! |
Beta Was this translation helpful? Give feedback.
-
|
I'm doing a similar multi-zone setup with eight USB audio cards on a Pi5 (six on a USB3 hub and two plugged into the USB ports on the Pi itself). The biggest problem is assigning consistent names since USB doesn't always enumerate the same and the cheap cards don't have any serial numbers exposed. Instead I've hacked up a modified https://github.com/osresearch/shairport-pi/blob/main/rootfs/etc/init.d/S99shairport-sync |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey,
in this small writeup, I want to show you how to get multiple ShairportSync Instances running on the same Host including Airplay 2 support. Which is great because you can use an iOS-Device for syncing audio or MusicAssistant. This Writeup was inspired by this two Posts: Reference 1 and Reference 2
Requirements
Used Hardware
In this Guide I used for a simple test this cool Audio-Hat which is compatible with an Pi Zero but with an Pi 5 you get 4 Mono Channels or 2 Stereo Outputs. For testing the Sync I connected an USB-Soundcard.
Recommendation
I tested this on a Pi Zero 2W which was working fine with 2 instances. The only problem I had was some Audio Dropouts. This is caused by the bad Wifi on the Pi Zero 2W. I highly recommend to use an Ethernet Connection if you're planning to use more than 2 instances on a Pi!
Updating and Upgrading your Pi
Before you start make sure your Pi is up2date.
Check for updates:
sudo apt-get updateInstall the available updates:
sudo apt-get upgradeInstall required Software dependencies
We will build the Software from the Sources. For the build Process we need some Software and Libraries.
Build NQPTP & Install
This Software is needed to run ShairportSync. We will also build that from the Sources. This process is quite straightforward:
Build ShairportSync
Finally we're able to build ShairportSync. It's as easy as with NQPTP:
Important Configuration Details of ShairPortSync
After the Installation we need to understand which Parts of the ShairPortSync Configuration are important for us. This Guide will only briefly cover the Configuration to keep this Guide as simple as possible.
name = "Dining Room";port = 5001;airplay_device_id_offset = 2;output_device = "hw:Headphones";Create a new Configuration
In this Section we will create a new Configuration. To check available Audio Outputs use the following command:
shairport-sync -hAt the end of that output you should see a list of the available Audio-Outputs. Note that down.
Create a copy of an existing ShairportSync Configuration
sudo cp /etc/shairport-sync.conf /etc/shairport-sync2.confEdit the Configuration of initial Shairport Instance
sudo nano /etc/shairport-sync.confname = "Dining Room";output_deviceand set it according to the information of that command:shairport-sync -hEdit the Configuration of 2nd Shairport Instance (repeat that for the number of Instances)
sudo nano /etc/shairport-sync2.confname = "Dining Room";output_deviceand set it according to the information of that command:shairport-sync -hport = 5001;and increment it by one for each instance (EACH PORT CANNOT BEEN USED TWICE)airplay_device_id_offset = 2under Port and increment it by one for each instanceCreate new Services
Assuming that you're happy with your previously created configurations of ShairPortSync we're now able to create the Services that ensures that ShairPortSync will start automatically.
sudo cp /usr/lib/systemd/system/shairport-sync.service /usr/lib/systemd/system/shairport-sync2.service(repeat that based on the number of ShairPortSync Configurations)sudo nano /usr/lib/systemd/system/shairport-sync2.serviceand update the ExecStart Argument:ExecStart=/usr/bin/shairport-sync -c /etc/shairport-sync2.conf(point to the Config file we created before).Enable Services
Final Words
After this Guide you should be able to see multiple Airplay2 compatible Instances of ShairPortSync which are shown in the Airplay Menu of your iDevice. I tested this myself and tried to do it as detailed as possible. If something is unclear please comment here. For ShairPort related Issues this is not the place to discuss please create Issues / Discussions here.
Beta Was this translation helpful? Give feedback.
All reactions