Skip to content

What is I2S?

I2S (Inter-IC Sound, pronounced “eye-two-ess”) is a digital audio protocol for sending audio data between chips on the same board. It’s how your tinyCore talks to speakers, microphones, and audio amplifiers — and it’s the protocol behind the tinySpeak HAT.

If you want your tinyCore to play sounds, record audio, do voice recognition, or build a musical instrument, you’re going to use I2S. It’s the standard way microcontrollers exchange audio data with external hardware — microphones, amplifiers, DACs, and codec chips. The tinySpeak HAT connects to the ESP32-S3 over I2S.

I2S uses three signal wires. All three are required for any I2S connection:

BCLK (Bit Clock): The ESP32-S3 generates this clock. One pulse = one bit of audio data transmitted. For CD-quality stereo audio (44.1 kHz, 16-bit, 2 channels), this clock runs at 1.41 MHz.

WS / LRCLK (Word Select): Also generated by the ESP32-S3. This signal toggles between LOW and HIGH to indicate whether the current audio data is for the left channel (LOW) or the right channel (HIGH). It runs at the sample rate — 44,100 times per second for CD-quality audio.

DIN / DOUT (Serial Data): The actual audio samples, sent one bit at a time. “DIN” or “DOUT” depends on which side you’re looking from: the ESP32-S3’s data output connects to an amplifier’s data input, and a microphone’s data output connects to the ESP32-S3’s data input.

Some external DAC chips also need an optional MCLK (Master Clock), typically running at 256× the sample rate. Not all I2S devices require it.

Digital audio over I2S is preferred over analog in microcontroller projects for practical reasons. Digital signals aren’t degraded by electromagnetic interference from WiFi radios and switching regulators on the PCB — analog audio lines running across an ESP32-S3 board would pick up significant noise. I2S microphones output digital data directly (no external preamp or ADC needed), and I2S amplifiers accept digital input directly (no DAC needed on the MCU side). The ESP32-S3’s I2S peripheral also moves audio data via DMA (Direct Memory Access), so audio streams in and out without constantly tying up the CPU.

Play audio files from an SD card. Read WAV files from storage and stream the audio out over I2S to the tinySpeak amplifier. The ESP32-S3’s dual-core 240 MHz processor can also handle MP3 decoding in software.

Record audio from a microphone. Capture samples from an I2S microphone (like the INMP441) into memory, then save to SD card, stream over WiFi, or process in real time.

Voice pipelines. Feed microphone input to a cloud-based speech recognition API, process the result, and output synthesized speech through the speaker — the Big Mouth Billy Bass project on the tinyCore does exactly this.

Musical instruments and synthesizers. Generate audio waveforms (sine, square, sawtooth) in code and output them over I2S in real time. Latency can be kept under 10 ms with proper buffer configuration.

Walkie-talkies. Use one I2S bus for the microphone and another for the speaker. Stream audio between two tinyCore boards over ESP-NOW or WiFi.

The ESP32-S3 has two I2S peripherals: I2S0 and I2S1. Each has separate TX and RX channels with independent clocks, pin assignments, and configurations. This means you can run a microphone on I2S0 and a speaker on I2S1 simultaneously. Both support 8-bit, 16-bit, 24-bit, and 32-bit sample widths, and sample rates from 8 kHz up to 96 kHz+.

DeviceTypeWhat It Does
MAX98357AI2S amplifier + DACDrives a 4–8Ω speaker directly (3.2W). Auto-detects clocking. No configuration needed — just wire it up and send audio data.
INMP441I2S MEMS microphoneOutputs 24-bit digital audio over I2S. Powered from 3.3V. No preamp needed.

Pin assignment errors. The ESP32-S3’s I2S pins are fully configurable — there are no fixed defaults. The GPIO numbers in your code must exactly match your physical wiring. The most common mistake is swapping BCLK and WS, which produces silence or garbage audio.

Sample rate mismatches. The I2S configuration must match the audio source. Playing a 44.1 kHz WAV file with I2S configured for 16 kHz produces fast, chipmunk-pitched audio. Always check the sample rate of your audio files.

Bit depth mismatches. The INMP441 microphone outputs 24-bit data packed in 32-bit frames. If you treat the raw 32-bit value as the full sample, audio will be nearly inaudible. You need to bit-shift the data right by 8 to extract the actual 24-bit sample.

Buffer sizing. The I2S driver uses DMA buffers. Small buffers (2 buffers × 64 samples) give low latency but risk underruns — causing clicks and pops. Large buffers (8 × 1024 samples) are stable but add latency. Start with 8 buffers of 64 samples and adjust from there.

FeatureESP32-S3
I2S peripherals2 (I2S0, I2S1)
Supported bit depths8, 16, 24, 32 bit
Supported sample rates8 kHz – 96+ kHz
Pin assignmentFully configurable (any GPIO)
DMA supportYes (audio streams without CPU intervention)
ModesStandard (Philips/MSB/PCM), PDM, TDM

atomic14 (Chris Greening) — focused tutorial on wiring a MAX98357A I2S amplifier to an ESP32 and playing WAV audio. Covers pin configuration and code.

Video: Complete I2S Guide (Mic + Playback)

Section titled “Video: Complete I2S Guide (Mic + Playback)”

DroneBot Workshop — 46 minutes. Use the chapter timestamps: I2S intro at 1:27, INMP441 microphone at 10:18, MP3 player at 18:37. Both videos use the legacy I2S API — the wiring and concepts are identical for the new API, only the function names have changed.