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.
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.
Could you use a signal at the audio-level that's not going to occur naturally?
A single sample at 1, for instance, that would be reproduced as a very-high-frequency click, for instance?
Chris
A single sample at 1, for instance, that would be reproduced as a very-high-frequency click, for instance?
Chris
Create a file with the word END or Your name.
make a summing copy summing your mp3 and this end file.
Detect this End and stop playback.
copy | Microsoft Docs
make a summing copy summing your mp3 and this end file.
Detect this End and stop playback.
copy | Microsoft Docs
- Status
- Not open for further replies.