Wow, interesting that you can get up to 44.1kHz... I guess you might be able to do a bit better by manually setting up the SD card and increasing the SPI bitrate...
But yes, there's quite a lot of overhead in dealing with the SD card. It has to read 512 byte sectors (I think), but also it has to find out where they are in the FAT table...
I don't believe the time taken to fill the buffer is a staircase, but depending on how your code is written you'll be balancing the time taken to read the buffer from flash (plus a possible delay in execution) against the time taken to output it.
Would you be willing to post your code for dealing with Waveform from flash? The example code for filling it from SPI actually cheats a bit - it keeps three buffers - the two from the waveform, plus a third from the filesystem. When the callback executes, it immediately updates the Waveform's buffer to avoid delay, and then refills the third buffer from the filesystem.
If you did similar with the SPI flash code, you might be able to push it a bit more?
© Espruino, powered by microcosm.
Report a problem