Home › Forums › Sparkfun MP3 Shield Library Support Forum › Play .wav file › Reply To: Play .wav file
Yes, it can decode a wave file. Please see the FilePlayer.ino example. it is more flexible in allowing file formats to be played.
There are various delays through out the code. First in the examples there are delays in processing serial commands. Then within the library code itself. 100ms to start playing inside playMP3() at line SFEMP3Shield.cpp:836 . It is possible to remove this. But that will then affect the skip’s ability to keep track of where to skip to. With in the skips themselves there are 50ms inside the skip() SFEMP3Shield.cpp:1063 similar skipto() SFEMP3Shield.cpp:1120 as to mute the begin playing of partial packets. As the skip features are not packet aligned. Where these may be small delays totalling of only 150ms.
Finally, the flush_cancel() experiences a delay. When stopping the play to either cancel or skip the VS1053’s 2K buffer needs to be halted and then flushed. as to prevent unwanted sounds, from finishing or playing at the next play. And depending upon the bit rate it can take a noticeable time to fill and wait for the 2K buffer to empty. Where I see the Stop and Skip’s can have enum flush_m passed into to SFEMP3Shield::flush_cancel(flush_m mode) them as to influence the flush to be one of: post, pre, both or none. You may want to experiment with altering the calls in the SFEMP3Shield::skip(int32_t timecode) line flush_cancel(pre); and simularly SFEMP3Shield::skipto(int32_t timecode) line flush_cancel(pre); Additionally there is a flush when the end of the file is reached.
I would recommend playing with the above parameters passed into the desired flush_cancel calls, to see if you can get a quicker and acceptable behavior.