Create multiple ShairportSync-Instances on the same Host with Airplay 2 #3562
DerPicknicker
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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 update
Install the available updates:
sudo apt-get upgrade
Install 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 -h
At 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.conf
Edit the Configuration of initial Shairport Instance
sudo nano /etc/shairport-sync.conf
name = "Dining Room";
output_device
and set it according to the information of that command:shairport-sync -h
Edit the Configuration of 2nd Shairport Instance (repeat that for the number of Instances)
sudo nano /etc/shairport-sync2.conf
name = "Dining Room";
output_device
and set it according to the information of that command:shairport-sync -h
port = 5001;
and increment it by one for each instance (EACH PORT CANNOT BEEN USED TWICE)airplay_device_id_offset = 2
under 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.service
and 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