# How did Apple make this work??

## Метаданные

- **Канал:** Jeff Geerling
- **YouTube:** https://www.youtube.com/watch?v=9h-nFbAsJ8M
- **Дата:** 08.05.2026
- **Длительность:** 21:19
- **Просмотры:** 72,847
- **Источник:** https://ekstraktznaniy.ru/video/49726

## Описание

Apple's HomePod minis can pair up into stereo pairs.

But how do they do it?

Resources mentioned in this video:

  - HomePod mini: https://www.apple.com/shop/buy-homepod/homepod-mini/midnight
  - IEEE 802.1AS: https://www.ida.liu.se/~sohsa65/courses/tsn-course-2021/stds/8021AS-2020.pdf
  - AirPlay 2 RS (open source project): https://github.com/lmcgartland/airplay2-rs
  - What is gPTP: https://blog.meinbergglobal.com/2024/03/27/what-is-gptp/
  - What is PTP: https://en.wikipedia.org/wiki/Precision_Time_Protocol
  - Wireshark: https://www.wireshark.org
  - HomePod mini intro video: https://www.youtube.com/watch?v=cPakvOuwg48
  - MacRumors buyers guide: https://buyersguide.macrumors.com/#Homepod-Mini

Support me on Patreon: https://www.patreon.com/geerlingguy
Sponsor me on GitHub: https://github.com/sponsors/geerlingguy
Merch: https://www.redshirtjeff.com
2nd Channel: https://www.youtube.com/@GeerlingEngineering
3rd Channel: https://www.youtube.com/@Level2Jeff

Contents:

00:00 - What di

## Транскрипт

### What did Apple do []

I remember seeing Apple's announcement about the HomePod minis now, wow, 6 years ago. They really need to refresh these things. But the thing that interested me most was how you could pair two of these up to be stereo speakers, like if you connect them to an Apple TV. And when you place two in the same room, they'll intelligently become a stereo pair, filling your space with rich, enveloping sound. — I didn't think much about it at the time, but now that I've learned a lot more about timing and networking, I got to wondering, how do they do it? How do they make it so you can plug two of these in anywhere and they're not connected to each other and then you can pop them into a stereo speaker pair or do multi-room audio? I always have a wire going between the left and right speakers. And wires are pretty deterministic. It's easy to make sure both channels are in phase and you don't get that weird comb effect. Just make sure the wires are a known length and put the speakers roughly the same distance away from you like for my desk monitors here. But HomePods Mini can be stuck wherever. How does Apple get sound to sync perfectly between two of these wherever you put them? You might think it's easy. And if you just have one speaker and you add in a big buffer, it kind of is, but once you have two, well, through the magic of buying another one of these things, I'm going to find out how they did it. And rather than do a whole video where I just lecture you on it, I figured I'd take you on this journey with me. Can we figure out how Apple made these little speakers turn into stereo speakers without using a wire? Okay. Now, I've never tried one of

### How hard can it be [1:22]

