A robust Arduino/ESP32 audio player library for SD card playback with I2S output and NAU8325 amplifier control.
PCBCUPID_PLAYERS is a high-level audio player library designed for ESP32 and Arduino-compatible boards. It enables seamless playback of MP3, WAV, OGG, and AAC files from an SD card, with I2S digital audio output and integrated control of the NAU8325 Codec with Class-D audio amplifier via I2C.
- Simple API for playback control (play, pause, stop, next, previous)
- Automatic file discovery and playlist management
- Volume and auto-fade support
- Metadata and audio info reporting
- Designed for custom hardware (tested on PCBCUPID GLYPHC3, GLYPHH2, GLYPHC6)
- Multi-format support: MP3, WAV, OGG, AAC
- SD card file browsing: Automatic playlist creation from a folder
- I2S audio output: High-quality digital audio
- NAU8325 amplifier control: Power, volume, and audio path management
- Playback state tracking: Elapsed time, paused time, and file position
- Metadata callback: Display track info (title, artist, etc.)
- Easy integration: Just provide your
TwoWireinstance and callbegin()
- ESP32 (all variants supported)
- SD card module (SPI interface)
- NAU8325 Codec with Class-D amplifier (I2C)
- I2S DAC or amplifier
- Speaker or headphones
git clone https://github.com/pcbcupid/PCBCUPID-PLAYER.gitThis library requires the following libraries:
Download the latest release ZIP files and install them through the Arduino IDE:
Sketch → Include Library → Add .ZIP Library...
cd ~/Documents/Arduino/libraries
git clone https://github.com/pschatzmann/arduino-audio-tools.gitcd ~/Documents/Arduino/libraries
git clone https://github.com/pschatzmann/arduino-audio-driver.gitPlace the downloaded libraries in your Arduino libraries folder and restart the IDE.
Important
Make sure all required libraries are installed before compiling. Missing dependencies may result in build errors.
Connect your ESP32 to the SD card, NAU8325 codec with amplifier, and I2S output as per your hardware.
Update config.h for your pin assignments.
#include "PCBCUPID_PLAYERS.h"
TwoWire wire = TwoWire(0);
PCBCUPID_PLAYERS player(wire);
void setup() {
Serial.begin(115200);
player.begin("mp3"); // or "wav", "aac", "ogg"
}
void loop() {
player.loop();
// Add your playback control logic here
}void begin(const char *ext);— Initialize player and scan for filesvoid play();— Start or resume playbackvoid pause();— Pause playbackvoid stop();— Stop playbackvoid next();/void previous();— Navigate playlistvoid setVolume(float volume);— Set playback volumebool isPlaying();— Query playback stateString getCurrentFileName();— Get current track name
See the examples/ directory for ready-to-use sketches demonstrating SD card playback, I2S output, and amplifier control.
- NAU8325 Datasheet: Nuvoton NAU8325
- AudioTools Library: AudioTools
- PCBCUPID Forum: forum.pcbcupid.com
This library was developed and maintained by PCBCUPID, based on the NAU8325 codec specifications and the I2C protocol defined by Nuvoton Technology Corporation.
Special thanks to the open-source community for foundational research and NAU8325 references.
Original Author:
- Karthik Elumalai – @PCBCUPID
- Version: 1.0.0
- License: MIT License (refer to the LICENSE file for terms)
We welcome contributions and feedback from the community! You can:
- Report issues or suggest improvements
- Submit pull requests with enhancements or fixes
- Share example projects using this library
Please refer to the Contributing Guidelines before submitting changes.
This library is licensed under the MIT License. See the LICENSE file for full details.
Made with 🎵 by PCBCUPID