Skip to content

An ESP32-S3 sink

hearth_sink turns an ESP32-S3 board into a network audio player. It uses Sendspin to receive synchronised audio from a compatible server. The board can play stereo PCM, or decode AC-3 and E-AC-3 (including Atmos objects) for its configured speakers.

This guide covers building, flashing, network setup, pairing, and group playback. The example README and the ESP-IDF component overview contain implementation details and measurements. For the stereo ESP32-C6 player, see An ESP32-C6 sink.

Status as of 2026-10-13: Hearth plays to sinks; a board built with the AC-4 decoder takes AC-4 in a group

The desktop app discovers sinks, pairs, plays to groups and updates firmware over the network (Hearth index). These boards play AC-3 and E-AC-3 in a group, and the release image lists ac3 and eac3, not ac4, as the streams its Sendspin role takes. Built with CONFIG_ICLFORGE_AC4 and the 64 KB data cache an ESP32-S3 lists ac4 too, at 2 channels and 25 frames a second, and decodes 2.0 AC-4 from a group in real time (ESP32-S3); an ESP32-C6 does not fit it beside Wi-Fi and refuses the play; an ESP32-P4 decodes it to 5.1 in real time (ESP32-P4). For development without Hearth, hearth-testserver still plays E-AC-3 to boards (Play AC-3 and E-AC-3).

What you need

  • An ESP32-S3 board with 8 MB of octal PSRAM. The ESP32-S3-DevKitC-1-N16R8 is the board this was built on and measured with. Wi-Fi and the E-AC-3 decoder do not fit the part's internal RAM together, so the network build needs PSRAM (Memory). A board with quad PSRAM needs CONFIG_SPIRAM_MODE_QUAD in place of sdkconfig.psram's octal mode; no such board has run it.
  • A USB cable to the S3's own USB connector (the one marked USB on a DevKitC-1). It carries the flashing, the console and the network setup.
  • ESP-IDF v6.1, installed as Espressif's guide describes, and a checkout of this repository.
  • A 2.4 GHz Wi-Fi network that passes mDNS between the board and the server. The S3 has no 5 GHz radio.
  • For sound, a DAC on the I2S pins (Wiring). A board with nothing wired still plays and reports its levels.

Build and flash

Without building: a release publishes this board's image, hearth-sink-esp32s3, and the browser installer writes it over the USB cable, then gives the board its network. Sink firmware covers the same with esptool, and updating the board over its network afterwards. Then continue at The page.

To build it yourself, in an ESP-IDF v6.1 terminal, from firmware/hearth-sink:

export SDKCONFIG_DEFAULTS="sdkconfig.defaults;sdkconfig.hw;sdkconfig.psram;sdkconfig.psram-4k;sdkconfig.sendspin;sdkconfig.ac4;sdkconfig.s3-fast;sdkconfig.s3-dcache"
idf.py set-target esp32s3
idf.py build
idf.py -p PORT flash monitor

In PowerShell, set the first line as $env:SDKCONFIG_DEFAULTS = "...". PORT is the board's serial port, such as COM5 or /dev/ttyACM0. The files over the defaults do this:

File What it sets
sdkconfig.hw The console on the S3's own USB connector, so one cable does everything
sdkconfig.psram Octal PSRAM for the decoder's large allocations and the player's ring, a deeper I2S queue, and a 32 KB instruction cache
sdkconfig.sendspin The Sendspin player on Wi-Fi, the page and the REST routes on port 80, nothing played at boot, and lwIP's task on core 0 beside the network
sdkconfig.psram-4k PSRAM tried first for every allocation of 4 KB and more, so that an E-AC-3 stream leaves the board 44 KB of internal RAM at its least where 16 KB left it a few hundred bytes
sdkconfig.ac4 The AC-4 decoder, both decode stacks at 40,960 bytes (in PSRAM on this part), a frame's per-channel stages on both cores
sdkconfig.s3-fast The flash read four bits a clock (QIO), 64-byte lines in the data cache, and the firmware's code and constants run from PSRAM
sdkconfig.s3-dcache A 64 KB data cache, which is 32 KB of the heap

The QIO mode is the second stage bootloader's, so a board takes it with one USB flash that includes its bootloader (idf.py flash does); a network update leaves the mode the board has, and a bootloader that cannot set the flash chip's quad-enable bit stays in DIO.

Since 2026-10-29 the published image has all of them: one image decodes AC-3, E-AC-3 and AC-4. The 64 KB data cache costs 32 KB of the heap (the board boots with 75 KB of internal RAM free in place of 110) and the allocation limit stays at 4 KB, so an E-AC-3 stream leaves 44 KB and an E-AC-3 JOC 7.1.4, 9.1.6 or 5.1.4 play 60 KB at the end of its lap; an AC-4 play takes 512 for itself. With all of them the part decodes 2.0 in real time (SIMPLE mode at 0.40 of a frame's duration, A-SPX at 0.50, with the decoder's second core), the frame-rate converter at every rate (0.67 to 0.87) and E-AC-3 7.1.4 (0.75), and 5.1 in SIMPLE mode at 0.99; the rest of 5.1 takes 1.25 to 1.44 and 5.1.4 2.28 to 2.69. The ESP32-S3 page has what each file bought.

idf.py set-target writes a fresh sdkconfig from those files. After that, idf.py menuconfig changes one build: the pins, the slot width and the layout are under iclforge hearth sink, and the player's buffers under Sendspin player. If you build more than one shape, give each its own -B <build directory> and -DSDKCONFIG=<build directory>/sdkconfig, or the second inherits the first's settings.

After flashing over the S3's own USB connector, the chip can stay in its download mode, with boot:0x0 (DOWNLOAD) on the console. Press RESET. The port disappears and comes back at every reset, so idf.py monitor --no-reset is the way back to the console after one.

idf.py flash leaves the NVS partition alone, so a board keeps its network, its name, its keys and its pairings when you flash a new build. idf.py -p PORT erase-flash clears all of them.

Join a network

A board that has no network to join listens for Improv Wi-Fi on its console port. A freshly flashed board has none, since a build names a network only if you set one under iclforge hearth sink in idf.py menuconfig (for boards flashed from one image), so it listens at once:

  1. Close the serial monitor (Ctrl+]), so the port is free.
  2. Open improv-wifi.com in a browser with Web Serial (Chrome or Edge on a computer) and connect to the board's serial port.
  3. The board says it is a Hearth sink and gives its name. It does not scan for networks, so type the network's name, then its passphrase.
  4. The board stores both and joins, then advertises itself and starts its player. Improv offers a link to the board's page, http://<address>/. If the join fails, Improv says the board could not connect, and you can send the network again. A network that accepts the board but gives it no address within 30 s counts as a failed join.

A board is called hearth- followed by the last six hex digits of its MAC address until you name it. It advertises _sendspin._tcp over mDNS under its name, which is how a server finds it, and answers as <name>.local.

To move a board to another network, use the page's Wi-Fi network field, or PUT /network with the SSID and passphrase on two lines. The board joins that network at its next restart. A board that cannot join its stored network when it starts listens for Improv again, so give it the new network the same way.

The page

http://<name>.local/, or the board's address, shows:

  • Sendspin: the server connected to the board, its clock, the stream's timing, underruns, a meter for each output over the last 100 ms, and how many servers are paired. While a pairing runs, its six-digit code is shown at the top. A board keeps a pairing for each server it has paired with, and one server plays to it at a time.
  • Now: the board's own player, which plays a location sent to POST /play: its state, and the stream's path from source through decode to the output.
  • Settings: the wiring, the slot width and the output layout under Speakers; the network the board is on, its name and the network to join under Network; and under Time the time the board keeps, whether it asks a time server (on by default), its time zone and the server to ask (the time of day). A choice is sent as it is made; a name, a layout typed in full, a network, a zone or a server is sent with its button.
  • Levels and distances: a level and a distance for each speaker of the layout, and a test tone out of each (Speaker levels, distances and the test tone).
  • Real time, Hardware and Counters: how long each frame takes, what the board is - chip, memory, the sink's ceiling and the firmware - and the player's counters.

The same routes answer without the page (GET /api lists them): GET /status for a script, and PUT /name, /layout, /slot-width, /wiring and /network to change what the board is, and GET and PUT /trim and POST /identify for the speakers' levels and the test tone. A new name is advertised at once (Name, restart and reset). The page and the routes have no password (Security).

Name, restart and reset

The name. A board is called hearth- and the last six hex digits of its MAC address until you name it, with the page's Name field or PUT /name. A name is 1 to 32 bytes of text (a letter with an accent is two) with no control character in it and no space at either end; the board answers 409 to anything else, and keeps the name it had. A rename takes effect at once, with no restart:

What What a rename does
mDNS The host name (<name>.local: lower case, a hyphen between words, a Latin letter with an accent as the letter it is spelt with, so "Café" is cafe), the instance name and the _sendspin._tcp record all change.
The servers The name in the player's hello changes. An idle board tells its servers to dial again and they list it under the new name; a board that is playing waits until the stream has ended, so that a rename never cuts the music.
The page, the screen's footer, Improv Their next draw or request reads it.
The pairings Nothing. A pairing is the server's key and the board's own key, not the name, so every server stays paired.
The router's list of clients The name the board gave DHCP changes at its next boot; an address already leased keeps the old name until then.

