This project allows an ESP32 to play WAV audio files stored in SPIFFS
using the I2S protocol and the MAX98357A DAC.
✨ Features:
- Support for multiple WAV files
- Adjustable volume per file 🔊
- DMA buffering for smooth playback ⚡
- Sequential playback of multiple files
▶️ - Optimized for MAX98357A I2S DAC 🎚️
- 🖥️ ESP32 Development Board
- 🎧 MAX98357A I2S DAC
- 📂 WAV files stored in SPIFFS
ESP32 MAX98357A
┌────────────────┐ ┌────────────────┐
│ GPIO26 │ ── BCLK ── │ BCLK │
│ (I2S_BLK) │ │ │
│ GPIO25 │ ── LRCLK ─ │ LRC / WS │
│ (I2S_WS) │ │ │
│ GPIO27 │ ── DIN ── │ DIN │
│ (DATA_OUT) │ │ │
│ GND │ ────────── │ GND │
│ 3.3V / 5V │ ────────── │ VCC │
└────────────────┘ └────────────────┘
Notes:
- ⏱️ BCLK : Bit clock
- 🔀 LRCLK : Left/right channel select
- 📡 DIN : Digital audio data
- ⚡ GND/VCC: Power supply
-
Copy WAV files to the
/spiffsfolder. -
Build and flash using ESP-IDF:
idf.py build idf.py -p com3 flash monitor
play_music("mus.wav", 1.0f); // full volume
play_music("mus2.wav", 0.5f); // half volume