Playing back longer wave-files on the fez panda 2


I want to integrate sound and light in a plastic model i am building and thought i could use my fez panda 2 for this. Basically there need to be some leds set (brightness, fading), a servo needs to be controlled and wave files of up to 20secs should be played - and all synchronously. I already tried out that wave-playback example but found out that playing back wav files of more that 2secs (8bit, 8khz) is not possible due to the limited ram of the cpu. So i tried out some other methods to play back longer wave-files, with unsatisfying results:

  • directly reading out the separate samples as bytes from the sd-card without buffering via filestream
    => playback too slow (caused by slow filestream implementation?)

  • splitting up the wav-file into smaller chunks and playing them back one after another (with loading from sd-card in between)
    => hearable intermissions between the chunks

My next approaches would be to add some additional ram to the board to enlarge the physical buffer size (is this possible in the form of sram-chips?) or to use some kind of threaded double-buffering, but im not sure how complicated the latter would become. In addition, at a later stage the three outputs (led-brightness, servo-position, wave-playback) should be synchronous. The quality of 8bit, 8khz itself is actually ok for that application.

Maybe you have some more helping ideas or resources what i could do to play back longer wave-files.


Welcome to the forum!

Have you considered using music shield?

Yes, i did already take a look at the music shield but am a bit unsure if it is not a bit oversized for the application as i do not need to play back other codecs than wav-pcm (though this option sounds interesting). On the description page it says that its also compatible to the standard arduino? What exactly does it do? Is it completely reading out the entire wav-sample from the sd-card of fez panda and then playing it back on its own or is it also buffering parts of the wav and then playing them back stepwise? How much does the shield discharge the fez pandas cpu?

The shield can be pluged-in into arduino. You control the shield using SPI interface. It does have a buffer and is very easy to work with. There is a code available, check it out.

I pointed him to that shield too while chatting in the chatroom.
It costs a few dollars, but it has most stuff implemented.

The negative is that he wanted to show some effects with leds, which would do some blinking on sync with the analog audio. I don’t think this is possible with the music shield.

This can be achieved with RLP. I did streaming audio on the cobra that way. If you want the source code you can cohtact me on