A name that a person gave the player on the server (Music Assistant keeps its own) is not changed.

Restart. POST /restart restarts the board into the image that runs now, after telling its servers it is going. It is refused (409) while an update is under way, and while the running image is still on trial, when a restart would go back to the image before it. On the ESP32-P4 it resets the whole system, which a Wi-Fi link behind the companion chip needs (An ESP32-P4 sink).

Reset preferences. POST /reset-preferences puts the choices a person made once back to their defaults, at once and with no restart: every entry of the board's preferences that says it is reset (what the screen shows without lyrics, when it dims, the brightness, the clock's hours and seconds and the night schedule; an entry added later says for itself), each through its own setter, so the screen and the clock follow as they follow a change. It keeps the name, the Wi-Fi network and the choice between wired and Wi-Fi, the DAC wiring, the speaker layout and the time zone (the room's, not a matter of taste), the time server and whether the board asks it, and the pairings. On a board with a screen the same thing is Reset preferences on the sheet (An ESP32-P4 sink).

Factory reset. POST /factory-reset with the body erase everything erases the paired servers (the board gets a new identity, so each server has to pair with it again, and has to remove it from its list first), then every setting (the name, the network and its passphrase, the wiring, the layout and the preferences), then the Wi-Fi driver's own copy of the network, and restarts the board as a new one. It is taken only for a request that names the board by its own address or name, as the firmware routes are.

A board on Wi-Fi alone has no network after a factory reset. It cannot be reached to be told one. Connect it to a computer with a USB cable and give it a network over Improv, as Join a network says. A board with a wired network (the ESP32-P4X kit) stays on it and asks the router for an address again. An image built with a Wi-Fi network of its own (a development build; no published image has one) joins that network again.

curl -X POST http://hearth-1a2b3c.local/reset-preferences
curl -X POST -d "erase everything" http://hearth-1a2b3c.local/factory-reset

Pair a server

Every connection to the player is encrypted with Noise, and a server plays to the board only once the two are paired. There are two ways to pair.

By the token. The console prints the board's pairing token at every start, and again when you type pair token:

sendspin: pairing token SP:0AO4BQKDC3YEKAULMZ4UMZFDRQGZSLVY9...

A server given the token pairs straight away. Whoever has it can pair, so it is printed nowhere else.

By a code. A server that pairs by code makes the board show six digits, on the console as sendspin: PAIRING CODE 482-913 and at the top of the page's Sendspin section, for as long as the pairing runs. Type them into the server. After twenty wrong codes the board refuses to pair until you type pair reset or choose Allow pairing again on the page.

The board keeps eight pairings, each with the name the server gave, and lists them the most recently used first: on the page's Sendspin section, and for pair list. A ninth pairing replaces the one used least recently, never one a server is connected on. A pairing made before the board kept names shows without one until its server next takes the board. Lines typed on the console are commands:

Command What it does
pair list Prints the pairings: each server's ID (the first eight characters), its name, and whether it is connected
pair token Prints the pairing token again
pair reset Allows pairing again after twenty wrong codes
pair cancel Ends the pairing that is running
pair forget ID Removes one server's pairing, by the ID pair list prints, and closes its connection. The board keeps its other pairings and its identity; that server has to pair again. Forget beside a server on the page does the same
pair forget Removes every pairing and gives the board a new identity and token; Forget every server on the page does the same
sendspin Prints the player's state: the server, the role, the clock, and the stream's counters

Music Assistant compatibility

CI validates the sink against a scripted aiosendspin 9.1.1 server, the library version used by Music Assistant. Music Assistant itself has not been tested with a board. The validated server finds the board over mDNS, pairs with it, and plays stereo PCM at 48 kHz, 16 or 24 bits, through the player@v1 role. The board renders left and right onto the layout's front speakers; other speakers stay silent. A one-speaker layout mixes the two channels. The sink does not offer FLAC or Opus.

A board plays for one server at a time. As the Sendspin specification sets out, a server that asks to play takes the board from one that is only connected or is already playing. A pairing in progress is not interrupted.

Play AC-3 and E-AC-3

AC-3 and E-AC-3, with any Atmos objects, go to the board undecoded through Hearth's own role, _iclforge_player@v1. The board decodes the stream, renders it onto its layout, and applies the server's settings: the layout, routing, trims, delays and decoder settings.

hearth, the desktop app, sends it: its Network page pairs with the board and makes groups, and the output picker plays to a group (Hearth). hearth-testserver plays one file to one or more boards as a group. It is a developer tool, built from this repository with the hearth feature:

cmake --preset config-linux-gcc -DVCPKG_MANIFEST_FEATURES=hearth -DICLFORGE_BUILD_HEARTH=ON -DICLFORGE_BUILD_EXAMPLES=OFF
cmake --build --preset build-linux-gcc --target hearth-testserver

Then, with the board's address and the token from its console:

build/config-linux-gcc/bin/hearth-testserver --play programme.ec3 \
  --player ws://192.168.1.40:8928/sendspin --token SP:0... --layout 5.1 \
  --status http://192.168.1.40/status

The server pairs with the board, gives it the layout, plays the file, and prints what the board reported. --code-log FILE pairs by code instead: it reads the code from a file the board's console is being written to. --help lists the rest.

Karaoke

A karaoke stream, AC-3 or E-AC-3 flagged bsmod 7 above 1/0, goes to the board undecoded, and the board reproduces it itself under Hearth's karaoke setting: as coded, aware, or capable with the listener's vocals and the three part levels (Karaoke). The board says which codecs it does this for (karaoke_codecs), and this one lists AC-3 and E-AC-3. Checked on an S3 over Wi-Fi on 2026-10-12 with Hearth's live karaoke cases, which play a 3/2 stream with a tone in each channel to the board at a 3.0 layout once per reproduction and compare the levels the board reports at its outputs with the same stream decoded on the host: they followed it within 0.25 dB for as coded, aware, and capable with a vocal, with none, and with the melody and a vocal moved. One E-AC-3 run of three missed the part-level case and is not explained. Run it with ICLFORGE_HEARTH_LIVE_KARAOKE_SINK=<the board's mDNS name> and the tests named network sinks live: ... karaoke stream is reproduced by the board that decodes it.

Late night

A film's loud passages and its quiet ones can be a long way apart, and at night the neighbours hear the first and you cannot hear the second. The streams the board decodes carry the mixer's own instructions for closing that distance, and the board has a setting that uses them: GET and PUT /dynamic-range, standard or late-night.

  • standard is what the board always did, and the default: AC-3 and E-AC-3 as the build's operating mode (line, so dialogue is brought to the -31 dBFS reference and the stream's dynrng words are applied), AC-4 as coded, and whatever a server sends for the decoder.
  • late-night applies the stream's heavy compression (the compr words of AC-3 and E-AC-3, the speaker DRC modes of AC-4) at the same level dialogue was heard at, so that switching it on moves no stream by its dialnorm. It is not RF mode, which would be 11 dB louder. It is the listener's choice at the board, and it wins over a server's decoder mode and compression settings for as long as it is on.

