Hi,
@Grumpy_mike
Thanks for the idea.
What you are telling about using parallel SRAM, is (for exemple) to link 20 pins from the arduino to the SRAM chip to use 1 M adresses, and connect 8 other pins to get 8 bit data?
So it would do 1 MByte data?
Did you already did that? I found someone who did this with a ttiny chip, but all was written in assembly code...
Is this this kind of chip ?
@ PaulS
Here is a piece of code from my blog, for a monophonic sampler with explainations :
For polyphonic samples read, I'm doing something like this (just an extract) :
#include <samplerl.h>
const int samplernumber = 4;
Samplerl samp[samplernumber];
const char* samplefile[]= {"kick1.wav", "hithat1.wav", "snare1.wav", "snare2.wav"};
void setup() {
for(int i=0; i<samplernumber; i++)
{
samp[i].init();
samp[i].load(samplefile[i]);
}
void loop() {
for(int i=0; i<samplernumber; i++)
{
if(samp[i].buffill()) i= 100;
}
}
void loop44kHz() {
int32_t ulOutput=2048;
for(int i=0; i<samplernumber; i++)
{
samp[i].next();
ulOutput += samp[i].output();
}
if(ulOutput>4095) ulOutput=4095;
if(ulOutput<0) ulOutput=0;
dacc_write_conversion_data(DACC_INTERFACE, ulOutput);
}
The library I've written is here, my problem is in the the sample.h file :
you can see this post too :
http://forum.arduino.cc/index.php?topic=167778.0
Here is the concept :
. I have a buffer. There are 2 occurences : One that is being played, and one that is loaded from the SD card.
The best performances I obtained was with a 512 Bytes buffer.
. I have a timer running at 44 kHz. Here I play the wave buffer.
. In the main loop, I load the occurence of the buffer that has been played
So when I play 4 samples at a time, my code is doing something like this :
loop() :
occurence 1 : load buffer1 sample 1
occurence 2 : load buffer1 sample 2
occurence 3 : load buffer1 sample 3
occurence 4 : load buffer1 sample 4
occurence 5 : load buffer2 sample 1
occurence 6 : load buffer2 sample 2
occurence 7 : load buffer2 sample 3
occurence 8 : load buffer2 sample 4
The time to read 512 bytes in SD card is around 1 ms.
So time elapse between the loading of buffer1 and 2 of sample 1 is around 4 ms.
With 44kHz 16 bits (2 bytes) audio, it takes 512/2/44000 seconds = 5,8 ms to read one buffer
So as soon as I add a fifth sample, I can't read enough fast the SD card to fill the buffers.
I use SdFatLib, and maybe there are problems with reading several files at a time.
So if I can find a memory faster than SPI SD card, I think I can read more samples at a time.