ESP32 AirPlay 2 Surround v4.5.5: Wireless 5.1 and 7.1 Home Cinema from Cheap ESP32-S3 Boards Synced by Apple TV
TL;DR: Quick Summary
ESP32 AirPlay 2 Surround is an experimental open firmware that builds a wireless 5.1 or 7.1 home cinema out of cheap ESP32-S3 boards, one board per speaker. Each board is a complete AirPlay 2 receiver: it announces 5.1 and 7.1 AAC capability so Apple TV sends the full multichannel stream, decodes it with Fraunhofer FDK AAC, synthesizes only its assigned speaker position, and plays it on both I2S outputs. Timing comes from Apple TV PTP clock shared by the whole AirPlay group, so boards never talk to each other and adding a speaker means adding another board. Version 4.5.5 from October 2026 runs on 8 MB flash plus 8 MB octal PSRAM boards with any I2S DAC, picks the speaker live from a web page, and was tested with Apple Music in Dolby Atmos arriving as 7.1, HBO as 5.1 and YouTube as stereo. If you have a drawer of ESP32 boards and a shelf of spare drivers, this is the cheapest possible route to surround sound.
What Is ESP32 AirPlay 2 Surround?
ESP32 AirPlay 2 Surround is an experimental ESP-IDF firmware that turns each ESP32-S3 board into one wireless speaker position of a 5.1 or 7.1 surround system fed by Apple TV.
In practice that means flashing one firmware to several identical boards, giving each its position in a web page, adding all of them to Apple TV audio output, and pressing play. Apple TV transmits the entire multichannel AAC stream to every board in the group, each board decodes only its own channel at about 40 to 50 percent of one core, and PTP clocking plays every sample at the same scheduled moment on all boards. With ordinary stereo sources every board simply plays stereo. The project lives at https://github.com/Kristian8606/esp32-airplay2-surround with 109 commits on main, built on the airplay-esp32 stereo receiver, tested against a real Apple TV.

The Trick: Every Board Gets Everything, Plays One Thing
Apple TV only sends surround to receivers that advertise it, and when it does, every receiver in the group receives the whole multichannel stream rather than its own slice, with all receivers sharing one PTP clock so samples land simultaneously.
The firmware exploits exactly that. One ESP32-S3 can’t drive eight speakers and never tries: it receives the full stream and plays a single channel of it. So every board announces 5.1 and 7.1 AAC in GET info supportedFormats, Apple TV obliges with the multichannel stream, all channels are parsed but only the selected speaker is synthesized, keeping CPU at a fraction of full decode, and the chosen speaker goes to both I2S slots (L equals R) so either output drives the speaker or both feed an active sub or a driver pair in one cabinet. Speaker choice happens in the browser at the EQ page surround card and applies from the next decoded frame with no restart, or at build time through menuconfig. Start with a centre plus sub and add surrounds later; boards are cheap and independent.
Choosing Positions: From Front Pair to 7.1 Rears
| Speaker | Placement | Notes |
|---|---|---|
| Front Left and Right | About 30 degrees off screen | The main pair |
| Centre | Under or over the screen | Carries most dialogue |
| Subwoofer LFE | Anywhere low | Effects channel only, not other speakers bass |
| Side Left and Right | Beside listener, 90 to 110 degrees | The 5.1 surround pair |
| Rear Left and Right | Behind listener, 135 to 150 degrees | 7.1 only; with 5.1 they play Sides |
| Mono mix | None | All channels except LFE; full decode, heaviest CPU |
Matching is by channel name from each stream labels, so one setting covers both 5.1 and 7.1. One caveat documented in the README: Apple TV sends 7.1 as AAC configuration 7 in Apple order (first pair fronts, second sides, backs rear) while the ISO reading names them differently, so a channel test that puts Front where Side should be is a naming artifact worth an issue report. Old stereo source mode settings are irrelevant to surround: both inputs carry the same speaker.