It changes the next stream, not the one that is playing, and it is kept over a restart. It can only be as strong as the stream's own words: a stream that carries no compr word decodes exactly as it does in standard, and PCM from Music Assistant has no such words at all. On a stream with them, the loud-to-quiet distance of the test stream fell from 31.3 dB to 23.9 dB (AC-3 and E-AC-3) and from 26.0 dB to 17.6 dB (AC-4). A board with a screen offers the choice as Late night under Preferences, in the Sound group, greyed with the reason where the build has no player; Reset preferences puts it back on standard. Every board with a Sendspin player answers the route; a board with no AC-4 decoder (the C6) is sent PCM for AC-4 and so has nothing to compress there.

Groups

A group is every player a server plays one programme to. Each board decodes and renders the programme onto its own layout, and plays each sample when the server's clock says, so boards with different layouts stay together. Each board follows the server's clock with Sendspin's time filter. On a home Wi-Fi network, two boards' reported play times stayed within 549 µs of each other over ten minutes. Those are the times the software scheduled: nobody has measured two DAC outputs together.

With the test server, give a --player and its options for each board:

hearth-testserver --play programme.ec3 \
  --player ws://192.168.1.40:8928/sendspin --token SP:0... --layout 2.0 \
  --player ws://192.168.1.41:8928/sendspin --token SP:0... --layout 5.1

Music Assistant group playback has not been tested.

Wiring

Signal Default GPIO Kconfig
Bit clock (BCLK) 5 CONFIG_ICLFORGE_EXAMPLE_I2S_BCLK_GPIO
Word select (WS, LRCK) 6 CONFIG_ICLFORGE_EXAMPLE_I2S_WS_GPIO
Data out (DOUT) 7 CONFIG_ICLFORGE_EXAMPLE_I2S_DOUT_GPIO
Second line's data out 8 CONFIG_ICLFORGE_EXAMPLE_I2S_DOUT2_GPIO

