Hi there,
I'm working in a 8 track sequencer, using Teensy 4 (which is amazing btw) The project uses a few big arrays (64 patterns with 8 tracks and 64 steps each) and I have arrays for the patterns itself, probability, velocity, play mode... but I'm facing some weird problems because I want to make it to play audio, apart of the midi & trigger outs.
For the leds I'm using WS2812Serial.h which has no glitches when using audio like other WS2812 libraries.
So actually has 8 basic drum synths, a noise generator connected to 8 envelopes, 8 filters and about 16 mixers to put all this together, the thing is that some stuff just stop working, like the code for saving the projects to the SD card needs to be disabled or the machine gets stuck on start up (loading presets works btw), every time I add other audio object, even if it's not connected to anything, something happens like a drum synth stops working, first 2 tracks start to play backwards...
Tried with the SdFat library but it does not work if the Audio library is there.
I've been measuring the audio memory and it was not too big (about 30 if I remember well, and I have set 100) so that shouldn't be the problem.
the statics when compiling are:
RAM: 32.2% (used 168628 bytes from 524288 bytes)
Flash: 3.5% (used 71184 bytes from 2031616 bytes)
the code is about 2500 lines so posting here may be not convenient,
this is the part that saves the project to a SD card, maybe someone can tell me a better way to do this (my coding skills are pretty limited indeed):
Code:
void saveAll()
{
  File dataFile;

  SD.remove("val.dat");
  dataFile = SD.open("val.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&val, sizeof(val));
  dataFile.close();

  SD.remove("prob.dat");
  dataFile = SD.open("prob.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&prob, sizeof(prob));
  dataFile.close();

  SD.remove("steps.dat");
  dataFile = SD.open("steps.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&steps, sizeof(steps));
  dataFile.close();

  SD.remove("pMode.dat");
  dataFile = SD.open("pMode.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&pMode, sizeof(pMode));
  dataFile.close();

  SD.remove("clockDiv.dat");
  dataFile = SD.open("clockDiv.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&clockDiv, sizeof(clockDiv));
  dataFile.close();

  SD.remove("euclNum.dat");
  dataFile = SD.open("euclNum.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&euclNum, sizeof(euclNum));
  dataFile.close();

  SD.remove("dot.dat");
  dataFile = SD.open("dot.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&dot, sizeof(dot));
  dataFile.close();

  SD.remove("roll.dat");
  dataFile = SD.open("roll.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&roll, sizeof(roll));
  dataFile.close();

  SD.remove("midiNote.dat");
  dataFile = SD.open("midiNote.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&midiNote, sizeof(midiNote));
  dataFile.close();

  SD.remove("menuVar.dat");
  dataFile = SD.open("menuVar.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&menuVar, sizeof(menuVar));
  dataFile.close();

  SD.remove("noInitPatt.dat");
  dataFile = SD.open("noInitPatt.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&noInitPatt, sizeof(noInitPatt));
  dataFile.close();

  SD.remove("raw.dat");
  dataFile = SD.open("raw.dat", FILE_WRITE);
  dataFile.write((uint8_t *)&raw, sizeof(raw));
  dataFile.close();
}
and if some one has a clue, would like to know:
-is there a limit for the audio objects in a project?
-would help to allocate some of the bigger arrays maybe in the program memory to save some ram?
-could the 'save' function be done in a better way(so it does not create any conflict)?
thanks a lot in advance