Hello again! So I've built MIDI synthesizer on the teensy 4.0, but I am experiencing a problem. I've used the USBHost_t36.h library to bind functions to note on and off MIDI signals, which works perfectly fine. However, if I press many keys at once, the sound becomes increasingly distorted. In the function playing the note, I am using waveforms[index].begin(velocity, freq, type) followed by envelopes[index].noteOn().
the waveforms is an array of 128 AudioSynthWaveform and envelopes is 128 AudioEffectEnvelope.
I hope somebody can tell me what causes the distortion, and if it is possible to fix it.
Thanks in advance.

-Fred