I am building a real time audio application using the Arduino DUE. This application needs big arrays like:
uint16_t sDelayBuffer0[46000];
The Due has only 96kb of RAM available so this array just ate up most ot its memory. The problem is i need more arrays like this...
So, i was thinking, instead of declaring all of the arrays as global variables, to declare them inside the timer interrupt functions.
The loop() handles stuff like reading the ADCs. The actual effects are coded inside timer iterrupt funciton that are replayed over and over. So the code constantly loops in loop() and the selected timer interrupt function.
But other timer interrupt fucntions use other arrays. So i was thinking to declare every array that a corresponding timer interrupt function wants inside that fucntion.
So all arrays are not declared at the same time (since when we exit the timer interrupt function we were on and head either to loop or another interrupt function, the grabage collector will destroy the array right?)
The problem with this theory, is that this is a real time audio application. So is it wise to constantly declare a big array like this? Since the timer interrupt ficntion will run very very often. Won't i have delay problems iwth the actual sound? Or variable declarations happen extremely fast inside the CPU, even for big arrays?