Skip to content

balalida22/esp-mp3-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32-S3 Internal Flash MP3 Player

A low-cost, high-performance MP3 player built using an ESP32-S3 and a single-transistor "Class A" amplifier. This project demonstrates how to decode MP3 data in real-time and output audio using Pulse Density Modulation (PDM) directly from a digital GPIO pin.

Overview

Most microcontrollers require an external DAC (Digital-to-Analog Converter) like the MAX98357A to play high-quality audio. This project achieves audio playback using only the ESP32-S3's internal peripherals and a simple discrete hardware circuit.

Key Features

Key Features

  • Zero-DAC Hardware: Uses a single TIP31C BJT transistor and a passive RC-style filter for audio amplification.

  • On-Flash Storage: MP3 files are stored in a custom music partition in the ESP32's internal SPI Flash.

  • Software Decoding: Utilizes the lightweight minimp3 library to decode 44.1kHz/48kHz MP3s on one of the ESP32-S3's dual cores.

  • PDM Audio: Leverages the I2S peripheral in PDM mode to convert digital samples into a high-frequency bitstream that is smoothed into analog sound by the speaker's inertia and a coupling capacitor.

Technical Details

  • Framework: ESP-IDF v5.5+

  • Audio Output: I2S PDM (Pulse Density Modulation) at 16-bit resolution.

  • Decoder: minimp3 (Single-header C library).

  • Partitioning: A custom partitions.csv defines a 6MB data area for the MP3 file, mapped into the CPU's memory space via esp_partition_mmap.

Project Setup & Run

cd ~/esp
. ./esp-idf/export.sh

idf.py set-target esp32s3
idf.py reconfigure
idf.py build
idf.py -p /dev/ttyACM0 flash
idf.py -p /dev/ttyACM0 monitor
esptool.py -p /dev/ttyACM0 write_flash 0x110000 music.mp3

// Or Try:
parttool.py --port /dev/ttyUSB0 write_partition --partition-name=music --input=music.mp3

About

A minimal product that use ESP32-S3 to play mp3 music

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors