MP3 Local Music Player
Source code path: example/multimedia/audio/mp3_sd_player
Supported Platforms
sf32lb52-lchspi-ulp
Overview
This example will demonstrate playing MP3 or wav audio files in the music
directory on the SD card, and provides a shell interface for modifying playback volume.
Example Usage
Hardware Requirements
Before running this example, prepare:
A development board supported by this example (Supported Platforms).
Speaker.
Warning
Note that on the sf32lb52-lchspi-ulp
platform, an external battery is required, otherwise long button presses cannot be detected.
Compilation and Programming
Switch to the example project directory and run the scons command to execute compilation:
scons --board=sf32lb52-lchspi-ulp -j32
Switch to the example project/build_xx
directory and run uart_download.bat
, select the port as prompted for download:
$ ./uart_download.bat
Uart Download
please input the serial port num:5
For detailed steps on compilation and download, please refer to Quick Start.
Expected Results of Example
After the example runs, it will play MP3 or wav files in the music
directory on the SD card. After power-on, it is in stop playback state by default. When the music in the list finishes playing, it will automatically loop from the first song.
For the sf32lb52-lchspi-ulp
platform, long press the KEY1
button to start playback. Long pressing KEY1
during playback will stop playback, and the next start will begin from the first song. Short press KEY1
button to pause/resume playback, short press KEY2
button to switch to the next music.
The example also provides a shell interface. You can use the volume
command to get or set the volume. Enter the volume
command to view the current volume, enter volume set <value>
to set the volume, where <value>
ranges from 0-15.
Exception Diagnosis
Reference Documents
Update History
Version |
Date |
Release Notes |
---|---|---|
0.0.1 |
6/2025 |
Initial version |