Under the Hood: FDK AAC, Float Pipeline and PTP Timing
Advertised inputs span realtime ALAC 16 bit at 44.1 kHz over UDP, buffered ALAC 16 and 24 bit stereo, stereo AAC-LC at 44.1 or 48 kHz, and multichannel AAC-LC 48 kHz six or eight channel, all in 1024 frame packets except ALAC 352 frame blocks. All AAC decodes through Fraunhofer FDK AAC to signed 32 bit PCM straight into float with no 16 bit step, 24 bit ALAC likewise, I2S running 32 bit samples, the FDK limiter off as the 32 bit path requires, and noise substitution concealment adding no extra frame of delay so blocks stay aligned to RTP time.
Format changes need no new SETUP: each buffered packet SSRC decides, so the sender can hop between AAC and lossless ALAC mid stream, with codec or channel changes keeping queued audio and rate changes waiting until the new audio is due before rebasing the PTP and RTP map and reconfiguring I2S with a short gap. Realtime ALAC runs 44.1 kHz, surround runs 48 kHz, and only AAC blocks mute at starts or timestamp jumps.
Work splits across cores with decode, RTSP and PTP on Core 0 and Wi-Fi, LwIP, TCP reading, I2S playout and status on Core 1, decode scratch in PSRAM with heap fallback. Serial and web logs expose NOW PLAYING lines naming codec, rate, F24 profile, channel count and applied speaker, plus per frame CPU splits and an 850 ms PCM queue gauge.
Hardware and Build: One Board Design Repeated
Each node needs an ESP32-S3 with 8 MB flash and 8 MB octal PSRAM, the 6 MB compressed stream buffer alone lives in PSRAM, plus any I2S DAC or amplifier on default BCLK GPIO 5, LRCK GPIO 6, DATA GPIO 4 with MCLK unused, optional WS2812 VU LED on GPIO 38, amp power GPIO and playback buttons.
Built with ESP-IDF v6.0.2:
idf.py set-target esp32s3
idf.py menuconfig # optional: I2S pins, default speaker, logs
idf.py build
idf.py -p /dev/cu.usbmodem* flash monitor
First boot raises access point ESP32-AirPlay-Setup with setup at 192.168.4.1 for home Wi-Fi, then the board appears as an AirPlay 2 speaker for the Apple TV group. A plain stereo receiver builds from the same tree by disabling the multichannel experiment and dropping its two sdkconfig defaults lines that pin Wi-Fi and LwIP to Core 1.
Tested Reality and Honest Limits
Status is experimental with one Apple TV tested: Apple Music Atmos as 7.1, HBO as 5.1, YouTube as stereo, iPhones sending stereo only. Rear channels sit near silent on music and wake on films and Atmos mixes. Mono mix may not keep up since it decodes everything. Rate switches between 44.1 and 48 kHz pause briefly, some apps take 20 to 30 seconds from session start to first audio through no fault of the board, and the 7.1 Apple versus ISO naming still awaits a channel test confirmation.
License status needs stating plainly: the FDK AAC copy ships under the Fraunhofer FDK license with a modifications file, redistribution allowed without copyright fees but with no patent rights granted, and the rest of the repository currently carries no license file, which grants nothing beyond viewing on GitHub. Treat this as experimental bench software, not a product base, until licensing settles.
Comparison: ESP32 Surround, Soundbars and AV Receivers
| Attribute | ESP32 AirPlay 2 Surround | Soundbar with wireless rears | AV receiver with wired speakers |
|---|---|---|---|
| Surround source | Apple TV over AirPlay 2, 5.1 and 7.1 AAC | HDMI ARC or optical | HDMI, decoded in receiver |
| Cost per added speaker | One ESP32 board plus driver | Proprietary module | Wire plus speaker |
| Sync method | Apple TV PTP clock, no inter board link | Vendor link | Wire delay trims |
| Stereo fallback | Every board plays stereo | Yes | Yes |
| Effort | Flash, position, group, tune | Unbox and pair | Pull wire, calibrate |
| Best for | Tinkerer with spare drivers and boards | Living room simplicity | Reference quality |
The honest takeaway: a soundbar wins on convenience, an AV receiver wins on fidelity and power, and this project wins on cost per channel and hackability when the speakers already exist.
Why It Matters
Surround sound has always been gated by the receiver: one expensive box that decodes everything and amplifies everything. Splitting decode per speaker across throwaway priced boards with network clock sync inverts that architecture. Even as an experiment it demonstrates how far commodity microcontrollers have come: real time multichannel AAC decode, float DSP with EQ and loudness, live tuned I2S clocks and over the air updates on a board that costs less than a cinema ticket.
Frequently Asked Questions (FAQ)
What does each ESP32-S3 board do?
It acts as a full AirPlay 2 receiver for the whole surround stream, decodes it with FDK AAC, synthesizes only its assigned speaker position, and plays it on its I2S outputs.
How do the boards stay in sync?
Through Apple TV PTP clock shared by the AirPlay group. Boards never communicate with each other, so adding speakers only adds group members.
What hardware do I need per speaker?
An ESP32-S3 with 8 MB flash and 8 MB octal PSRAM plus an I2S DAC or amplifier, with optional VU LED and buttons. Pinout defaults suit common boards.
Does stereo still work?
Yes. With stereo sources every board plays stereo normally, and multichannel builds also advertise all buffered stereo formats.
Is it finished and licensed for products?
No. It is experimental with one Apple TV tested, and the non FDK code has no license file yet. Build it for the bench, not for sale.
Sources and Further Reading
- ESP32 AirPlay 2 Surround GitHub Repository – Source, 109 commits, README theory, build and log reference.
- Airplay ESP32 Stereo Receiver – The stereo base project this surround work builds on.
- FDK AAC Codec by mstorsjo – Standalone Fraunhofer AAC build used for decoding.
- ESP-IDF v6 Programming Guide – Build system and I2S plus PSRAM notes for ESP32-S3.
- Apple AirPlay 2 Protocol Notes – Independent writeup of PTP timing behind multi room sync.
73 de 9M2PJU



Post Comment