Skip to content

embedded-kiddie/CYD_MP3Player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CYD MP3 Music Player

MP3 music player for Cheap Yellow Display

Library & Sketches

CYD_Audio is an ESP32 I2S audio library based on schreibfaul1/ESP32-audioI2S and customized by Piotr Zapart for the CYD with an internal DAC and onboard amplifier IC.

Originally written for PlatformIO, the version included here has been modified for the Arduino IDE and can be installed in the libraries folder within your Arduino sketchbook folder.

Note

This library works fine with ESP32 core version 2.0.17, but in 3.x the I2S driver has been completely redesigned and refactored to use the new ESP-IDF driver, which deprecates some functions and causes issues such as clicking noises.

This is a simple sketch that demonstrates how to use the CYD_Audio library. It plays a specified audio file stored on the SD card.

CYD28_audio.[ch] defines helper functions for creating an instance of the CYD_Audio class on Core 1, making it easy to create a GUI loop that runs on Core 0.

This example creates a task named audioplay on core 0 with a predefined set of commands, and allows core 1 to send messages to it to control playback, volume adjustment, etc.

This sketch is an example of applying the CYD_Audio wrapper class named MP3Player to scan the audio files on the SD card, create a playlist, and control continuous playback in a set order.

CYD MP3 Music Player

This version features a rich LVGL GUI that allows you to play and manage audio files, add favorites, and shuffle playback.

The MP3Player class has been extended to meet the requirements of UI components.

Hardware modification

Although CYD has a speaker terminal, the sound quality is quite poor, so if you want to listen to music properly, you will need to improve the hardware.

Use Internal DAC and Onboard Amplifier

The circuitry around the onboard audio amplifier (SB8002B) requires to adjust the amplifier gain by changing the associated resistors.

ILI9341/ST7789 and amplifier IC SC8002B schematics

ILI9341 vs ST7789

The resistor settings around the SC8002B on the ST7789 type CYD are very different from those on the ILI9341, and the gain is too high, resulting in terribly poor sound quality.

The following links are good resources to help you solve this problem.

Alternatives to ST7789 type modification

By simply replacing two resistors, you can get almost the same output as the ILI9341 type with the following settings:

The resistor settings around the audio amplifier

Resister Before modification After modification
R7 0 Ω 0 Ω
R8 0 Ω 22 KΩ
R9 68 KΩ 15 KΩ

Use External DAC and Amplifier

The links below explain how to connect external DAC modules.

In this case, please define the symbol USE_I2S_DAC and each pin appropriately in audioTask() in CYD28_audio.cpp.

void audioTask(void *parameter)
{
    // if using the I2S mod, RGB led is removed, I2S pinout defined in platformio.ini file
#ifdef USE_I2S_DAC
    audio.begin();
    audio.setPinout(I2S_BCK_PIN, I2S_LRCLK_PIN, I2S_DIN_PIN);
#else
    audio.begin(true, I2S_DAC_CHANNEL_LEFT_EN);
#endif
...
}

where:

Symbol Value
I2S_BCK_PIN 4
I2S_LRCLK_PIN 22
I2S_DIN_PIN 27

Similar modifications can also be found at the following site:

Special Thanks

About

MP3 music player using internal DAC for Cheap Yellow Display

Resources

License

Stars

Watchers

Forks

Packages