16 ms·
Apple Airplay on Raspberry Pi in 7 Easy Steps
- konradb 8y agoMy understanding is that this is possible because at some point, the private keys for the airplay encryption were found. Alas airplay 2 cannot be supported unless the same thing happens, which is a shame.
- Jonnax 8y agoWhat's the difference between airplay 1 and 2? Is it quality?
- kevin_b_er 8y agoMulti-room streaming and better lock-in to prevent projects like this one from being possible with open source.
- eddieroger 8y agoI wonder if there was a way to answer that without editorializing. There's nothing stopping someone from coming up with an open source streaming platform, it just won't be embedded in iOS.
- kevin_b_er 8y agoYou mean it won't work with Apple owned device because Apple does not permit you to do so?
- eddieroger 8y agoNo I don't mean that, when there are things like Chromecast that let me pick content on my iOS device and see or hear it on my TV or stereo.
- mackey 8y agoI feel like you editorialized kevin_b_er. Obviously they were talking about Apple preventing this software with working with the new airplay system. Where were they saying it's impossible to come up open source streaming protocol?
- knolan 8y agoAirplay 2 haas reduced latency and improved quality. You can also stream to multiple Airplay 2 devices from iOS while iTunes on a Mac/PC can stream to multiple Airplay 1 devices.
- danpalmer 8y agoIn addition to the other features mentioned, I believe AirPlay 2 supports more media formats and more precise control over playback, and more metadata about the media playing.
- pfranz 8y agoI couldn't quickly find a detailed breakdown, but here's a basic one: - Airplay doesn't offer multi-room audio; AirPlay 2 does - AirPlay lets you stream from any Apple device to your speakers or TV - AirPlay 2 lets you play from speakers over Wi-Fi, and it'll stay in sync - AirPlay 2 lets play different songs in different rooms with multiple HomePods If memory serves, the original AirPlay had much simpler goals. Stream music from a single computer to a speaker over a local network. So it has concessions like a constant 2 second lag, which happens if you press pause/play. I vaguely remember other weird restrictions when playing with it in the past (like one device at a time had to control a speaker). AirPlay2 is a lot more complex adding the features mentioned above and better handling the use-cases original AirPlay grew into. https://www.pocket-lint.com/speakers/news/apple/144646-apple-airplay-2-vs-airplay-what-s-the-difference https://www.pocket-lint.com/speakers/news/apple/144646-apple...
- bigiain 8y agoThe big difference for me, is that I can select any combination or all of my AirPlay2 devices from my phone, but I can only select a single airplay (1) device and nothing else at the same time. (For me, that means my old AppleTV can be selected, but nothing else at the same time, but any combination of my three Airport Expresses can be selected.)
- kondro 8y agoIn a nutshell, AirPlay 2 decouples the media and the control streams. This makes play/pause etc instant (rather than waiting for the 3 second buffer to run out) and makes it much easier to do multi-speaker audio as they're all listening to the same media stream.
- poyu 8y agoI suppose these guys have it figured out since their product supports the HomePod? https://www.rogueamoeba.com/airfoil/ https://www.rogueamoeba.com/airfoil/
- snag 8y agoMy take on this was : 1- Buy hardware (Raspberry + DAC + Amplifier) 2- Download and install Volumio (volumio.org) on SD card 3- Profit
- oger 8y agoCould not agree more.
- jrgoj 8y agoWhat do you advise for a baseline DAC+Amplifier?
- snag 8y agoMy setups are pretty cheap as I did not want to put much money in it. As for DACs, I have a €24 Hifiberry DAC+ and an inexpensive raspberry compatible DAC out of Aliexpress (around €12) on my two different setups (kitchen and living room). Both work well and deliver good enough signal (I am not by anyway an "audiophile") I prefer the no-brand one from AE though as it has an IR receiver I am using to control media playing. As for amplifiers, any stereo amplifier would work, so I choose a Lepai lp-2020a (€30 on amazon) in the kitchen. I have an old Marantz branded amplifier for the living room.
- tonylemesmer 8y agoThis guy must have been doing this at exactly the same time as me. I used shairport-sync and whilst I eventually got it working last week it wasn't plain sailing. Getting the service setup to start upon powerup was a real pain in the ass. I've also had to move it onto a separate wifi network as an RPi camera was hogging the bandwidth which caused audio dropouts on the shairplay-sync server. Also as many of you will probably comment, the Rpi audio out stage is awful. I'm waiting for my Dad to return my USB soundcard so I can use that instead of the headphone socket on the Pi.
- 3chelon 8y agoAbsolutely. I'm the article author and yes, adding a DAC is definitely recommended because the output from the audio jack is terrible. I'm intending to do a follow-up article on this, but so far I've tried IQAudIO Pi-DAC+ with an RPi 3A+ and HifiBerry DAC+ Zero on a Zero W. I was extremely surprised by the good quality of the HifiBerry.
- hedora 8y agoI noticed the writeup has your output set at +4db. That implies it’s substantially overdriving the output, which will cause obvious distortion. I have a rpi plugged into my high-end-ish stereo for other reasons, and find the output to be more than good enough. If you’re complaining about audiophile nuances like warmth and presence, and also using 24-bit, high sample rate audio files, then fine, but if you’re encountering obvious distortion or buzzing then something’s wrong with your setup. (Thanks for writing this up, by the way; it didn’t occur to me that I could set up an AirPlay server with stuff I have laying around.) [edit: I forgot that I’m using hdmi audio. Still, the +4db thing is a red flag]
- 3chelon 8y ago4dB is the default setting for the built in audio set to 100%. And yes it sounds quite horrible, but the internal audio does in general. When you add a DAC that is fixed and it changes to the correct setting of 0dB.
- 8y ago
- Reason077 8y agoYou can also just buy an old Airport Express base station and repurpose it for AirPlay. The old 802.11g ones can be found for about $10 or so and even have an optical audio out.
- nathancahill 8y agoI went this route. Nightmare. The installer software has been removed for Mac and isn't available anywhere. Had to find a laptop running Windows 7 to get it up and running. It also won't be compatible with modern routers. 1/10 can not recommend.
- Angostura 8y agoEh? Are you talking about this https://support.apple.com/kb/DL1664?viewlocale=en_US&locale=en_US https://support.apple.com/kb/DL1664?viewlocale=en_US&locale=... - also available for iOS? It's still there. I have an Airport Extreme that very happily updated itself to support Airplay 2 a few months again
- nathancahill 8y agoIt no longer supports the original Airport Express, the one that can be had on Craigslist for $10.
- rikkus 8y agoWhat do you mean by "won't be compatible with modern routers"? Are you referring to the 802.11g? These devices had an ethernet port, IIRC. I'm sure I remember plugging mine into my network and not using its built-in wifi.
- e1ven 8y agoThis is a cool project, and I think it can be a good addition to an existing home media server. For the use-case they describe however (wiring up an existing home stereo) it would probably be a lot easier and better supported to just buy an Airport Express. You can still buy them online for ~100, and they support Airplay2 as well, which is much nicer for multi-room audio.
- shritesh 8y agoI use shairport-sync on my iMac to stream Overcast from the iPhone. There is a huge latency and the connection drops out every once in a while. This should have been a built in feature.
- joshstrange 8y agoIt appears this is Airplay 1 only (please correct me if I'm wrong) so this will not be as nice as say, using an Airport Express but if you had this stuff laying around it might be worth it.
- knolan 8y agoThe Raspberry Pi has awful noisy audio out. There are some nice Amps you can get like the HiFi Berry. I set up a nice arrangement in my old lab with with these.
- 3chelon 8y agoYes the HifiBerry is very very good for the price.
- Jnr 8y agoI just use HDMI to connect it to audio receiver.
- deleted 8y ago[deleted]
- cheeseprocedure 8y agoAnother vote for the HiFiBerry. I’ve used their Digi+ board (which includes optical-out) with a Pi3B running Volumio for a couple years and it’s been fantastic.
- dwater 8y agoI'm using a generic HiFiBerry clone that I got for $18 with a pi3b running Volumio as well. I'm using a 240GB SSD in a USB enclosure as the drive, and a cron job that keeps it synced with my fileserver. Only snag was finding a power supply that could reliably provide enough power, I've settled on an Apple ipad charger I had laying around. It's been great for a few months now. Sound quality is very good.
- tracker1 8y agoGood power adapter options for the Pi is definitely one of my bigger complaints. Even determining a good one to get from Amazon is painful, considering how many cheap/knockoff options are out there. If a company could get the kit price under $40-50, I would definitely use them for more one-off projects. Aside, I really wish that Docker for (Windows|Mac) ran as a service without requiring login so I could run background linux software with a little less friction. The linux on windows stuff is coming along, but similarly lacking initd/systemd startup. And while I know that a desktop os isn't a server, I've got a plenty powerful desktop that I have always on, and would just assume not have another computer running.
- depthcharge 8y agoI did the same thing a couple of weeks ago using a Raspberry Pi 3 B+. I have it connected to a Cambridge Audio stereo amplifier through USB, since the amplifier has an integrated DAC. I'm very pleased with it, and it was surprisingly easy to get working.
- 3chelon 8y agoNice idea. My amp is Cambridge Audio but it sadly does not have a DAC. If it had, the setup would have been even simpler than it is.
- tedd4u 8y agoAt the risk of being a bit off topic … A lot of people interested in Airplay will be looking at this post wondering how to use AirPlay with UPnP or ChromeCast devices. shairport-sync [1] (used in the article) only works directly with audio hardware, so won't work with Chromecast or UPnP compatible systems. I've tried many many different open-source bridges and finally found AirConnect [2] which is by far the most reliable, active and well-maintained bridge. philippe44 responds to every issue filed (as far as I can tell). Works great with my Sonos PLAY:1 & XBox. [1] https://github.com/mikebrady/shairport-sync https://github.com/mikebrady/shairport-sync [2] https://github.com/philippe44/AirConnect https://github.com/philippe44/AirConnect
- msvan 8y agoI bought a Google Chromecast Audio. Spotify, Soundcloud and Pocket Casts support it on iOS. I'm not actually sure what the officially Apple sanctioned way of getting audio to my speakers is, but I haven't felt the need to find out either.
- jrowley 8y agoI had one of those devices and it worked great but now I just don’t want google knowing my listening habits so have gotten rid of it.
- philamonster 8y agoPi MusicBox? http://www.pimusicbox.com/ http://www.pimusicbox.com/
- mikewhy 8y agoShould also mention this does not support video.
- evanweaver 8y agoIt's overkill to use a Raspberry Pi for this. I made a dozen Airport adapters with the TP-Link WR710N which was $25 at the time and connects to Wifi or ethernet. Add a USB soundcard ($10?) for powered speakers or a Topping USB amp ($75?) for unpowered speakers. Install OpenWRT, connect it to your network in client or bridge mode, install the built-in shairport-sync package, and go. Not sure what has replaced the WR710N but I'm sure you can still do this just as cheaply.
- 3chelon 8y agoTo be fair, a Pi Zero W costs less than £10, or the equivalent in dollars.
- alias_neo 8y agoIt does, sort of, but, if you want to do this seriously, as in, you want more than one unit (I wan't ~5 to add to the open-source home security camera software I'm writing), you can't buy more than one at a time unless you buy it with headers attached (which I don't want), leaving you the alternative of buying them individually and paying for delivery for each individual unit.
- mikeash 8y agoMicro Center has them for $5 for the first unit, $15 for units 2-5, and $20 each after that. Still less than ideal but not too bad.
- alias_neo 8y agoSeems like a better deal than we get here in the UK. These £9 Pi's rarely go for less than £12-14 and if you can get more than one, they won't be any cheaper.
- bigiain 8y agoI'm a big fan of RasPis, but people _always_ understate the real costs. That TPLink wifi router comes in a case with a (probably shitty but working) power supply and cable, and inbuilt flash memory. A Pi Zero costs ten quid, but you need to add a case, a power supply, and a micro SD Card. But worst for me, is that they still limit you to buying one at a time, so if your decide "Hell yeah! 5 room wi-fi streamed audio sounds _Awesome!_" You're not only up for fifty quid for the Pi Zeros, but you're gonna spend at something like twice that much again for 5 half-decent power supplies, USB cables for the power supplies, SD cards, and cases, and then you're up for 5 lots of shipping charges because they aren't allowed to sell you 5 Pi Zeros in one order... All of a sudden that "fifty quid project!" has become a £150+ one in five seperate deliveries... (And unless you don't care too much about the audio quality, both the Pi Zero and the TPLink router will need a better external DAC anyway...) If you just want one, and you're the sort of person who has usb power supplies, cables, sd cards kicking around doing nothing, and you're not too fussed about having a nice case, sure, you can just order one ten quid Pi Zero plus 3 quid for shipping.
- amdavidson 8y agoI've been doing this for a couple years with a Zero (pre-W) and a pHAT DAC[0] with great success. It just runs and reliably shows me a Airplay device for my garage speakers. I recommend it for people who have audio hardware lying around and don't want to replace it with more expensive and worse sounding smart speakers. 0: https://shop.pimoroni.com/products/phat-dac https://shop.pimoroni.com/products/phat-dac
- Jnr 8y agoFor those using Spotify premium for listening to music there are some open source projects (like spotifyd) that replace the now deprecated spotify-connect.
- geekuillaume 8y agoIf you want to do the same for Chromecast it's not possible yet. Google seems to have locked down their API. There is some open-source projects that are trying to reverse engineer it but the problem seems to be linked to crypto keys used to authenticate real Chromecast devices: https://github.com/thibauts/node-castv2/issues/2 https://github.com/thibauts/node-castv2/issues/2
- askvictor 8y agoAnd Google do security pretty well, so it's unlikely the certs will be leaked or broken :( When the Chromecast first came out, the was an open source receiver called leapcast which reverse engineered the DIAL protocol that the YouTube app on many smart TVs of the day used, and the Chromecast protocol was based on. But alas it doesn't work anymore.
- roberttod 8y agoNice! I'm trying to do it the other way around, record player into Raspberry Pi, broadcast to my HomePod. Unfortunately the only way it works is to add a laptop in between. If anyone has managed to get an AirPlay broadcast from Linux I'd love to know how you did it!
- amaccuish 8y agoHave a look on GitHub, there's quite a few projects. Pulseaudio can also stream over Airplay 1 and 2.
- jrowley 8y agoIf anyone is looking for multi room audio (like airplay 2), using raspberry pies, this is the best solution I’ve seen - it is really impressive: https://www.reddit.com/r/homebridge/comments/8v3qb0/shairport_sync_and_airplay_2_any_hope/e686gk1/ https://www.reddit.com/r/homebridge/comments/8v3qb0/shairpor... If people have other suggestions for multi room audio I’d love to see them.
- digitalsushi 8y agoNever discount the simplicity and reliability of a (legal) low power FM transmitter.
- jrowley 8y agoI attempted using an FM transmitter but I had 2 issues 1) I think my transmitter was a little noisy so that wasn’t desirable. 2) I didn’t have a nice FM receiver to test with, but didn’t want to purchase one because I thought my transmitter was noisy. So a bit of a catch 22. But FM would be great.
- askvictor 8y agoWhere can you get/make one with decent audio quality and stable frequency?
- deleted 8y ago[deleted]
- askvictor 8y agoI'm still using squeezebox and really like the original hardware, plus home made receivers using pi's; it's a fully open source media system - something that doesn't seem to exist in today's landscape of vendor lock in. Nonetheless, it's showing its age somewhat, and is harder to get streaming services working on it (e.g. YouTube, play music) in part due to its open nature (also, it's written in Perl...)
- jrowley 8y agoHave you ever used the grouped rooms feature mentioned in that reddit comment? Seems pretty cool.
- CameronBanga 8y agoDid the opposite a few months ago, and used a Raspberry Pi Zero to AirPlay audio from my turntable to a HomePod. It was about as amazingly useless as one would imagine, but fun none the less.
- 3chelon 8y agoWow, I'd love to see a write-up of that.
- mattkevan 8y agoBeen running Shairport Sync on a Pi3 for the last couple of years. It works great. I've been adding more stuff to the Pi over time, so it's now a Plex server, Home Assistant hub, Torrent box, Pi-hole and more.
- tracker1 8y agoWhile not an iOS user, it is definitely cool how many one off projects you can create using Raspberry Pi. I do wish some of the full kits (case, power adapter, micro sd) would come down in pricing slightly as it tends to bump up towards more powerful, but less supported (and more difficult) options when you consider the full system price.
- heywire 8y agoDepending on the project, Raspberry Pi Zero W is often powerful enough. $5 on sale at Microcenter, $4 for the case.
- tambourine_man 8y agoI love a good excuse to buy more RPis and have thought about doing something like this. However, I already have a cheap bluetooth dongle that I plugged my stereo to via P2. Is there some advantage to this setup (beyond range)? What I'm really considering is a web interface, with search, playlist etc and a huge SDcard with all my music connected to a RPi. Currently all my music is on my Mac and Apple Music Home Share is a bit flaky/slow at times.
- scns 8y agoCheck out mopidy.
- ulzeraj 8y agoMy beef with airplay and pretty much every other Zeroconf based service is that they require weird stuff to work across subnets. Here I isolate every “IOT” device specially the ones that potentially has a phone home capability into a separate network. The wireless network is also segregated and routed. To make everything Zeroconf/Bonjour work I have to create lots of SRV, PTR and TXT records in my internal DNS which is a Samba4 AD. This document http://www.grouplogic.com/Knowledge/PDFUpload/Info/WanBonjour_1.pdf http://www.grouplogic.com/Knowledge/PDFUpload/Info/WanBonjou... is great to setup the basics but you will have to find out the specific RR for each type of service.
- X-Istence 8y agoYou could also set up Avahi or some other mDNS daemon to relay mDNS packets across the two different networks, so long as you can route the UDP/IP from one network to another you shouldn't need to create a whole bunch of TXT records.
- tjohns 8y agoIndeed. The usual term for this is a “mDNS Reflector”. There’s a guide for setting it up with Avahi here: http://chrisreinking.com/need-bonjour-across-vlans-set-up-an-avahi-gateway/ http://chrisreinking.com/need-bonjour-across-vlans-set-up-an...
- robocat 8y agoHere is an article about mDNS and bonjour: https://community.cisco.com/t5/wireless-mobility-documents/basic-theory-behind-mdns/ta-p/3148577 https://community.cisco.com/t5/wireless-mobility-documents/b... However it is not particularly clear!
- ulzeraj 8y agoGoing DNS has its advantages like being a less broadcasty solution that can work across VPNs. I've first implemented it some years ago when a client wanted to share authenticated wireless AirPrint to wireless guests on his huge school wireless network. The system is still working. I guess another advantages of going DNS besides not having to broadcast information is that you chose what you want to publish.
- pantalaimon 8y agoIt's a bit funny how the best way to stream audio between two Linux boxes is Airplay with shairport on the server and the raop2 PulseAudio Plugin on the Client. It integrates well into the Desktop too and is automatically discovered! It's funny because PulseAudio could do network streaming itself, but as it still streams the uncompressed PCM stream afaik, it's pretty useless in practice.
- codethief 8y agoAdding to this, DLNA from Linux (pulseaudio-dlna) to a Raspberry PI is also a lot slower than the using AirPlay in the way you described… :| (By "slower" I mean that there's a significant delay.)
- SSLy 8y agoWe're using the PA PCM method in our student association. Works good enough.
- pantalaimon 8y agoI reckon you have everything connected over Ethernet then?
- SSLy 8y agoNo, WiFi.
- easymovet 8y agoThese work too for $30 https://www.amazon.com/dp/B01HFYZDNC/ https://www.amazon.com/dp/B01HFYZDNC/ but it might be a security threat to have them on your LAN, I have no idea what software they run.
- kingosticks 8y agoMike Brady has done a great job with this. The project also has a very detailed readme, far beyond what most provide. Thanks Mike for all your efforts. I'm not sure this how-to article adds that much but I guess it's nice and simple looking.
- eddywebs 8y agoDoes anyone have suggestions for the reverse? basically an analog input (turn table/cassette) that can be streamed over wifi as digital output
- cheeko1234 8y agoNot wifi, but you could get an aux to bluetooth adapter: https://www.amazon.com/GOgroove-BlueSENSE-Bluetooth-Transmitter-Wireless/dp/B008GVETNE https://www.amazon.com/GOgroove-BlueSENSE-Bluetooth-Transmit...
- npunt 8y agoAll the Airplay tutorials I've seen are about being a receiver for Airplay signals from something like an iPhone. These boxes then plug into speakers for output. Does anyone know if there are tutorials on making an Airplay client that instead sends audio & video to a receiver of some type (e.g. Apple TV)?