MP3 player without external hardware ... ready

26 Nov 2010 . Edited: 26 Nov 2010

For the guys that were interested in my last post. I published the code here: madplayer

This is a port of the libmad library. It is modified to use part of the AHB RAM because the available standard RAM is too small. The demo program plays a fixed file from an USB drive, output goes to AnalogOut, one channel only at the moment.

Documentation is in the code.

Have fun


Edited: removed the last compiler warning...

26 Nov 2010

Thanks you

26 Nov 2010

Great job!. I modify the output to PWM , with the standar clock is 25khz an 12 bits, but is ready for stereo. I can´t . Is the size of free RAM  enough for double buffer?. The sound´s quality is near DAC and direct to amplifier.


26 Nov 2010

Good work man.

27 Nov 2010

Posted a new version, that moves more memory to AHB RAM. Now there is space for stereo buffer, demo in main.cpp

29 Nov 2010

I´m waiting for the stereo version. I modified your code and for PWM in stereo without problems . The next level would be a SPI or I2C DAC for 16bits . Now is only 12bits.

Thanks for all

16 Dec 2010

Friends, I'm starting now with the MBED. Outside the module MBED what else might be needed? as I connect this additional RAM? what kind would it be? Could someone provide the schematic of this additional part?

Thanks to all

16 Dec 2010

@Jairo: when starting with a new platform it is a good idea to go through the manuals to get familiar with the concepts, like AHB RAM. This website has very good tutorials for getting started, e.g. with the online compiler and how to import programs. Andreas

07 Jan 2011


18 May 2011

Hi Andreas,

Could you please advise how to: 1) start madplayer at desired frame-number or time 2) stop madplayer with external signal(GPIO line) and get the current frame or time

Regards, Nikos

24 May 2011

Hi Andreas,

I tried your Madlib project and it works out of the box. It was easy to add an WM8762 on the I2S interface to get stereo output at headphone level.

Thanks for doing the difficult part, regards, Jeroen.

07 Jun 2011

Hi Andreas!

I am porting libmad to LPC1768, but in another IDE (IAR). I am having troubles when sharing the RAM memory with stack and heap sections. Could you tell us how you dealed with it? Thanks, Marcel

08 Jun 2011

Hi Marcel,

I've been looking into this project also. In decoder.cpp, the original code is adapted to:

  decoder->sync = (struct mad_sync_s *)malloc(sizeof(*decoder->sync));
#if defined(TARGET_LPC1768)  
  decoder->sync->synth = (struct mad_synth *)mad_malloc(sizeof(struct mad_synth));
  decoder->sync->synth = (struct mad_synth *)malloc(sizeof(struct mad_synth));

The implementation of mad_malloc is in lpc1768_mem.cpp; it uses the 16kb ethernet block.

I hope this helps you.

23 Nov 2011

hey thank you so much for this!! just a simple question..what is the size of your ram? also, is it possible to make the volume of the sound increasing gradually? thanks a lot :)