Playing a wav file using a vs1053b (Sparkfun MP3 shield)


I recently picked up the Sparkfun MP3 sheild (SparkFun MP3 Player Shield - DEV-12660 - SparkFun Electronics), which contains a microSD slot and a vs1053b audio chip.

I've tried the code on the sparkfun website (, and it works just fine. I also tried Bill Porters libraries (Sparkfun MP3 Shield Arduino Library « The Mind of Bill Porter) but they do not seem to work with the newest version of the Arduino development environment (1.01).

So the MP3s play fine; but what I really need to do is play a wave file. As I understand it, as the MP3 file decodes, it needs a small chunk of data before and after the current play point. As such, it must read in a bit of data before it can play the sound. This creates a small lag between when you tell the SD card to start sending data, and when the sound comes out (I've measured it at 20ms). With a wav file, I'm hoping the lag time will be much less (hopefully around 1ms or smaller).

After combing the vs1053b manual and trying to understand the code, it seems to me if I send a wav file, the information should be available in the header and the vs1053b should decode it. Unfortunately, this does not seem to be working. Nothing seems to happen when I play a wav file instead of an MP3.

I should note that if I send in a wma file (using the example code from Sparkfun above) it works fine (I have not measured the output delay yet). However if I try to send through any other supported file (wav, aif) nothing comes out.

Has anyone had any luck with this? Are there any vs1053b experts out there who can help me understand what the problem is?

Thanks in advance for any input you can provide!

The web site says:-

The VS1053 is also capable of decoding Ogg Vorbis/MP3/AAC/WMA/MIDI audio and encoding IMA ADPCM and user-loadable Ogg Vorbis.

I didn't see it say wav file.

From the VLSI website (and the vs1053b data sheet): VLSI Solution-VS1053 - Ogg Vorbis / MP3 / AAC / WMA / FLAC / MIDI Audio Decoder / Encoder Chip

Decodes multiple formats

  • Ogg Vorbis*
  • MP3 = MPEG 1 & 2 audio layer III (CBR+VBR+ABR)*
  • MP1 & MP2 = MPEG 1 & 2 audio layers I & II optional*
  • MPEG4 / 2 AAC-LC(+PNS), HE-AAC v2 (Level 3) (SBR + PS)*
  • WMA4.0/4.1/7/8/9 all profiles (5-384 kbps)*
  • FLAC lossless audio with software plugin (upto 24 bits, 48 kHz)*
  • General MIDI 1 / SP-MIDI format 0*

There is a fair bit of data about the PCM decoding on the data sheet. Ive tried my best to impliment it, but it just doesnt seem to work.

Yes I know the data sheet says that but it is not a claim made for the product when you bought it.

Well, as far as I can tell the people at Sparkfun have soldered a vs1053b chip and a SD card onto a shield with necessary electronics. While sparkfun itself does not say the product supports wav, I`m pretty sure it should be possible as the vs1053b data sheet should trump the sparkfun description.

I have zero experience with the VS1053b (MP3 shield) from

I 'can' comment a bit on the .wav side of things..

using the WaveShield form Adafruit..and (so far) the stock libraries & several demos out there..

you DO NOT get a seamless loop ..and there IS a noticeable lag between playing FILE to FILE.. as well as looping the same file over and over.

here IS a noticeable lag between playing FILE to FILE.. as well as looping the same file over and over.

Hmmm...I wonder what would be a suitable solution for playing a wav file with no delay. It seems to me the vs1053 should be able to handle it. I'm not sure about the adafruit player (I didn't order that because of its low sample rate and mono only output), but I wonder if there are any good audio expansion boards that will play sound instantly (or within a ms or 2).

If anyone has any experience with any other boards, please feel free to make a sugestion!


you would have to look at the libraries/code in each example..

it was suggested that seamless looping/playing might be possible by breaking up the playComplete() & playFile() functions.etc.. (but I didnt see any quick difference.. unless I need to be looking in the .h/.cpp files...etc

I'm also trying to do looped sounds from a SD Card. So far this new library did the trick with no lag.

But so far only 8-bit stereo or 16-bit mono support. But it works. There's a small gap that could be avoided with some new code, but I haven't done the hack yet, was hoping the library author would help us out. :wink:

yeah I saw his thread, cool!.

but the OP asked about .wav files.. (not sure if they care about having to convert first)

also, my comment was about the 'waveshield' (or custom version) ,..using the WaveHC library.. and its lag..and ow to overcome it..

Im fairly new to C the library doesnt make much sense to me atm.

I was wondering about another idea, to use 2 x mp3 chips (vs1053b or whatever) to flip-flip the loop sound. If the latency is fixed (predictable) one could them just fire up the sound again on the second chip when the first chip position+gap >= size. Something like that. Would that work? Is the latency always the same for starting up a sound?