The defaults avoid the S3's strapping pins, its USB pair and the console UART; any free GPIO will do. The signals are 3.3 V. The board sends no MCLK, so a DAC that needs one needs it added.

  • A stereo I2S DAC, such as a PCM5102 or MAX98357A, plays a 2.0 or 1.0 layout: one or two channels open standard I2S.
  • A TDM DAC plays three or more channels, which open TDM. A TDM DAC set up for one frame shape over I2C, such as an ESS ES9080, needs CONFIG_ICLFORGE_EXAMPLE_I2S_FIXED_FRAME=1, which opens the full TDM frame for every layout, stereo included. The firmware does not set the DAC up over I2C: whatever does has to match the slot width below.
  • A second line carries a second DAC. Wire its data pin, and tick A second I2S line is wired to a DAC on the page (or PUT /wiring with 1). It shares the first line's bit clock and word select. Whether the two lines stay sample-aligned with DACs on both has not been checked.
  • A DSP that supplies the clocks, such as an ADAU1452, needs CONFIG_ICLFORGE_EXAMPLE_I2S_SLAVE=1. This has not been tried.

Slot widths

An S3 I2S line carries at most 128 bits a frame, so the slot width decides how many channels a line takes:

Slot width Samples Channels on one line With a second line
32 bits (the default) 24-bit, left-justified 4 8
16 bits 16-bit 8 16

So a 5.1 or 7.1 layout needs 16-bit slots, or 32-bit slots on two lines. 7.1.4 and 9.1.6 need 16-bit slots on two lines. Set the width to what the DAC is set up for: Slot width on the page, or PUT /slot-width with 16 or 32. It takes effect at the next play, and is refused while one runs. A layout that no longer fits after a change fails at the next play, and the page says why.

Layouts

The layout is the board's speakers, one per output slot: a name such as 2.0, 5.1, 5.1.4 or 7.1.4, or a list such as L,R,C,LFE,Ls,Rs in the order the DAC's outputs are wired. Set it on the page or with PUT /layout, and it applies from the next chunk the board plays. A server that sends its own settings replaces it. At 2.0 and 1.0 the decoder folds the programme down. On a wider layout each channel plays at its own location, objects are placed by their positions when the layout has height speakers, and nothing is upmixed. The README has the grammar and the rules.

Memory

Internal RAM is what this build is short of. Wi-Fi, lwIP, two HTTP servers, the Sendspin session and the decoder share what the part has: about 300 KB free before any of them starts (304,680 bytes in the footprint probe under QEMU), and the decoder's allocations of up to 16 KB go there first. In the ten-minute group run, the least internal RAM free while a stream played was 139 bytes on the 2.0 board and 23 bytes on the 5.1 board. Nothing failed in those runs, but in an earlier one-minute run a 108-byte allocation did, with no effect on the stream. The console's sendspin.progress lines report it as heap_least every four seconds or so.

Security

  • The page and its routes have no password. Anyone who can reach the board on the network can play a URL on it, change its settings or the network it joins at its next restart, and forget its pairings. Anyone who can load the page during a pairing can also read the code, and so pair a server of their own. Keep the boards on a network you trust.
  • The token is the credential. It pairs a server with no code, and only the console prints it.
  • Keys are stored unencrypted. The board's identity, its pairing token, its pairings and the Wi-Fi passphrase are in NVS, which these builds do not encrypt: anyone holding the board can read them.

The threat model has the rest.

When something goes wrong

  • The server does not list the board. The console's mdns: line says whether the board advertised itself. Check that mDNS passes between the board's network and the server's: an access point that isolates its clients, or a second VLAN, stops it. http://<address>/status shows whether the board is up.
  • Improv says the board could not connect. Check the network's name and passphrase, and that it is a 2.4 GHz network, then send them again. The board keeps listening.
  • Pairing fails. Type sendspin on the console to see the player's state. After twenty wrong codes, pair reset. A server that paired before pair forget has to pair again, and so does one forgotten by its ID.
  • Underruns. The page's Sendspin section counts them. The console's closing line for each stream gives them, with the average time a chunk took to decode and render (burst_us). A chunk holds 32 ms of audio, so a burst_us near 32,000 means the board cannot keep up with the programme on its layout. Otherwise, look at the Wi-Fi between the board and the server.
  • A layout is refused. It has more channels than the slot width and wiring allow (Slot widths).
  • The console shows boot:0x0 (DOWNLOAD) after flashing. Press RESET.

Where to go next

  • The example's README: every setting, the REST routes, and the measurements.
  • ESP32-S3: the decoder on this part, and its timing and memory.