Using libmad to decode the mp3 file.
Based on the 20_pwm_sound example.
- Adjust the API_PATH of the Makefile according to your needs.
- You must compile the Ultibo API project.
- Copy the
test.mp3file to the micro SD.
Note: You can use another mp3 file, but be sure to change the name within the program. The mp3 file has been downloaded from this site.
- With the test.mp3 file, it reads it, decodes it, and obtains relevant information.
- Gets the duration of the song in hh:mm:ss.
- It is then played back via PWM with the output of the jack.
On screen displays:
The file size of test.mp3 is: 2105160 bytes
Read MP3 File OK
Decoding the mp3 file..
Duration: 00:02:11
Bitrate: 128000 bps
Number channels: 2
Sample Rate: 44100 hz
- Information MAD: MPEG Audio Decoder
- Official forum and solution to doubts from Forum Ultibo.
- Ultibo API examples and information Ultibo API.