Finding the end of an mp3 file

Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.
I have designed and built an audio system for mobile robots that allow them to vocalize recorded speech. It is a simple system that uses mp3 files on flash memory that are spit out to a VLSI VS1063 encoder/decoder IC. The control for the system is done by an 8 bit microcontroller. Note that the files are stored on the flash linearly via SPI and there is no file system (FAT32) used.


When a file is played, I detect the end of the file by keeping track of the number of bytes of data in the file and stopping the playback when I reach that number. This requires me to keep audio file length in memory, which is cumbersome.



It would be better to play the file until I reach an end of file marker and then terminate playback, but, mp3 does not have an end of file marker. It just has a series of frames. The end of the file is the end of the frames. However, the way I store them on the flash, one file follows another (with some empty bytes between), and I need a good way to tell I have reached the end of the file I am playing so I don't just run on into the next one.



I am looking for suggestions on a better way to identify the end of a particular mp3 file. I suppose I could look for a sequence of empty bytes, but maybe there is a better way. Any thoughts on this? Surely other developers face this problem.
 
Status
This old topic is closed. If you want to reopen this topic, contact a moderator using the "Report Post" button.