UPDATE June 23, 2021: My testing, below, was done on MacOS. There is evidence that the iOS version of Apple Music behaves differently with AirPlay v1 receivers. I will investigate further as time and ability permits.
June 25, 2021: More information that adds to the picture on iOS. It looks like AppleMusic on iOS and MacOS use AAC when the apps is set to use an AirPlay 2 receiver for output. However, when the output is an AirPlay v1 receiver, the iOS version apparently maintains a lossless chain from Apple’s servers through to the AirPlay receiver (MacOS switches to stream an AAC version from Apple’s servers and then uses ALAC to transport that over the LAN)
Earlier this month Apple released an update to Apple Music that allows “lossless” streaming in addition to the previous high-quality AAC compressed version. People assumed that they’d be able to play back these lossless streams losslessly over AirPlay because AirPlay uses lossless ALAC (Apple Lossless Audio Codec) to transport audio. Unfortunately, this isn’t true.
What is true:
Apple Music on MacOS does not transfer lossless data over to AirPlay 2 receivers when playing Apple Music lossless tracks. The situation on iOS is unclear at this point.
- Apple doesn’t say anything about AirPlay on their Apple Music Lossless support page (as of 2021-06-17). They do say that HomePods, which are AirPlay 2 receivers, only support AAC playback at this time.
- An AirPlay 2 licensee reports that Apple Music sends an AAC stream to their devices when playing back Apple Music Lossless tracks, despite device support for ALAC. Their example suggests they were using an iPad to send the stream to their AirPlay 2 receiver.
- When playing an Apple Music Lossless track on MacOS to an AirPort Express v2 the lossless icon is displayed. The data rate between my computer and the Airport Express v2, which supports AirPlay 2, averages out to be about 256kbps (delivered in bursts), rather than the steady 800-1000kbps I see when playing an ALAC rip I made of a CD.
- Apple does use ALAC when playing to an original AirPort Express over the original AirPlay (which is all the hardware supports). This is evidenced by the steady 800-1000kbps data stream between my computer and the AirPort Express. However, in this case, Apple Music reports that the track being played is in AAC format.
- The Wikipedia page on AirPlay is out of date.
There is no reason to think it works any differently on iOS devices, particularly since the AAC support was probably added, in part, to reduce power consumption on battery powered devices. AirPlay 2 added support for a variety of codecs, bit-depths and sample rates, in addition to the ALAC used by the original AirPlay/AirTunes protocol.
For some reason they seem to be bending over backwards to avoid an unbroken lossless chain between Apple Music’s servers and AirPlay (v1 and v2) receivers. We’ll see if this changes.
Background
AirPlay, or AirTunes, as it was then called, originally only supported lossless transmission using the ALAC codec when it debuted in 2004 alongside the original AirPort Express. This remained true when Apple released the upgraded AirPort Express v2. Along the way Apple also added AirPlay support to the Apple TV along with licensing the technology to 3rd parties to incorporate into devices like AV receivers. People also cracked the encryption used by AirPlay and reverse-engineered the protocol leading to software like shairport-sync which has been incorporated into various commercial and open source products.
Then, in 2018 Apple released AirPlay 2 alongside the new HomePod smart speaker. They upgraded Apple TV to support AirPlay 2, and, to people’s pleasant surprise, also released an firmware update for the long discontinued AirPort Express 2 that added AirPlay 2 support. The new protocol was also licensed to 3rd parties for incorporation in their products.
AirPlay 2 enabled multi-room playback over AirPlay from iOS devices; they’d previously only been able to play to a single AirPlay endpoint at a time. Related to that, AirPlay 2 allowed multiple HomePod speakers to be used as stereo or surround-sound speakers. People assumed that this new functionality continued to use the lossless ALAC codec for transferring audio data between the Mac or iOS device and an AirPlay 2 receiver. The truth was more complicated.
In order to support the new use cases mentioned above, AirPlay 2 included some significant changes. First, it added a buffered mode that allowed a significant amount of data to be stored in RAM on the AirPlay 2 receiver device, rather than streaming it in realtime. More significantly, they added support for other codecs, sample depths and sample rates besides the 16-bit, 44.1kHz ALAC used by AirPlay 2. One of those new combinations was the high-quality but lossy 256kbps AAC that Apple used for iTunes downloads. Many of these details are documented by people working to reverse-engineer AirPlay 2. Combined, these changes reduced power consumption for mobile devices and allowed more headroom to avoid glitches when playing to multiple AirPlay 2 receivers at once.
When Apple announced that Apple Music would support CD-quality lossless audio, people (including me) assumed that it would work with AirPlay devices because they too supported CD-quality lossless audio. However, as I detailed above, this has proven not to be the case.
It seems like Apple has gone to some effort in order to avoid an unbroken chain of lossless audio from Apple’s servers to AirPlay 2 receivers. I speculate they may doing this to keep people from downloading and distributing high-quality lossless content by way of the already cracked AirPlay v1 protocol, or an eventual compromise of AirPlay v2. Given this, I wonder if we’ll ever get the fully lossless signal chain we want over AirPlay, at least not without a new version of the protocol, a change that may require a “forklift” upgrade of AirPlay receivers to take advantage of.
Or maybe it’s all a bug. Apple Music’s Lossless and Atmos roll-out certainly has come with plenty of other glitches and blunders.
Footnotes
- I’ve only focused on the evolution of AirPlay audio support; It also has support for photos, video and display extension/mirroring.
- On a Mac, if you choose “Computer” as the output in Apple Music and then choose an AirPlay (v1 or v2) device as your output from the MacOS “sound” menu it will use a lossless signal chain, but it will run the output through the system mixer (so system sounds like alerts will come out the AirPlay receiver).
I just ran a bunch of tests on AirPlay with Apple Music etc… You may find this interesting.
https://audiophilestyle.com/ca/bits-and-bytes/apple-music-lossless-mess-part-2-airplay-r1026/