Kristian8606/esp32-airplay2-surround
Acerca de
Enjoying this project? It is built and tested in my free time. A small donation helps buy test hardware and keeps the development going. Thank you! ❤️
Otros proyectosCrecimiento de estrellas medido
- in 24h
- +2
- in 7 days
- +11
- in 15 days
- +38
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
README.md
Original
Enjoying this project? It is built and tested in my free time. A small
donation helps buy test hardware and keeps the development going. Thank you! ❤️
An illustration. A display and an enclosure for the Streamer are planned.
ESP32 AirPlay 2 Surround Streamer
Wireless 5.1 / 7.1 surround sound from an Apple TV, built from low-cost ESP32 boards: one Streamer (an ESP32-S3, or an ESP32-P4 for the most features), and one ESP32-S3 per speaker.
The Apple TV sees one AirPlay 2 speaker: the Streamer. The Streamer takes the complete surround stream and passes it on, unchanged, to up to eight speaker boards over your Wi-Fi. Every speaker decodes only its own channel (Front Left, Centre, Subwoofer, Rear Right, …) and plays it through any amplifier and speaker you like. All speakers share one clock taken from the Wi-Fi access point itself, so they play each sample at the same moment. No cables between the speakers, no AV receiver, one web page for the whole system.
Surround and sync
- 🎬 5.1 and 7.1 AAC from an Apple TV: films and series from the Apple TV apps, and Apple Music Dolby Atmos when the track comes in surround (the Apple TV picks the format per track; some "Atmos" tracks arrive as stereo).
- 🎵 Stereo from any AirPlay 2 sender: ALAC 44.1 kHz/16-bit and lossless 48 kHz/24-bit, AAC 44.1 / 48 kHz. A stereo song plays on the front pair and the subwoofer, as on an AV receiver.
- 📡 One AirPlay target. You pick the Streamer, not eight speakers. Pairing, RTSP and the Apple TV's clock are handled once, by the Streamer.
- ⏱️ Microsecond clock alignment between speakers through the access point's beacon timer (TSF). No extra hardware, no cables.
- 🔀 Format changes on the fly: the Apple TV can switch between stereo and surround from track to track; the speakers follow without reconnecting.
- ⚡ About a third of one CPU core per speaker for 7.1, thanks to a patched Fraunhofer FDK AAC decoder that synthesises just one channel.
More sources
- 🏠 Apple Home (HomeKit): artwork, playback and volume for the whole system as one speaker (Apple Home).
- 📻 Web radio on the Streamer: stations of your country, a search, your favourites or any stream address (MP3 or AAC over HTTP / HTTPS). It plays like a stereo AirPlay stream: the front pair, the subwoofer and any Mono mix speaker. AirPlay always takes over.
- 💾 USB player (experimental): FLAC, WAV, ALAC, AAC and MP3 from a USB drive. Lossless files at 44.1 / 48 kHz reach the speakers bit for bit; hi-res files are brought down to 44.1 / 48 kHz. 5.1 / 7.1 files play each channel on its own speaker; gapless between tracks of the same format, with tags, covers and m3u playlists (USB player).
- 🧪 USB sound card (experimental): the Streamer's USB port becomes a sound card for a computer, stereo at 44.1 kHz / 16 bit, and REW can measure through it. The sound is about 1 s behind: it goes to the speakers as a realtime AirPlay stream over UDP, where a speaker asks again for a packet lost on Wi-Fi, and 1 s leaves time for that. Tested only on an ESP32-P4 with macOS; no microphone input yet. Connect the computer through a USB power blocker (a cable or adapter without VBUS): the Streamer boards join the port's 5 V to their own (why).
Tuning the room
- 🎛️ One page for all speakers: role, level and delay of every speaker, and a live view of what each one plays. Each speaker keeps its own 2 × 24-band parametric EQ, mono or bi-amp (woofer + tweeter through a Linkwitz-Riley crossover), loudness and latency settings.
- 🎤 Room calibration with an INMP441 microphone on the Streamer (or the ESP32-P4 board's own): distance, delay and level of every speaker measured from your seat, applied with one click.
- 📈 Room EQ with the same microphone, as REW works: its sweep, graph, smoothing, target types and filters, each speaker corrected from your seat and checked by measuring it again; a bi-amp speaker gets its woofer and tweeter aligned.
- 📐 Set up with REW: REW measures through AirPlay from a Mac, or through the Streamer's USB sound card, while only the speaker or driver you click plays, and its filters go straight to that speaker (Set up with REW).
Hardware
- 🚀 ESP32-S3 or ESP32-P4 Streamer, one codebase: an ESP32-S3, the same board as the speakers, or an ESP32-P4, which does the most: twice the relay buffer, a fast USB port, quick cover thumbnails and a microphone on the board (S3 or P4). P4 boards: the DFRobot FireBeetle 2 ESP32-P4, the Waveshare ESP32-P4-NANO or a custom one, picked in menuconfig (P4 boards).
- 🔌 Any amplifier on a speaker: a MAX98357A, or a DAC with any analogue amplifier (Speaker wiring).
- 🔊 TAS5805M amplifier on a speaker: TI's digital class-D amplifier, up to 2 × 23 W or 1 × 45 W, set up and watched over I2C, with an Amplifier card for its level, BTL or PBTL and its faults (TAS5805M amplifier).
- 🔗 Speakers belong to the system: a speaker is not an AirPlay receiver of its own and never shows up on an iPhone; it just follows the Streamer. (For a speaker that is its own AirPlay receiver, see airplay-esp32.)
Planned:
- 📺 DLNA: play from DLNA / UPnP apps, not only AirPlay.
- 📻 More web radio: HLS streams (
.m3u8) and station playlists (.m3u,.pls), so the stations that offer only these play too. - 🎤 A UMIK-1 for Room EQ: the USB measurement microphone on the Streamer, calibrated, for the frequency response at your seat.
- 🖥️ A display and an enclosure for the Streamer: what plays, its cover, the source and the controls.
[!NOTE] The project is under active development. A Streamer and five speakers (front pair, centre, side pair) play 5.1 and 7.1 from an Apple TV and stereo from an iPhone, each speaker its own channel, audibly in sync. Features, defaults and wiring may still change, and this README is updated with every change. See Limitations.
[!IMPORTANT] 16 MB flash modules (ESP32-S3 N16R8). The 8 MB flash of the N8R8 boards is nearly full: the Streamer keeps a copy of the speaker firmware to update the speakers, and that copy has only about 110 KB of room left. A board with 16 MB can already use its full flash (16 MB flash); new features will need it. If you buy boards now, buy N16R8. 8 MB boards build and update as before. The ESP32-P4 Streamer has 16 MB anyway.
Contents
- Guides: wiring, the TAS5805M amplifier, installation, settings, calibration, troubleshooting
- Gallery (all pictures: GALLERY.md)
- Apple Home (HomeKit)
- How it works
- What you need
- Quick start
- First start
- Licenses and credits
Guides
Step by step, in the order you need them. All are in docs/.
1. Build it
| Guide | Read it when you want to… |
|---|---|
| Speaker wiring: I2S amplifier or DAC | wire a speaker with a MAX98357A, or with a DAC and any amplifier (one driver, or woofer + tweeter); the GPIOs and the optional extras (LED, amplifier switch, latency wire) |
| TAS5805M amplifier | use a TAS5805M amplifier on a speaker: wiring, menuconfig, the speaker's Amplifier card, choosing its level, BTL or PBTL, its faults and what they mean |
| Installation | install ESP-IDF, build and flash the Streamer and the speakers, choose a P4 board, 16 MB flash, and update them later |
2. Set it up and use it
| Guide | Read it when you want to… |
|---|---|
| Settings | know what every card and button on the Streamer's and the speakers' pages does: roles, levels, delays, EQ, bi-amp, latency, the Amplifier card, web radio |
| Room calibration and Room EQ | measure the speakers from your seat with a microphone: distance, delay and level in one click, the Test level that keeps the tests quiet, a frequency-response correction (Room EQ) step by step, or REW on a Mac |
| USB player | play music from a USB drive on the Streamer (experimental) |
3. When something is wrong, or to know more
| Guide | Read it when you want to… |
|---|---|
| Limitations and troubleshooting | find out why a speaker is silent, early, late or not found, and what a log line means |
| Technical details | understand the formats, channels, signal path, synchronisation and the code |
Gallery
All pictures with a short description, AirPlay with its artwork included: GALLERY.md.
Apple Home (HomeKit)
Add the Streamer as a speaker in Apple Home to see artwork for the current music or video and control playback and volume. The surround system appears as one accessory, with every speaker keeping its assigned channel.
HomeKit support, setup code, manufacturer and artwork advertising can be
configured under AirPlay Receiver in idf.py menuconfig.
The Streamer in Apple Home |
Artwork and playback controls |
How it works
The Apple TV sends surround sound over AirPlay 2 only to a receiver that says it accepts it. The Streamer says so, receives the whole multichannel stream and shares it with the speakers:
- The Streamer is the only AirPlay receiver. It announces 5.1 and 7.1, so the Apple TV sends it the full multichannel stream. mDNS, HAP pairing, RTSP and the Apple TV's PTP clock all run there.
- It forwards, it does not decode. Every instruction from the Apple TV (format, key, start, flush, pause, volume, timing) is passed to the speakers over a small control protocol, and every encrypted audio packet is copied byte for byte to each speaker. The Streamer reads the stream into a 4 MiB buffer (8 MiB on the ESP32-P4) and sends each speaker from it, so at a track change the old track is dropped from the buffer at once instead of being sent only to be thrown away.
- Every speaker decodes only its own channel. One ESP32-S3 cannot decode all eight channels in real time, and it does not need to. A speaker is not an AirPlay receiver: it finds the Streamer by mDNS, decrypts the stream with the key the Streamer passed on and plays its channel on both outputs of its DAC or amplifier (L = R), so you can drive one speaker or a subwoofer amplifier, or, in bi-amp mode, the woofer on one output and the tweeter on the other through its crossover.
- One two-way Apple clock for all. The Streamer measures both directions of the PTP path with Sync / Follow_Up and Delay_Req / Delay_Resp, then publishes one smooth clock line. Every board on the same access point shares its beacon timer (TSF). Eight times a second the Streamer tells the speakers "the Apple TV's time P is TSF T". Each speaker converts T to its own clock and plays every sample at the moment the Apple TV scheduled it. (On the ESP32-P4 the Wi-Fi radio is the board's ESP32-C6: a firmware of this project on the C6, installed by the Streamer itself, marks the TSF with a pulse on a wire that the P4 timestamps in hardware.)
You choose each speaker's role (Front Left, Centre, Subwoofer, …) on the Streamer's page, even while music is playing. Start with two or three speakers and add the rest later.
┌─────────────────────────────┐
Apple TV ──AirPlay──► Streamer (ESP32-S3 or -P4) │
(PTP clock) │ pairing · RTSP · PTP │
│ no decoder, no audio output │
└─────┬──────────────┬─────────┘
control + time │ │ the same audio packets,
(TCP, port 7100) │ unchanged, to every speaker
┌──────────┬────────┴─┬────────────┴┬────────────┐
▼ ▼ ▼ ▼ ▼
ESP32 ESP32 ESP32 ESP32 ESP32 (… up to 8)
Front L Front R Centre Subwoofer Rear L/R
│ │ │ │ │
amp amp amp amp amp
│ │ │ │ │
speaker speaker speaker subwoofer speaker
Sync, as measured
| What | Measured |
|---|---|
| TSF reading jitter per board | ~4.5 µs rms, averaged by a 64-point line fit |
| Clock difference speaker ↔ speaker | a few µs (from the fits; scope test pending) |
| Playout error of each speaker | within ±0.4 ms, corrected slowly by the I2S servo |
| Speaker ↔ speaker in practice | 0.1–0.3 ms, about 3–10 cm of sound travel |
| Transport delay of the time messages | 3–60 ms, does not matter by design |
The time messages carry a TSF timestamp rather than "now", so their travel time over Wi-Fi is not added to the speaker's clock offset. TSF reading and fit errors still matter. Speaker playout logs measure following the Streamer line; they do not measure the acoustic offset to a HomePod.
In a captured v4.5.33 cold start the Apple clock became ready 80 ms after the master was identified, before audio stream SETUP. The speaker reported its first audio 172 ms after the anchor, and 223 ms on a later start. These are observed starts, not guaranteed latency on every network.
What each speaker plays
| Source | Front L / R | Centre | Subwoofer | Side / Rear | Mono mix |
|---|---|---|---|---|---|
| 7.1 (e.g. Apple Music Dolby Atmos) | own channel | own channel | LFE channel | own channel | all except LFE |
| 5.1 (films, series) | own channel | own channel | LFE channel | Side L/R; Rear silent | all except LFE |
| Stereo (music, YouTube) | left / right | silent | mix of L and R | silent | mix of L and R |
The subwoofer plays below its Crossover set on the speakers page (80, 100, 120 or 150 Hz, 120 Hz by default, or Off when its amplifier has its own), the stereo mix and the LFE channel alike. Do not add a low-pass on its own EQ page as well, or the bass is cut twice.
What you need
The Streamer
| Part | Notes |
|---|---|
| One ESP32-S3 board, the same type as the speakers (N8R8, or N16R8: see the note at the top), with a UART port besides its native USB port (DevKitC boards have both) | It has no audio output: no DAC, no amplifier, no wiring. A USB supply is all it needs. It is flashed and logs over its UART port; the native USB port takes the USB player's drive. |
| Or: a DFRobot FireBeetle 2 ESP32-P4 or a Waveshare ESP32-P4-NANO (16 MB flash, 32 MB PSRAM, Wi-Fi through their ESP32-C6) | The Streamer with the most features (see below). Built with idf.py set-target esp32p4; the board is picked in menuconfig (P4 boards, how it works). The speakers stay ESP32-S3. |
| A place with a good signal | It receives the stream from the Apple TV and sends it again to every speaker, so it carries the most Wi-Fi traffic. Near the access point is best. |
| Optional: a USB stick | Music for the USB player: FAT32. On the S3 it goes on the native USB port, which needs 5 V from the board; on the P4 on its high-speed USB port. |
| Optional: INMP441 I2S microphone | For room calibration: VDD → 3V3, GND and L/R → GND, SCK → GPIO 5, WS → GPIO 6 (GPIO 52 on the P4), SD → GPIO 4 (changeable in menuconfig). The FireBeetle 2 ESP32-P4 has a PDM microphone on the board and the Waveshare ESP32-P4-NANO an ES8311 codec's; each board's own is used by default. |
Streamer: ESP32-S3 or ESP32-P4
The Streamer runs the same firmware on both, built for its chip. A P4 Streamer supports the most features; an S3 Streamer does everything the speakers need, with the limits below. The speakers are always ESP32-S3.
| Streamer | ESP32-S3 (N8R8 / N16R8) | ESP32-P4 (FireBeetle 2, Waveshare P4-NANO) |
|---|---|---|
| CPU, memory | 2 cores at 240 MHz, 8 MB PSRAM | 2 cores at 360 MHz (chip v1.x) or 400 MHz (v3.x), 32 MB PSRAM |
| Wi-Fi | its own, 2.4 GHz | the board's ESP32-C6, 2.4 GHz; the Streamer installs the C6's firmware itself |
| Relay buffer (AirPlay music and films) | 4 MiB | 8 MiB |
| USB port for the player | full speed, about 8.4 Mbit/s measured: a 5.1 / 7.1 WAV is too heavy and stops every few seconds to buffer; FLAC of the same file plays | high speed (USB 2.0), its own port: a heavy 7.1 WAV plays without a stop, no bitrate warning |
| 7.1 at 24-bit from the USB player | a dense film mix is at the limit of the CPU and stops now and then; 16-bit plays | more CPU to spare |
| AirPlay artwork on the Now playing card | — (the picture would take up to 2 MB of the memory the relay needs; Apple Home still shows its own) | yes |
| Covers of USB music | sent to the page as they are in the file | turned into small thumbnails by the P4's JPEG hardware and kept on the stick (folder .airplay-covers-v1), so the page shows them quickly |
| Player start | 2 s | 1 s |
| Calibration microphone | INMP441 | INMP441, or the board's own: the FireBeetle 2's PDM microphone, the Waveshare P4-NANO's ES8311 codec |
| Console, flashing | its UART port (the native USB port is the player's) | the board's USB-C: USB-Serial/JTAG on the FireBeetle 2, a UART on the Waveshare P4-NANO |
| Flash | 8 MB, or 16 MB (16 MB flash) | 16 MB, with 6 MB firmware slots |
Both Streamers are measured: an S3 Streamer's limits above, and on a P4 Streamer a heavy 7.1 WAV from the USB stick plays without a stop.
Per speaker (one set for every position)
| Part | Notes |
|---|---|
| ESP32-S3 board with 8 MB flash and 8 MB PSRAM (N8R8), e.g. ESP32-S3-DevKitC-1 N8R8, or with 16 MB flash (N16R8, see the note at the top) | PSRAM is required: the stream buffer alone takes 6 MB. Boards without PSRAM (or with 2 MB) will not work. Pins: Speaker pins. |
| Audio output, one of: | |
| • an I2S amplifier such as MAX98357A | Simplest: digital in, speaker out, about 3 W. Good for small satellites and surrounds (wiring). |
| • an I2S DAC such as PCM5102A + any analogue amplifier | Any size: mini (PAM8403, 2 × 3 W), medium or powerful (TPA3110 / TPA3116, TDA7498, a plate amplifier for a subwoofer…), one- or two-channel (wiring). |
| • a TAS5805M amplifier board (I2S + I2C) | A digital class-D amplifier, 4.5–26.4 V: up to 2 × 23 W (BTL: woofer + tweeter, or stereo) or 1 × 45 W (PBTL: subwoofer; 4 Ω, 21 V). Set up and watched by the speaker over I2C (TAS5805M amplifier). |
| Speaker(s), 4–8 Ω | One full-range driver, or a woofer + tweeter pair (see Option B). |
| Power supply | 5 V USB (≥ 1 A) for the ESP32-S3; a separate supply for a larger amplifier (e.g. 12 V ≥ 2 A, as your amplifier requires). |
| Enclosure | 3D-printed, wooden or an existing speaker box. |
| Jumper wires or a small PCB | 5 wires for the I2S connection. |
Number of boards
| System | Boards | Positions |
|---|---|---|
| 5.1 | 1 Streamer + 6 speakers | Front L, Front R, Centre, Subwoofer, Side L, Side R |
| 7.1 | 1 Streamer + 8 speakers | the 5.1 positions + Rear L, Rear R |
| Start small | 1 Streamer + 2–3 speakers | e.g. Front L + Front R (+ Centre) |
A channel without a speaker is simply not played. The centre carries most of the dialogue, so build it early.
Sender and network
- An Apple TV for 5.1 / 7.1 (surround is sent only by the Apple TV; an iPhone, iPad or Mac sends stereo, which the speakers play as well).
- A 2.4 GHz Wi-Fi network with good coverage at every speaker (the ESP32-S3 and the P4 board's ESP32-C6 have no 5 GHz radio).
- All boards on the same access point. The shared clock is that access point's beacon timer: each access point, and each node of a mesh system, has its own. A speaker on another access point logs a warning and stays silent.
Quick start
The whole way from download to flashed boards;
Installation explains each part. The firmwares build with
ESP-IDF v6.1.x on Linux, macOS and Windows. Everything they need is in
this repository, the AirPlay core included (components/ap2_core,
components/apple_clock); the ESP-IDF component manager fetches only
Espressif's components (mDNS, libsodium, the audio codecs and so on).
Steps 1–3 are done once per computer, step 4 in every new terminal, steps 5–8 once per board. Windows differs only in steps 1, 2 and 4 (see there).
Step 1. Download ESP-IDF v6.1 (once)
ESP-IDF is Espressif's toolkit for building ESP32 firmware. This downloads
version 6.1 into the folder ~/esp-idf-v6.1:
git clone -b v6.1 --recursive https://github.com/espressif/esp-idf.git ~/esp-idf-v6.1
On Windows, skip steps 1 and 2: Espressif's installer for Windows, version v6.1, does both.
Step 2. Install ESP-IDF's tools (once)
The folder from step 1 brings its own installer, install.sh. It downloads
the compilers and the Python packages that ESP-IDF needs, which takes a few
minutes. The words after it name the chips to install the compilers for:
this project uses only the ESP32-S3 (the speakers, an S3 Streamer) and the
ESP32-P4 (a P4 Streamer), so nothing else is downloaded.
~/esp-idf-v6.1/install.sh esp32s3,esp32p4
Step 3. Download this project (once)
This downloads the project into the folder ~/esp32-airplay2-surround:
git clone https://github.com/Kristian8606/esp32-airplay2-surround.git ~/esp32-airplay2-surround
Step 4. Prepare the terminal (in every new terminal)
A new terminal does not know idf.py yet. These two lines load ESP-IDF
into this terminal and go into the project folder:
. ~/esp-idf-v6.1/export.sh
cd ~/esp32-airplay2-surround
On Windows, open the ESP-IDF terminal the installer added to the Start
menu, then cd into the project folder. If a command later says
idf.py: command not found, this step was skipped in that terminal.
Step 5. Choose the Streamer's chip (once)
The project folder builds the Streamer. Pick the line for your board:
ESP32-S3 Streamer: nothing to do; the S3 is the default. With a 16 MB board (N16R8), set the flash size and the partition table in
idf.py menuconfigfirst (16 MB flash).ESP32-P4 Streamer, DFRobot FireBeetle 2:
idf.py set-target esp32p4ESP32-P4 Streamer, Waveshare ESP32-P4-NANO: the same
set-target, then pick the board inidf.py menuconfig: Streamer board (ESP32-P4) → Board: Waveshare ESP32-P4-NANO, and Chip revision (the one on your board). Save withS, leave withQ.idf.py set-target esp32p4 idf.py menuconfig
Everything else a P4 board needs (console, chip revision, bootloader log)
the build sets by itself (P4 boards). Other
menuconfig settings are optional: the defaults work.
Step 6. Connect the Streamer and find its port (once per board)
Connect the Streamer with a USB cable to this port:
| ESP32-S3 Streamer | FireBeetle 2 ESP32-P4 | Waveshare ESP32-P4-NANO |
|---|---|---|
| the UART port | the USB-C port | the Type-C port (a UART) |
Its name, which the next step calls PORT, is /dev/cu.usbserial-… or
/dev/cu.usbmodem… on a Mac (list them with ls /dev/cu.*),
/dev/ttyUSB0 or /dev/ttyACM0 on Linux and COMx on Windows.
Step 7. Build and flash the Streamer
idf.py -p PORT build flash monitor
build compiles the firmware (the first time takes a few minutes; the file
is build/airplay-streamer_<version>.bin), flash writes it to the board,
monitor shows the board's log. Leave the log with Ctrl+].
A P4 Streamer whose C6 does not run this project's firmware yet installs it by itself on the first start and restarts once.
Step 8. Build and flash every speaker
The speakers are always ESP32-S3. Their firmware is the project in the
speaker folder, with its own settings; no set-target is needed. Connect
a speaker by its USB port, then:
cd speaker
idf.py -p PORT build flash monitor
For the next speaker, connect it and run only the idf.py line again. A
speaker with a TAS5805M amplifier needs its option in menuconfig first
(TAS5805M amplifier).
cd .. goes back to the Streamer.
Then First start: Wi-Fi, names, roles. Later versions go over Wi-Fi (Updates); the speakers update from the Streamer.
[!NOTE]
set-targetstarts the settings again from the defaults. To go back from a P4 to an S3 build in the same folder, runidf.py set-target esp32s3.
[!NOTE] Windows: make a new clone if yours was made with
core.autocrlf=truebefore this version. The repository's.gitattributesnow checks every text file out with LF line endings, but an old clone keeps its CRLF files.Windows, ESP32-P4: the P4's Wi-Fi component (
esp_hosted) has files deeper than Windows' 260-character path limit, and the component manager then stops withFileNotFoundErrorwhile it unpacks it. Turn on long paths once (PowerShell as administrator, then a new terminal):New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name LongPathsEnabled -Value 1 -PropertyType DWORD -Forceor keep the paths short: clone to a short folder such as
C:\esp\surroundand set$env:IDF_COMPONENT_CACHE_PATH = "C:\esp\cache"before the build.
First start
- Connect every board to Wi-Fi. A new board opens the access point
ESP32-AirPlay-Setup. Join it with a phone or laptop; the setup page opens by itself (or go tohttp://192.168.4.1/). Choose your network, enter the password, Connect to WiFi. - Name the boards. Find each IP address in your router (or the serial
log), open
http://<board-ip>/(on the Streamer ⚙ Settings, orhttp://<streamer-ip>/settings) and set its name (AirPlay Device Name on the Streamer, Speaker Name on a speaker). The Streamer's name is what the Apple TV shows; clear speaker names (Front Left, Centre, …) make the speakers page easy to read. - Speakers connect by themselves. A speaker finds the Streamer on the network and shows up on the Streamer's speakers page; there is nothing to switch on.
- Give every speaker its role. Open the Streamer's page
http://<streamer-ip>/(the speakers page), pick a role, level and delay for each speaker, Save. - Choose the Streamer on the Apple TV. Open Control Center, select the AirPlay / audio output icon and tick only the Streamer. The speakers are not listed there; they follow the Streamer.
- Play something in surround (a film, or an Apple Music Dolby Atmos track). The speakers page shows what every speaker plays right now, e.g. AAC · 48 kHz · 24-bit · 7.1 · plays: Front Left. That format is what the Apple TV really sends: if it shows Stereo, the track or app offered only stereo.
[!TIP] A speaker that joins or restarts during a film stays silent until the next skip or seek (the Apple TV then restarts the stream at a point every speaker can start from). During screen mirroring it joins at once.
Speaker positions
| Position | Where to put it | Notes |
|---|---|---|
| Front Left / Right (L / R) | ~30° left / right of the screen | main pair; music and effects |
| Centre (C) | above or below the screen | most of the dialogue |
| Subwoofer (LFE) | anywhere low, often near a corner | the low-frequency effects channel; with stereo, the L+R mix |
| Side Left / Right (Ls / Rs) | beside the listener, ~90–110° | the surround pair of 5.1 |
| Rear Left / Right (Lrs / Rrs) | behind the listener, ~135–150° | 7.1 only; silent with a 5.1 stream, which has no rear channels |
| Mono mix | anywhere | every channel except LFE in one speaker; uses the most CPU |
[!IMPORTANT] With 5.1 / 7.1 the Subwoofer plays only the LFE channel (the extra bass effects of films), not the bass of the other speakers. There is no bass management, so the front speakers should reproduce reasonable bass on their own. With music the LFE channel is often silent; with films it is busy.
Licenses and credits
- This repository is under the Apache License 2.0, Copyright 2026
Kristian Dimitrov:
LICENSE,NOTICE. The project has been rewritten in full; the components incomponents/carry their own copy of the license and aNOTICE. The exceptions are below. - AirPlay 2 protocol core (
components/ap2_core,components/apple_clock, Apache License 2.0) is part of this repository; the Streamer and the speakers share the one copy. Its FairPlay setup replies (components/ap2_core/src/fairplay/fairplay_tables.c) are fixed interop data from reverse engineering, not under the Apache License; seecomponents/ap2_core/NOTICE. - Fraunhofer FDK AAC (
speaker/components/fdk_aac/fdk-aac) is under the Fraunhofer FDK license,NOTICE. The copy here is a Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android; the changes and their dates are listed inMODIFICATIONS.md. The license allows redistribution in source and binary form without copyright fees but grants no patent rights: AAC patent licenses are available through Via Licensing or the patent owners. - Other components (ESP-IDF,
esp_audio_codec, libsodium, mDNS, cJSON, led_strip,usb/usb_host_mscfor the USB player's drive, andesp_hostedfor the ESP32-P4's Wi-Fi through its C6) come through the ESP-IDF component manager under their own licenses.
Sister project by the same author: airplay-esp32, a stereo AirPlay 2 speaker for the ESP32-S3 that is its own AirPlay receiver, without a Streamer. AAC decoding through fdk-aac.
AirPlay, Apple TV and HomePod are trademarks of Apple Inc. This project is not affiliated with or endorsed by Apple.
If this project helped you build your surround system, please consider
supporting it. 🙏
Explorar proyectos relacionados
Cargando…




