VSMD001 - Read an auxiliary file

Writing software that controls the system and peripherals such as displays, SD cards, Buttons, LEDs, Serial Ports etc.
Post Reply
User avatar
Posts: 9
Joined: Mon 2015-06-29 19:10
Location: Buenos Aires, Argentina

VSMD001 - Read an auxiliary file

Post by vegasys » Tue 2020-01-07 20:26

Dear staff:

I am working with the VS1000 audio module and, in addition to playing audio, I need to read a binary file synchronized with it.
The concept is, for example: while playing 001.OGG, every 10 ms reads sequentially a byte of 001.BIN and put it on GPIO0. With 002.OGG, read 002.BIN and so on.
I have made an interrupt with timer1, which is triggered every 10 ms and I set a random value in GPIO0 (just to test). I used UartLoadCheck to fix the frequency and everything works fine and stable even during playback.

Is there any way to do this? It would be great to do it without adding a microcontroller (which is my last resource). I just need to know how to read the file. The composition of the names (nnn.OGG and nnn.BIN) can be done by me. I also need to know how to "close" the file when playback ends.

Thanks for your constant support.
Last edited by vegasys on Thu 2020-01-09 18:24, edited 1 time in total.
Before you begin, you didn't know either :oops:

User avatar
VLSI Staff
Posts: 1767
Joined: Thu 2010-07-15 16:04

Re: VSMD001 - Read an auxiliary file

Post by pasi » Wed 2020-01-08 11:17

VS1000 can have only one file "open" at a time. The second file you would need to read outside of the filesystem routines.

If you assume non-fragmented files, you would:
1) FileOpen() the side-information file, read and save minifatFragments[0].start (and optionally size). Read a sector with ReadDiskSector.
2) Install your own idle hook handler. Open and start playing the audio file.
3) In the idle hook handler check if you need to read more data. You will probably need two sector-fulls of data stored. If you don't have space for that amount, you can use minifatBuffer[] as a temporary read buffer, as long as you set minifatInfo.currentSector = -1; afterwards.

The VLSI Audio Book example has some code that reads side information - it reads and shows menu lines during audio playback.
http://www.vlsi.fi/en/support/software/ ... tions.html
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

Post Reply