these before, so this will be a first for me. But, uh Oh, wow. That's a built-in cable right there that's not replaceable. That's kind of annoying for something that might be in your home and be beat up by a kid or dropped or something. At least it's a braided cable, but that does not seem like it's going to be easy to fix if it breaks. That just plugs in via USBC. I could plug it into my Mac. I wonder if it becomes like a speaker if you just plug it into your Mac. or it just does nothing. Oh, there something blinked. Are you seeing that? There's a kind of an amber light there. Don't know what that means. But does this become like a speaker source? Cuz that'd be cool. I don't see a speaker source here. So, I don't think this becomes like a USB speaker. That would have been nice. Come on, Apple. Easy wins. All right, let's see what else they got in here. There's a little setup guide, I guess. iPhone or iPad? What about Mac? I assume that if you have enough money to splurge on one of these little $100 speakers, you would have a Mac, but I don't see Well, let's see. There's a power plug here. Let's plug this in and see if that's any different. Okay, now we have a different thing. There's like this pattern going on the screen. Is it on like Bluetooth? Bluetooth settings. No, I don't see any. Whoa. It just did something. Is there really no way to set this up on a Mac? What? What does Apple expect you to do if you don't have an iPhone? There's got to be a way. You need an iPhone or iPad. You can't set up a HomePod with a Mac. What the Apple? Seriously? Come on, Apple. All right, I guess I'll have to get up my iPhone. Let's see what we do here. You hold it close to it or something. No. Okay. I'm guessing that's like the startup bong for a HomePod mini. Come to the iPhone. There's got to be like a little NFC beacon or something in here. And it's not letting me set this up. We're 8 minutes. Oh, you know what? Let me show you this. The uh the iPad over there apparently is trying to set up the HomePod. I think that's why this iPhone can't. So, eight minutes into it, I realize I have another iPod, an iPad, whatever the thing is over there, and it's showing the screen to uh set up the HomePod. So, therefore, my iPhone is not seeing that screen right now. All right, I'm going to turn this back on. We're going to try connecting again and see what happens here. It' be so much easier if you could just plug it into your Mac via USBC and connect. But Apple has to be all fancy with these wireless protocols that apparently only work on iOS devices. Seriously, come on, Apple. Okay, we finally have the HomePod mini setup thing again. Let's hit setup and hold that like that, I guess. Okay, we're a bit loud on that. Okay, you can quiet down a little bit there. Apparently, you can't stop. Siri, don't recognize my voice, please. You can't just set this up as a smart speaker. It has to be a really smart speaker, which means it has to attach itself to your account. I just I literally just want to use this as a speaker, that's all. But apparently that requires a lot more uh permissions than uh should be required, I think. But that is the world that we live in. every single device. I bet they have coffee mugs that have accounts attached to them at this point. Who knows? Okay, HomePod's ready. That was a cool little screen. Done. So, now if I go on my Mac, can I play things to the HomePod at least? Or does it only work on iOS devices? That's That'd be so dumb. Let's see. Sound. Okay, so we do have I can use the speaker now. At least there's office and uh let's hear a song on it. That's interesting. There's a bit of a delay there. You can hear that there's uh when I hit play one, two, two and a half seconds. So, there is a kind of a queueing effect going on here. I wonder how that will differ with more than one speaker. Uh

### Now there are two [6:36]

but anyway, we don't care about one speaker. We want two. So, I got the one set up. Let's set up the other one. And uh I don't know how it's going to handle having two speakers, both called office. We got speaker number two. We'll call this our right channel speaker, the one that we already have set up. And we'll put this one on the left channel. There we go. Homepad mini setup. Hold it in the frame. Okay, that's You can Can you turn that down? Agree. Okay, here we go. So, this is saying use as a stereo pair. That's what we want to do. So, I'm going to do that. And this home pod is on the left side. I guess I have to transfer those settings and I'll have to also blur that out. But anyway, it's setting things up. Hopefully, it puts them both on the same Wi-Fi network. We'll see what it does here. It's showing two office speakers here. It's not showing them as a stereo pair. This is supposed to be easy. All right. Apparently, you have to go into home. Okay. Now, on here, it says HomePod is downloading something. It looks like it was still setting things up. So, the stereo pair was not completely finished. I don't know. Now, it says downloading. And all we're trying to do is get this to work so that I can check how this works. But if we can't get it to work, I'm not going to be able to check that. This was supposed to be easy. It's the reason you pay a hundred bucks for one of these speakers and you pay 200 bucks for two of them. Even on the used market, these things are still expensive. Okay, now it has a stereo pair. So, let's see if I can switch to that. Let me switch. Let's see if we listen to stereo sound now.

### Testing a stereo pair [8:30]

Okay, there we go. Okay, there's still that delay. So, with audio, at least there's a delay. Let me try doing a video. If I go to YouTube. Last month, I helped kick off the SBC cluster competition. Really upped their game with their second version of their cluster board. And honestly, it's a little easier to use than the Turning Pi 2, and it fits in one U now. — That's interesting. So the sound is synchronized with the video playback. So that's good. But there is still that delay. So they are using a bit of a delay to I guess build up a Q buffer since this is wireless. Uh but they do have it synced nicely between both speakers and the screen. Plus it's a little bit cheaper which is nice. Until next time, I'm Jeff Gearling. So you can see that I pause it and the sound is still comes through even though the video is paused. So there is a bit of a buffer there. Um, but now I'd like to figure out what's going on here. And I want to go do that over on why. This is annoying. Okay, so I'm gonna head over to my desk and we're going to do a little bit of snooping here. Okay

### Wireshark [9:46]

so over at my computer, I have Wireshark open up. Wire lets you inspect everything going on in a network, whether it's wired or wireless. And you can see that there's some traffic that it sees right now. Um, I think this is on my 5 gig network, which is the same network I connected the speakers to. And if I double click on this, uh, it's going to get some information here, but it might not get the information that I need. Uh, you can see it's looking at the Elgato lights that I'm using here to at my desk and a lot of other types of things, but I need to enter a different kind of mode to see all of the information on the network, especially the thing that I'm trying to look for. So, if I go up to options, I can go into Wi-Fi and turn on monitor mode. I don't know if this will work on the latest version of Mac OS. Let's try it out. Uh, continue without saving. And I don't think this is going to work. I think that there's some issue with this. See, it says no packets. Stop it. Yeah. So, it looks like I might not be able to do that. Let's try it one

