Unlimited sample buffers?

Hi folks!

I was looking through M8 Tracker specs, and noticed quite interesting line: “No sample memory or length limitation.”. M8 is based on Teensy, it has an SD card slot.

I wonder how this could be implemented. Does anyone have ideas?

I can imagine, that it might have a static ring buffer of some meaningful size, which then gets streamed to the file on SD card. Does this approach make sense? Is there any libraries or some code examples that implements this approach?

UPD: After some exploration and thinking, I wonder if it would be possible to stream the (input) samples straight into a SD card. according to http://elm-chan.org/fsw/ff/res/rwtest1.png, FatFS gives 30-1800kb/sec write speed. With 48k sample rate, we’d have 48ms between samples, which should be enough to stream 4 bytes (float) of data. Is my logic correct?

UPD2: Actually, it seems that some sort of buffer would be needed anyway. Seems like FatFS performs better with 4096byte chunks. So a 4-8kb(?) ringbuffer would be needed anyway.

Your last few updates are valid.

Streaming performance with the SD card can be very good especially when running at >=50MHz with 4 datalines. I’ve found the best performance to be with 16kB-32kB buffers, and have been able to do many voices of polyphony simultaneously.

Also, worth mentioning the profiling you l inked to was an ATmega running at 20MHz, and using SPI @10MHz for the SD Interface. This is much slower than what the Daisy is capable of :slight_smile:

Is there any example of playing samples that stream from SD card?