shairport-sync icon indicating copy to clipboard operation
shairport-sync copied to clipboard

Simultaneous AirPlay 1 and AirPlay 2 receivers

Open dge8 opened this issue 4 months ago • 2 comments

What happened?

Is it possible to configure shairport-sync so that it advertises as two AirPlay speakers, one AirPlay 1 and one AirPlay 2?

The reason for this is that I recently went down the rabbit hole that is lossless AirPlay, starting with issue #1205 (other references here and here).

It seems that AirPlay 1 is almost always lossless, and AirPlay 2 is almost always lossy (for exceptions, see the references, or this comment for a summary table). Most pertinently for my use case, when playing lossless 16/44.1 content from Apple Music on an iOS device, Apple Music will send a bit-perfect ALAC stream to an AirPlay 1 receiver, but lossy-encode that same stream as a 256kbps AAC when sending to an AirPlay 2 receiver, even when not using multi-room.

This is an annoying regression in AirPlay 2, but it occurred to me that rarely do I want both lossless and multi-room audio at the same time. So, if there was a way to configure SPS to advertise as both an AP1 and an AP2 receiver, I could choose between them and still get the best of both worlds - play to the AP2 receiver for casual listening and multi-room audio, and play to the AP1 receiver when I want lossless audio.

Worst case, perhaps I could run two copies of SPS, built for AP1 and AP2 respectively, in Docker containers bound to separate IP addresses. But perhaps there is a way to do it with a single process and have it behave nicely so that e.g. a client initiating a stream to one receiver when the other is already playing causes it to gracefully pause?

Any thoughts/comments appreciated. Thanks.

Relevant log output

No response

System Information.

Debian 12 Bookworm on a Raspberry Pi 4 (4GB).

Configuration Information.

From "uname -a":
 Linux pi 6.1.0-rpi8-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.73-1+rpt1 (2024-01-25) aarch64 GNU/Linux

From /etc/os-release:
 Debian GNU/Linux 12 (bookworm)

From /sys/firmware/devicetree/base/model:
 Raspberry Pi 4 Model B Rev 1.5

Shairport Sync Version String:
 4.3.2-2-g165431a8-AirPlay2-smi10-OpenSSL-Avahi-ALSA-soxr-metadata-dbus-sysconfdir:/etc

PulseAudio or PipeWire installed?

  • [ ] Check if your system uses a Sound Server.

How did you install Shairport Sync?

Built from source

Check previous issues

  • [X] Confirm

dge8 avatar Mar 04 '24 05:03 dge8

Whoops, #1552 more or less covers this. Although perhaps there's been a change since Oct 2022?

Assuming not, perhaps the question should be about how to best run AP1 and AP2 versions of SPS side-by-side. Are separate IP addresses necessary? Is Docker necessary or could they just use different config dirs?

dge8 avatar Mar 04 '24 05:03 dge8

Thanks for the post. I think that it should be possible for an AP1 instance and an AP2 instance to coexist on the same IP. AP2 uses port 7000 and AP1 uses port 5000. Haven't tried it though!

mikebrady avatar Mar 04 '24 13:03 mikebrady