### WiFi snooping with Apple [10:52]

more time. I don't think that you can use monitor mode in Wireshark on the latest version of Mac OS. So, what I'm going to do instead, I'm going to first turn this off uh in here. Uh close. Uh I'm going to use this tool that Apple ships with Mac OS called Wireless Diagnostics. And if you open this up, it tries to get you to do this thing and it'll dump tons of information. We don't need that. We just go up to window and click on sniffer. And that's going to do the same thing that Wireark would do. uh you can pick a channel and width. It's by default going to pick what your connected network is using. And uh you can start capturing packets and I'm going to do that. But before I do that, I'll tell you what I'm going to do. Uh I'm going to start capturing the packets just like Wire Shark would. This is going to generate a pcap file, I think, uh on your computer. And after I start this, I'm going to start playing back some music on those speakers. So, we're going to see what happens here. So, I'm going to start this and enter my password. Now, it's capturing packets. I'm going to hit play on my MacBook Neo. And I don't know if you can hear that, but it's playing on the speakers. I'm going to hit pause right now. And there's still like that second two second delay. Uh, and then I'm going to hit stop on here. So, this should save a file. It says into var. So, I'm going to go over to my terminal and I'm going to uh copy. Let's see. Let's go into cd/far/temp. And I'm going to copy Jeff's Mac Studio over to my downloads folder and get out of here. And here's the packet capture. So, now I can quit out of this uh wireless diagnostics and drag the packet capture over to Wireshark. And that should open it up. And this is exactly

### Finding gPTP [12:46]

what I'm looking for already. It's showing it. Um it's except I don't see the first one. So let's scroll down. Uh so see this these highlighted ones. These are called PTP V2. PTP stands for precision timing protocol. And I suspect this is what these speakers use. And somebody had emailed me about this and uh you know mentioned like hey this might use this. You should check it out. Uh it's actually using something a little bit different than standard PTP that I'm used to. Uh but what happens is these speakers are talking to each other constantly. So if we look up here, there was this message. This was at time, you know, 14 microsconds or whatever. Yeah, 14 micro I think. And then uh less than a second later, you see another one of these sets of messages. There's sync. Let's see. Sync, followup, and delay request. Uh and then what else do we got? We got delay response. Wow, that's that actually took a little time. Sync, follow-up, delay request, delay response, uh announce signaling. So, these are all different PTP messages. And you can see there's these are going between two uh devices with an IPv6 address here, I think. So, it sends all these messages and it keeps sending them over and over again. What this is doing is it's kind of locking the time signature together. So, these two speakers know exactly how far apart they are based on the timing through the network. And as long as you're not moving them very quickly, like if you don't have one going on a bullet train and the other one sitting still, this is extremely accurate and should be pretty good. Of course, if you had it on a bullet train, it would be out of range of your Wi-Fi pretty quickly, too. But most people just set these speakers down and they don't move. So, this is going to be highly accurate down to the, you know, tens of nanconds level or even better with really good modern Wi-Fi, especially if you don't have a very busy network. But let's pop into one of these messages and, uh, look at some of the content. So, if you look in here, we can see it's an Apple Wireless Direct Link data frame. Uh, and the reason why I can see this is because I'm in monitor mode. my Wi-Fi chip right now. Well, when I was doing that uh thing in the wireless diagnostics, it was scanning everything, not just my Wi-Fi network and my Wi-Fi traffic, but it was scanning every message it could possibly decode on the entire Wi-Fi spectrum in

### Timing packets [15:03]

