Home Forums Sparkfun MP3 Shield Library Support Forum Skipping More than 65 Seconds Reply To: Skipping More than 65 Seconds

#3290

There are two issue here of concern.

1) the VS1053 device is a streaming device with only 2K of memory.

2) and more important the Arduino’s SDfat library does not give access to absolute file pointer, but only the offsets from current location. And it appears the SdFat Libary is limited to 32 bit math. Not sufficient for a pointer of 4G Sdcard limitation.

The skip function uses

track.seekCur((uint32_t(timecode/1000 * Mp3ReadWRAM(para_byteRate))

and the skipto uses

track.seekSet(((timecode * Mp3ReadWRAM(para_byteRate))/1000) + start_of_music)

both a seekSet and seekCur only accept a uint32_t

That said most MP3 files want jumps to and from boundaries of the packet frame data. Jumping to the middle of a frame can cause problems, with out the header it is bunch of garbage. Neither the Arduino or the VS1053 can hold the whole file in memory. Making it awkward, as to do it right one must read the VS1053 current frame status, it will return info as to the prior and next frames, as to be properly calculated. However, it turns out that the many different formats supported by the VS1053 each have there own unique format and method of handling this information. Hence the short cut of hard jumping the offset of bytes and muting a few milliseconds as not hear the garbage until a new frame occurs.

Sorry, due to the 32bit limitation jumping is the only method that comes to mind.

FYI – I have played 2G files and not sure how it works, but it can keep going. Likely the SdCard keeps track of the file pointer, being streamed into the SPI of the Arduino.

Note that SdFat Library caches 500 byte chunks. Hence it takes a bit of SRAM. And needs a bit of time to grab next 500. But other Interrupts will take precedence.