AudioPlaySerialflashRaw and Multiple Flash Chips

Status
Not open for further replies.
Hi,
I am building a Drum Module and I have a large list of samples that I need to store on the Flash Memory. Since I already have a few S25FL512S available I am planning on using them but I would need about 3 or 4 chips to store all the samples. The problem I am facing is that the AudioPlaySerialflashRaw seems to only read from one Flash Chip, and not multiple. Is that correct or am I missing something here? If that is correct, would I have to modify the existing audio library to define multiple chips? In time, does any knows any other Flash Memory that could store at least 264Mbytes and that is "cost efficient"?
 
Drum samples are 2-3 seconds long and are continously accessed by the processor. I need at least a 12 sounds polyphony and I can achieve way more than that with a flash chip. A class 10 SD card is not fast enough to allow more than 4 samples to be played at the same time.
 
Ah. OK, looking at the Audio Board schematics I see that the serial flash is just a SPI device with its own CS. I don't see any reason, in theory, that you couldn't hang more devices off the SPI bus with individual CS outputs from the Teensy. You specify the CS pin in the call to the SerialFlash.begin() method.

It looks like the Audio Library code only uses the global SerialFlash object. Actually, I don't know if you can instantiate more. Obviously, you can't accesses multiple flash chips at the same time. So, I imagine that you'd need to group all the drum samples that you would want to play simultaneously all on the same chip. You'd specify that chip's CS in the call to begin(). You'd switch chips to other drum samples sets by calling begin() again with a new CS.

Caveat: all of the above conjecture is based only upon spending 10 minutes looking at the applicable code.
 
I need to do some further testing on a real practical situation but it only takes 10 microseconds to initialize the SerialFlash (SeriaFlash.begin()), so initializing the Flash chip everytime I'm playing a sample could work. Thanks.
 
Hi Chris,
I'm trying to do the same thing using a Teensy 4.1. I have two flash chips on the SPI bus, have copied raw files to both, can play from both separately, but my attempts so far at playing samples from both simultaneously have not worked. Just checking if you've had any luck?
All the best,
Alan
 
Hi Alan,

It didn't work for me. Initialisation of the flash chip is indeed quite fast, but it deinitialise the other chip in the process hence interrupting its playback. I ended up on keeping the teensy as just sending midi notes to a Raspberry pi which is the one responsible for playing the wav files.
 
Thanks Chris,
I'm using a Teensy 4.1, so there are three SPI busses available. I'll try with two flash chips on two busses and see if I can get that to work - I'll let you know if I've any success,
All the best,
Alan
 
Hi Chris,
I have it working with two flash chips using SPI (using pins 6 and 10 for chip selects), implemented in the simplest brute force way. To play raw files simultaneously from both, I've created two versions of SerialFlash.h and SerialFlash.cpp, two versions of SerialFlashChip.cpp and of SerialFlashDirectory.cpp, and two versions of play_serialflash_raw.h and play_serialflash_raw.cpp. I've just added "1" and "2" to the names of the files and the names of the objects - so play_serialflash_raw1, for example, defines AudioPlaySerialflashRaw1 and uses SerialFlash1, which in turn uses SerialFlashChip1 and SerialFlashDirectory1.

From the code, it's appears that using multiple chips shouldn't introduce any additional latency, and limited testing suggests that that is the case.

All the best,
Alan
 
Status
Not open for further replies.
Back
Top