the channel 100 on my 5 GHz network. So, if we go into this packet though, we can see that it's using the precision timing protocol. It's using GPTP and that's what's different. So, I'm used to PTP, and I'm going to be doing a video deep diving into PTP later this year. Uh, but this is using GPTP, which is like a kind of a subset of PTP that's a little more strict that's used more for AVB or audio video broadcast. I don't remember exactly what that stands for. We'll look at that later. But, um, GPTP domain one, this is a sync message. So, this is like the first thing it's saying, hey, um, I am the time source. And it should have a clock uh time stamp. So I'm the time source. This is message number one. So we're at 0 seconds and 0 nconds. So when you're doing PTP, you need to send the message out from the master or the leader clock out to all the other clocks. So right now these two speakers are kind of acting like a leader and a follower. And so it says, hey, it's 0 seconds now. After this, we should see another message. This is the follow-up. And if we go down here, we should see that there's another timestamp. So see these two this is 89 8986. 90732041 and uh this time stamp along with the other one. So here's this one uh these two are from the leader that goes out to the follower and then we are going to have these other two messages. These are coming back to help measure the latency over the network from the follower the other speaker back to the main one. So, if we go in here, this one is saying that it's a, you know, a delay request. And if we go down here, it's saying that the origin time stamp was here. And it has these other fields here that are helpful for calculating everything later. And we'll show you how that works in a bit. Uh, but let's see, delay request and then delay response here. Uh, so this is the final message that shows uh the timestamps that it was received and it sends back the message. And then once the two clocks have all of this information, the four messages, the four timestamps, they

### How PTP works [17:09]

can go in and use the PTP protocol to say um I know when all these transactions happened. So now I can calculate exactly the difference u of these two clocks over the network. And if you have a really good and low congestion network, it can be down to nanconds. It might be more close to like a microscond if you have a lot of devices on your network. uh or if you have weird network conditions, that kind of thing. But that's basically how PTP works. We're going to get much deeper into this later. Uh but the cool thing is that I can confirm looking at these two MAC addresses, these are those two speakers, that Apple is using something called GPTP to connect the two speakers together. So, they have an extremely precise time sync over Wi-Fi. And if you

### Brief look at IEEE 802.1AS and AVB [17:55]

want to get really deep into the weeds, uh, this is technically using something called 802. 1 for timing and synchronization for time-sensitive applications. This standard is used a lot in industry. Um, but Apple is using it here with AV to synchronize audio over wireless speakers. So, that's kind of cool. And, uh, here's some information. You can look this up later. I'm not going to get deep into the weeds in this video. Uh, but it's using AVB, audio v video bridging, which is kind of a suite of all these standards together to help um to help media applications kind of synchronize sound, video, all those kind of things. And that's what's I think this is cool because that's why when I play a video on my Mac, even though there's a little delay in getting the audio playing back on the speakers, as long as you have the time synchronization, the computer knows like this is frame one of the video and it syncs up to this part of the audio. And so the speakers can play the right stuff and you can have that stereo imaging with two speakers that are in phase wherever you put them. Uh that's really cool because this is not just synchronizing once and you're done. You don't have to like reset it every time you move the speaker. It's constantly updating every second or every 3 seconds. I don't know what the standard is that Apple's using here. Um, but it's really cool to see this evolution in AVB to using PTP over Wi-Fi for these speakers. And there is a u a project, an open- source project called AirPlay2 RS that lets you use like Linux, like you could use a Raspberry Pi and stream audio to your HomePods from non-Maxs basically uh very easily. And it actually uses PTP. It uses software defined PTP, but that's usually okay if you're in the microcond realm. We don't have to get to the scientific level here. Uh but if you can get it down to that level, then you can play audio to stereo pair HomePods uh through this thing. And that's pretty cool. You can read more about it. I'll provide links to all these things, of course, in the

### Apple using standards [19:51]

description. But I think one of the cool things about all this is Apple is using a standard. They're using GPTP and AVB and they're probably involved in some of the formulation of those standards too. But Apple's using standards, industry standards to do this stuff. They're not just building their own protocol. Like I think that Sonos actually started with a custom, you know, proprietary protocol when they set their things up. Although they did it in like 2004, 2005, and this didn't exist back then. GPTP wasn't around until like 2009 or 2011 or something and it wasn't really standard and robust until the 2020 revision. So, you know, I can forgive Sonos there. And actually, I think their modern stuff does actually work with AirPlay 2. So, I don't know. It has some sort of GPTP capability. I don't know if their own stuff uses that yet or if they still use an older implementation. If you want to find out more about time and PTP and different ways to synchronize time and where it comes from and other applications besides speakers like these HomePods, then make sure you subscribe. I'm going to be getting into this a bit more. And uh I've just been doing a lot of exploring and I haven't shared much. I really wanted to share my testing with these speakers cuz I thought it would be interesting. And uh now I don't know where I'm going to stick these speakers because I already have some good ones at my desk for monitoring and I have a soundbar for my TV. Maybe I'll just stick them in the back room and I can listen to stuff when I'm doing rack room stuff or putting in my new Xerve.
