MP3 music player for Cheap Yellow Display
CYD_Audio is an ESP32 I2S audio library by Piotr Zapart, written for PlatformIO.
The version included here has been modified for Arduino IDE so that it can be installed into the libraries folder in your Arduino sketchbook folder.
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.
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.
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.
The circuitry around the onboard audio amplifier (SB8002B) requires to adjust the amplifier gain by changing the associated resistors.
The following links are good resources to help you solve this problem.
- Audio amp gain mod - ESP32-2432S028 aka Cheap Yellow Display example project.
- ESP32-2432S028 aka Cheap Yellow Display - fixing the audio issues - YouTube
Even when I changed the resistors of ST7789 to the same as ILI9341, the high frequencies were crushed and the sound became rough, making it unsuitable for listening to the music, so I ended up doing the following:
Replace resistors R8 and R9
| Resister | Before modification | After modification |
|---|---|---|
| R7 | 0 Ω | 0 Ω |
| R8 | 0 Ω | 22 KΩ |
| R9 | 68 KΩ | 10 KΩ |
The results show that the audio amplifier IC SC8002B is not suitable for music playback.
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
...
}- ESP32 I2S audio library by hexeguitar/ESP32_TFT_PIO (MIT license).




