Hey all, I was trying to put together a simple program to test max polyphony of various teensy platforms but I'm getting unexpected results, specifically just clicking noises

I've included my code, can anybody spot what the issue might be?

Thanks

Code:#include <Audio.h> #include <Wire.h> #include <SPI.h> #include <SD.h> #include <SerialFlash.h> #include "AdventureKid.h" #include "AcouPiano3_samples.h" void InitMixers(AudioMixer4 mixerArray[]); void InitWavetables(AudioSynthWavetable wavetableArray[], AudioSynthWavetable::instrument_data instDataArray[]); void SetDAC(float volume); void TestPolyphony(AudioSynthWavetable wavetableArray[], AudioSynthWavetable::instrument_data instDataArray[]); const int NUMMIXERS = 4; const int NUMWAVETABLES = 12; // GUItool: begin automatically generated code AudioSynthWavetable wavetable5; //xy=126,227 AudioSynthWavetable wavetable6; //xy=126,259 AudioSynthWavetable wavetable7; //xy=126,291 AudioSynthWavetable wavetable1; //xy=127,63 AudioSynthWavetable wavetable8; //xy=126,322 AudioSynthWavetable wavetable2; //xy=127,95 AudioSynthWavetable wavetable3; //xy=127,127 AudioSynthWavetable wavetable9; //xy=126,384 AudioSynthWavetable wavetable4; //xy=127,158 AudioSynthWavetable wavetable10; //xy=126,416 AudioSynthWavetable wavetable11; //xy=126,448 AudioSynthWavetable wavetable12; //xy=126,479 AudioSynthNoiseWhite noise1; //xy=140,550 AudioSynthNoiseWhite noise2; //xy=140,582 AudioSynthNoisePink pink1; //xy=140,613 AudioSynthNoisePink pink2; //xy=140,644 AudioMixer4 mixer2; //xy=286,273 AudioMixer4 mixer1; //xy=287,109 AudioMixer4 mixer3; //xy=286,430 AudioMixer4 mixer4; //xy=286,593 AudioMixer4 mixerOut; //xy=466,345 AudioOutputI2S i2s1; //xy=602,343 AudioConnection patchCord1(wavetable5, 0, mixer2, 0); AudioConnection patchCord2(wavetable6, 0, mixer2, 1); AudioConnection patchCord3(wavetable7, 0, mixer2, 2); AudioConnection patchCord4(wavetable1, 0, mixer1, 0); AudioConnection patchCord5(wavetable8, 0, mixer2, 3); AudioConnection patchCord6(wavetable2, 0, mixer1, 1); AudioConnection patchCord7(wavetable3, 0, mixer1, 2); AudioConnection patchCord8(wavetable9, 0, mixer3, 0); AudioConnection patchCord9(wavetable4, 0, mixer1, 3); AudioConnection patchCord10(wavetable10, 0, mixer3, 1); AudioConnection patchCord11(wavetable11, 0, mixer3, 2); AudioConnection patchCord12(wavetable12, 0, mixer3, 3); AudioConnection patchCord13(noise1, 0, mixer4, 0); AudioConnection patchCord14(noise2, 0, mixer4, 1); AudioConnection patchCord15(pink1, 0, mixer4, 2); AudioConnection patchCord16(pink2, 0, mixer4, 3); AudioConnection patchCord17(mixer2, 0, mixerOut, 1); AudioConnection patchCord18(mixer1, 0, mixerOut, 0); AudioConnection patchCord19(mixer3, 0, mixerOut, 2); AudioConnection patchCord20(mixer4, 0, mixerOut, 3); AudioConnection patchCord21(mixerOut, 0, i2s1, 0); AudioConnection patchCord22(mixerOut, 0, i2s1, 1); AudioControlSGTL5000 sgtl5000_1; //xy=519,461 // GUItool: end automatically generated code AudioMixer4 testMixerArray[] = {mixer1, mixer2, mixer3, mixer4}; AudioSynthWavetable testWavetableArray[] = {wavetable1, wavetable2, wavetable3, wavetable4, wavetable5, wavetable6, wavetable7, wavetable8, wavetable9, wavetable10, wavetable11, wavetable12}; AudioSynthWavetable::instrument_data adventureKid1[] = { AKWF_0001, AKWF_0002, AKWF_0003, AKWF_0004, AKWF_0005, AKWF_0006, AKWF_0007, AKWF_0008, AKWF_0009, AKWF_0010, AKWF_0011, AKWF_0012, AKWF_0013, AKWF_0014, AKWF_0015, AKWF_0016, AKWF_0017, AKWF_0018, AKWF_0020, AKWF_0021, AKWF_0022, AKWF_0023, AKWF_0024, AKWF_0025, AKWF_0026, AKWF_0027, AKWF_0028, AKWF_0029, AKWF_0030, AKWF_0031, AKWF_0032, AKWF_0033, AKWF_0034, AKWF_0035, AKWF_0036, AKWF_0037, AKWF_0038, AKWF_0039, AKWF_0040, AKWF_0041, AKWF_0042, AKWF_0043, AKWF_0044, AKWF_0045, AKWF_0046, AKWF_0047, AKWF_0048, AKWF_0049, AKWF_0050, AKWF_0051, AKWF_0052, AKWF_0053, AKWF_0054, AKWF_0055, AKWF_0056, AKWF_0057, AKWF_0058, AKWF_0059, AKWF_0060, AKWF_0061, AKWF_0062, AKWF_0063, AKWF_0064, AKWF_0065, AKWF_0066, AKWF_0067, AKWF_0068, AKWF_0069, AKWF_0070, AKWF_0071, AKWF_0072, AKWF_0073, AKWF_0074, AKWF_0075, AKWF_0076, AKWF_0077, AKWF_0078, AKWF_0079, AKWF_0080, AKWF_0081, AKWF_0082, AKWF_0083, AKWF_0084, AKWF_0085, AKWF_0086, AKWF_0087, AKWF_0088, AKWF_0089, AKWF_0090, AKWF_0091, AKWF_0092, AKWF_0093, AKWF_0094, AKWF_0095, AKWF_0096, AKWF_0097, AKWF_0098, AKWF_0099, AKWF_0100, AKWF_0102, AKWF_0103, AKWF_0104, AKWF_0105, AKWF_0106, AKWF_0107, AKWF_0108, AKWF_0109, AKWF_0110, AKWF_0111, AKWF_0112, AKWF_0113, AKWF_0114, AKWF_0115, AKWF_0116, AKWF_0117, AKWF_0118, AKWF_0119, AKWF_0120, AKWF_0121, AKWF_0122, AKWF_0123, AKWF_0124, AKWF_0125, AKWF_0126, AKWF_0127 }; void setup() { // put your setup code here, to run once: Serial.begin(115200); AudioMemory(128); SetDAC(1.0); InitMixers(testMixerArray); InitWavetables(testWavetableArray, adventureKid1); TestPolyphony(testWavetableArray, adventureKid1); } void loop() { // put your main code here, to run repeatedly: } void InitMixers(AudioMixer4 mixerArray[]) { for(int i = 0; i < NUMMIXERS; i++) { for(int j = 0; j < 4; j++) { mixerArray[i].gain(j, .25); } } for(int k = 0; k < 4; k++) { mixerOut.gain(k, .25); } } void InitWavetables(AudioSynthWavetable wavetableArray[], AudioSynthWavetable::instrument_data instDataArray[]) { for(int i = 0; i < NUMWAVETABLES; i++) { wavetableArray[i].setInstrument(instDataArray[4*i]); wavetableArray[i].amplitude(1); } } void SetDAC(float volume) { sgtl5000_1.enable(); sgtl5000_1.volume(volume); } void TestPolyphony(AudioSynthWavetable wavetableArray[], AudioSynthWavetable::instrument_data instDataArray[]) { for(int i = 0; i < NUMWAVETABLES; i++) { wavetableArray[i].playNote(60, 127); Serial.print((float)AudioProcessorUsage()); delay(500); } }