RepositoryC++
SC

schreibfaul1/ESP32-audioI2S

Play mp3 files from SD via I2S

1.7kstars
430forks
11issues
5views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: i2s

#1 Repository of the week

1
TINIX TRENDING·Topic: pcm5102a

#1 Repository of the week

1
TINIX TRENDING·Topic: max98357a

#1 Repository of the week

ESP32-audioI2S

:warning: This library only works on multi-core chips like ESP32, ESP32-S3 and ESP32-P4. Your board must have PSRAM! It does not work on the ESP32-S2, ESP32-C3 etc :warning:

Plays mp3, m4a and wav files from SD card via I2S with external hardware. HELIX-mp3 and faad2-aac decoder is included. There is also an OPUS decoder for Fullband, an VORBIS decoder and a FLAC decoder. Works with MAX98357A (3 Watt amplifier with DAC), connected three lines (DOUT, BLCK, LRC) to I2S. The I2S output frequency is always 48kHz, regardless of the input source, so Bluetooth devices can also be connected without any problems. For stereo are two MAX98357A necessary. AudioI2S works with UDA1334A (Adafruit I2S Stereo Decoder Breakout Board), PCM5102A and CS4344. Other HW may work but not tested. Plays also icy-streams, GoogleTTS and OpenAIspeech. Can be compiled with Arduino IDE. WIKI

#include "Arduino.h"
#include "WiFi.h"
#include "Audio.h"

// Digital I/O used
#define I2S_DOUT      25
#define I2S_BCLK      27
#define I2S_LRC       26

String ssid =     "*******";
String password = "*******";

Audio audio;

// callbacks
void my_audio_info(Audio::msg_t m) {
    Serial.printf("%s: %s\n", m.s, m.msg);
}

void setup() {
    Audio::audio_info_callback = my_audio_info; // optional
    Serial.begin(115200);
    WiFi.begin(ssid.c_str(), password.c_str());
    while (WiFi.status() != WL_CONNECTED) delay(1500);
    audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
    audio.setVolume(21); // default 0...21
    audio.connecttohost("http://stream.antennethueringen.de/live/aac-64/stream.antennethueringen.de/");
}

void loop(){
    audio.loop();
    vTaskDelay(1);
}

You can find more examples here: https://github.com/schreibfaul1/ESP32-audioI2S/tree/master/examples

// detailed cb output
void my_audio_info(Audio::msg_t m) {
    switch(m.e){
        case Audio::evt_info:           Serial.printf("info: ....... %s\n", m.msg); break;
        case Audio::evt_eof:            Serial.printf("end of file:  %s\n", m.msg); break;
        case Audio::evt_bitrate:        Serial.printf("bitrate: .... %s\n", m.msg); break; // icy-bitrate or bitrate from metadata
        case Audio::evt_icyurl:         Serial.printf("icy URL: .... %s\n", m.msg); break;
        case Audio::evt_id3data:        Serial.printf("ID3 data: ... %s\n", m.msg); break; // id3-data or metadata
        case Audio::evt_lasthost:       Serial.printf("last URL: ... %s\n", m.msg); break;
        case Audio::evt_name:           Serial.printf("station name: %s\n", m.msg); break; // station name or icy-name
        case Audio::evt_streamtitle:    Serial.printf("stream title: %s\n", m.msg); break;
        case Audio::evt_icylogo:        Serial.printf("icy logo: ... %s\n", m.msg); break;
        case Audio::evt_icydescription: Serial.printf("icy descr: .. %s\n", m.msg); break;
        case Audio::evt_image: for(int i = 0; i < m.vec.size(); i += 2){
                                        Serial.printf("cover image:  segment %02i, pos %07lu, len %05lu\n", i / 2, m.vec[i], m.vec[i + 1]);} break; // APIC
        case Audio::evt_lyrics:         Serial.printf("sync lyrics:  %s\n", m.msg); break;
        case Audio::evt_log   :         Serial.printf("audio_logs:   %s\n", m.msg); break;
        default:                        Serial.printf("message:..... %s\n", m.msg); break;
    }
}

CodecESP32ESP32-S3 or ESP32-P4
mp3yy
aacyy
aacpy (mono)y (+SBR, +Parametric Stereo)
wavyy
flacyyblocksize max 24576 bytes
vorbisyy<=196Kbit/s
m4ayy
opusyy


Wiring schematic


Impulse diagram Impulse diagram


Yellobyte has developed an all-in-one board. It includes an ESP32-S3 N8R2, 2x MAX98357 and an SD card adapter. Documentation, circuit diagrams and examples can be found here: https://github.com/yellobyte/ESP32-DevBoards-Getting-Started image

Similar Projects

Discover other similar projects and AI models.

RepositoryC++
flacon/flacon

Audio File Encoder. Extracts audio tracks from an audio CD image to separate tracks.

546
Nov 23, 2026
RepositoryPython
quodlibet/mutagen

Python module for handling audio metadata

2.0k
Nov 3, 2026
RepositoryPython
tinytag/tinytag

Python library for reading audio file metadata

843
Nov 19, 2026
RepositoryC
CarlosDerSeher/snapclient

Production-ready Snapcast client for ESP32. Reliable, synchronous multiroom audio playback.

309
Nov 29, 2026
RepositoryC++
complexlogic/rsgain

A simple, but powerful ReplayGain 2.0 tagging utility

747
Oct 11, 2026
RepositoryC++
CelliesProjects/ESP32_VS1053_Stream

An audio library for Arduino esp32 with a vs1053 mp3/aac/ogg/flac decoder. Plays http, https and chunked streams. Stream metadata is parsed. Also plays ogg, mp3, flac and m4a files from sdcard.

148
Oct 28, 2026
RepositoryRust
pdeljanov/Symphonia

Pure Rust multimedia format demuxing, tag reading, and audio decoding library

3.5k
Nov 25, 2026
RepositoryTypeScript
BlackHatDevX/openspot-music-app

OpenSpot is a free, open-source music app that lets you stream and download high-quality tracks across all your devices. With a sleek, intuitive UI built for a seamless experience, it supports Android, iOS, macOS, Windows, and Linux — so you can enjoy your favorite music anywhere, online or offline.

3.1k
Nov 12, 2026
RepositoryC
mackron/dr_libs

Audio decoding libraries for C/C++, each in a single source file.

1.9k
Nov 26, 2026