Skip to content

Simple ESP32 audio player using I2S and SPIFFS. Plays WAV files through MAX98357A with adjustable volume and DMA buffering for smooth playback. Supports multiple files and easy volume control.

License

Notifications You must be signed in to change notification settings

vaniktigranyan/esp_idf_wav_player

Repository files navigation

🎵 ESP32 WAV Player

🎯 Description

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 🎚️

🛠️ Hardware Required

  • 🖥️ ESP32 Development Board
  • 🎧 MAX98357A I2S DAC
  • 📂 WAV files stored in SPIFFS

🔌 Wiring Diagram (ASCII):


        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:


Notes:

  • ⏱️ BCLK : Bit clock
  • 🔀 LRCLK : Left/right channel select
  • 📡 DIN : Digital audio data
  • GND/VCC: Power supply

⚡ Usage


  1. Copy WAV files to the /spiffs folder.

  2. 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

About

Simple ESP32 audio player using I2S and SPIFFS. Plays WAV files through MAX98357A with adjustable volume and DMA buffering for smooth playback. Supports multiple files and easy volume control.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published