How Apple’s AirPlay Streams Audio

I got a question from a reader asking how Apple’s AirPlay streams audio. The question specifically asked about how audio files are converted, and whether AirPlay reduces their quality.

Apple doesn’t provide much information about AirPlay, and I found a number of articles and forum posts where people described complex testing routines to determine the bit depth and sample rate of music streamed to AirPlay devices, such as an Apple TV or AirPort Express. But you don’t need to go to such great lengths to figure this out. Simply open Audio-MIDI Setup on a Mac, and select AirPlay.

009.png

As you can see above, AirPlay streams at 16-bit, 44,100 kHz. However, what you don’t see is that AirPlay streams music in Apple Lossless format. What this means is that no matter what format your music is in, it gets converted by OS X – not by iTunes – to Apple Lossless, to ensure the highest quality. So lossless files will be streamed as lossless, as will AAC or MP3 files.

However, high-resolution files will be downsampled to 16/44.1. Interestingly, the Apple TV outputs audio in 48 kHZ, most likely because this is 48 kHz is the standard for movie and TV audio[1]. Movies sold by the iTunes Store contain audio at 48 kHz, but only at 160 kbps.

38 thoughts on “How Apple’s AirPlay Streams Audio

  1. AIrPlay supports both 44.1 and 48 KHz 16 bit audio. All audio is encoded on the fly into ALAC to stream (unless, of course, it is ALAC to begin with). Tests done with 5.1 AC-3 audio CDs being played in iTunes and sent to the Airport duplicated the data bit for bit (You can hear 5.1 audio instead of the white noise of raw data you would hear if even one bit were off). Unless you change the gain, or your bit depth/sample size are bigger than 16/48 KHz per channel, what you get at the airport is what you sent from iTunes.
    P.S. MP3 and AACs therefore have no additional data loss…

    • According to Audio-MIDI Setup, as I show in the article, AirPlay only offers the option for 44.1 kHz. I don’t see how, therefore, iTunes would be sending data at 48 kHz, since it uses the settings in Audio-MIDI Setup to play back music.

    • I can also confirm this. I downloaded a bunch of dts audio files, and if I play them in iTunes through the internal speakers I just get white noise. However, if I connect an optical cable to my receiver, or transmit through AirPlay to an AirPort Express (I haven’t tried with Apple TV or other AirPlay devices), I get 5.1 surround music.

      Strange magic? If it is compressing to lossless through the air, it must be decompressing to an identical stream at the other end that can then be interpreted by the receiver as dts data. Pretty cool 🙂

      • I have found that the only way I can play a 5.1 DTS audio file over Airplay is utilize the Airport Express optical out to the receiver. If I try to utilize the built-in Airplay (BridgeCo modue) in my receiver, it will not play the file. Not sure what extra electronics are in the Apple Airport Express units, but it seems to be a requirement for it to work. I have a Pioneer VSX-53 and confirmed with customer support that it can’t play these files over Airplay. Odd…

        • That’s worth an experiment… I will try targeting my Denon AVR receiver and see what happens when I try to stream DTS to it instead.

  2. AIrPlay supports both 44.1 and 48 KHz 16 bit audio. All audio is encoded on the fly into ALAC to stream (unless, of course, it is ALAC to begin with). Tests done with 5.1 AC-3 audio CDs being played in iTunes and sent to the Airport duplicated the data bit for bit (You can hear 5.1 audio instead of the white noise of raw data you would hear if even one bit were off). Unless you change the gain, or your bit depth/sample size are bigger than 16/48 KHz per channel, what you get at the airport is what you sent from iTunes.
    P.S. MP3 and AACs therefore have no additional data loss…

    • According to Audio-MIDI Setup, as I show in the article, AirPlay only offers the option for 44.1 kHz. I don’t see how, therefore, iTunes would be sending data at 48 kHz, since it uses the settings in Audio-MIDI Setup to play back music.

    • I can also confirm this. I downloaded a bunch of dts audio files, and if I play them in iTunes through the internal speakers I just get white noise. However, if I connect an optical cable to my receiver, or transmit through AirPlay to an AirPort Express (I haven’t tried with Apple TV or other AirPlay devices), I get 5.1 surround music.

      Strange magic? If it is compressing to lossless through the air, it must be decompressing to an identical stream at the other end that can then be interpreted by the receiver as dts data. Pretty cool 🙂

      • I have found that the only way I can play a 5.1 DTS audio file over Airplay is utilize the Airport Express optical out to the receiver. If I try to utilize the built-in Airplay (BridgeCo modue) in my receiver, it will not play the file. Not sure what extra electronics are in the Apple Airport Express units, but it seems to be a requirement for it to work. I have a Pioneer VSX-53 and confirmed with customer support that it can’t play these files over Airplay. Odd…

        • That’s worth an experiment… I will try targeting my Denon AVR receiver and see what happens when I try to stream DTS to it instead.

  3. How about music streamed from an iPhone via AirPlay, where OSX is not involved? Also music streamed to AirPlay from Pandora via iPhone? I have heard that Pandora streams at different quality levels, depending on OSX or iOS source.

    Finally, how does this work in OSX? OSX is sitting on an AAC file. How does a lossless stream happen? Where does the extra info come from? Does OSX go to the cloud to get a lossless version of the song?

    • AirPlay “upscales” the file, converting it to a lossless format. This doesn’t alter the quality of the file at all; my guess is that the reason is that using exactly the same format all the time makes it easier. This has nothing to do with different levels of quality, such as Pandora, as you mentioned, or, say, Spotify.

  4. How about music streamed from an iPhone via AirPlay, where OSX is not involved? Also music streamed to AirPlay from Pandora via iPhone? I have heard that Pandora streams at different quality levels, depending on OSX or iOS source.

    Finally, how does this work in OSX? OSX is sitting on an AAC file. How does a lossless stream happen? Where does the extra info come from? Does OSX go to the cloud to get a lossless version of the song?

    • AirPlay “upscales” the file, converting it to a lossless format. This doesn’t alter the quality of the file at all; my guess is that the reason is that using exactly the same format all the time makes it easier. This has nothing to do with different levels of quality, such as Pandora, as you mentioned, or, say, Spotify.

  5. That is the only option you see, but not necessarily the only option available. For example, you don’t see 6 channel audio, but 5.1 AC-3 audio is relayed just fine, both over an AppleTV AND an Airport Express (as long as the Airport Express has optical out and the gain is set to 0 db). Whatever you have is compressed into an ALAC audio stream and decoded at the other end – that number is meaningless other than for output of system sounds.

    • My guess is you don’t see 6 channel audio because you can’t stream it as such. You can stream a movie, but in that case, must likely the computer streams the entire movie file, which is demuxed by the Apple TV.

  6. That is the only option you see, but not necessarily the only option available. For example, you don’t see 6 channel audio, but 5.1 AC-3 audio is relayed just fine, both over an AppleTV AND an Airport Express (as long as the Airport Express has optical out and the gain is set to 0 db). Whatever you have is compressed into an ALAC audio stream and decoded at the other end – that number is meaningless other than for output of system sounds.

    • My guess is you don’t see 6 channel audio because you can’t stream it as such. You can stream a movie, but in that case, must likely the computer streams the entire movie file, which is demuxed by the Apple TV.

  7. I have a Marantz 1604 AV that has airplay builtin and also has an AppleTV connected to it (hdmi). When I stream (via the VOX application) 96k-24bit audio to the Marantz and check Activity Monitor I see about 200kbps network activity, When I stream to the Apple TV I see about 500kbps network activity. Audio-Midi set up show the same 44k-16bit configuration. I don’t know what this means other than not all airplay renderers are treated equal.

    • I don’t really know. Perhaps Vox is streaming a blank video channel.

      You do realized that, if Audio-MIDI Setup is set to 16/44.1 then your 24/96 files are being streamed at CD resolution…

      • That makes sense, I bought the high Def music primarily to be played back on another Mac that is “hardwired” into another receiver – on that system, the MacMini is connected via USB to OPPO 150 then analog into a NAD receiver. I really wish Apple would embrace High Def music and take it seriously.

  8. I have a Marantz 1604 AV that has airplay builtin and also has an AppleTV connected to it (hdmi). When I stream (via the VOX application) 96k-24bit audio to the Marantz and check Activity Monitor I see about 200kbps network activity, When I stream to the Apple TV I see about 500kbps network activity. Audio-Midi set up show the same 44k-16bit configuration. I don’t know what this means other than not all airplay renderers are treated equal.

    • I don’t really know. Perhaps Vox is streaming a blank video channel.

      You do realized that, if Audio-MIDI Setup is set to 16/44.1 then your 24/96 files are being streamed at CD resolution…

      • That makes sense, I bought the high Def music primarily to be played back on another Mac that is “hardwired” into another receiver – on that system, the MacMini is connected via USB to OPPO 150 then analog into a NAD receiver. I really wish Apple would embrace High Def music and take it seriously.

    • Yes, thanks for posting that. It’s nothing groundbreaking; anyone who thinks a bit about this question knows that, while the extra bit depth can increase dynamic range a bit, the mastering process kills any subtlety in that domain. Now, if a recording were mastered with the additional bit depth in mind, but it would likely blow your speakers apart when it gets to the loud sections. As the post says, higher bit depth are used in recording, and this makes sense, because as you alter a recording, you perform complex calculations, and the more space you have, the fewer “rounding errors” will be introduced. But, just as the sample rate does produce a higher frequency range, humans can’t hear it; the bit depth results in potentially a higher dynamic range, but it’s not practical to use that dynamic range.

    • Yes, thanks for posting that. It’s nothing groundbreaking; anyone who thinks a bit about this question knows that, while the extra bit depth can increase dynamic range a bit, the mastering process kills any subtlety in that domain. Now, if a recording were mastered with the additional bit depth in mind, but it would likely blow your speakers apart when it gets to the loud sections. As the post says, higher bit depth are used in recording, and this makes sense, because as you alter a recording, you perform complex calculations, and the more space you have, the fewer “rounding errors” will be introduced. But, just as the sample rate does produce a higher frequency range, humans can’t hear it; the bit depth results in potentially a higher dynamic range, but it’s not practical to use that dynamic range.

  9. What happens when streaming over Airplay using the mac “system audio” rather than Airplay built into iTunes? For example, if I use VLC to play a FLAC on my mac and stream it via system audio Airplay to an Airplay receiver will it still be received in lossless format?

    Many thanks for your reply.

    • The Mac always streams in Apple Lossless. I don’t know, however, what VLC does to get the audio to the system. It should be using a lossless format, or AIFF, so there should be no loss in quality.

  10. What happens when streaming over Airplay using the mac “system audio” rather than Airplay built into iTunes? For example, if I use VLC to play a FLAC on my mac and stream it via system audio Airplay to an Airplay receiver will it still be received in lossless format?

    Many thanks for your reply.

    • The Mac always streams in Apple Lossless. I don’t know, however, what VLC does to get the audio to the system. It should be using a lossless format, or AIFF, so there should be no loss in quality.

  11. With a network monitoring tool like Little Snitch I can see the network traffic between iTunes and my airport express or apple TV when I play music via airplay. This stream of data hovers around 140 kbit/sec regardless of the bitrate of the music file I’m listening to. Also, a process named “AirPlayXPCHelper” runs at about %10 cpu. I’ll bet this this process is transcoding the audio in realtime to some format the airport express likes (AAC maybe).

    So, airplay from iTunes is NOT lossless. Not for me anyway.

    I’m running OS 10.11.4 with an apple TV and airport express. Files I’ve tested: 128 kbit/s AAC from the iTunes store, apple lossless files ripped in iTunes from CDs and 24/96 WAV files. They all get dropped to 140 kbit/s.

  12. With a network monitoring tool like Little Snitch I can see the network traffic between iTunes and my airport express or apple TV when I play music via airplay. This stream of data hovers around 140 kbit/sec regardless of the bitrate of the music file I’m listening to. Also, a process named “AirPlayXPCHelper” runs at about %10 cpu. I’ll bet this this process is transcoding the audio in realtime to some format the airport express likes (AAC maybe).

    So, airplay from iTunes is NOT lossless. Not for me anyway.

    I’m running OS 10.11.4 with an apple TV and airport express. Files I’ve tested: 128 kbit/s AAC from the iTunes store, apple lossless files ripped in iTunes from CDs and 24/96 WAV files. They all get dropped to 140 kbit/s.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.