Hi again,

i have built a Midi-In-Port and connected to my teensy 3.6.
The Midi-In Port is connected to the Midi-Out Port of my e-drum-module.

Every time a pad gets hit, the edrum module sends a midi note (e.g. Note 36 for kick drum, Note 38 for Snaredrum).

What i want the teensy to do:
For every midi note which is received a sample shall be played.
If e.g. Midi Note 36 is received, the sample 36.WAV shall be played.

The Problem:
If the drummer hits multiple Drum pads, multiple Midi notes are sent.
This means that multiple samples have to be played simultaneously.

What i already know is that i have to create multiple instances of AudioPlaySDWav and code something like this:

Code:
AudioPlaySdWav           playSdWav1;
AudioPlaySdWav           playSdWav2;
AudioPlaySdWav           playSdWav3;
AudioPlaySdWav           playSdWav4;
AudioOutputI2S           i2s1;
AudioConnection          patchCord1(playSdWav1, 0, i2s1, 0);
AudioConnection          patchCord2(playSdWav1, 1, i2s1, 1);
AudioConnection          patchCord3(playSdWav2, 0, i2s1, 0);
AudioConnection          patchCord4(playSdWav2, 1, i2s1, 1);
AudioConnection          patchCord5(playSdWav3, 0, i2s1, 0);
AudioConnection          patchCord6(playSdWav3, 1, i2s1, 1);
AudioConnection          patchCord7(playSdWav4, 0, i2s1, 0);
AudioConnection          patchCord8(playSdWav4, 1, i2s1, 1);
AudioControlSGTL5000     sgtl5000_1;
and this (i have left out the MIDI-Code part)

Code:
          char wavname[16] = {'\0'}; //16 characters in the filename (or however long you want to make it)
          sprintf(wavname,"%d.WAV",note);
          if (playSdWav1.isPlaying() == false) {
            playSdWav1.play(wavname);
          } else if (playSdWav2.isPlaying() == false) {
            playSdWav2.play(wavname);
          } else if (playSdWav3.isPlaying() == false) {
            playSdWav3.play(wavname);
          } else {
            playSdWav4.play(wavname);
          }
But what if the drummer hits 5 Cymbals in series?
So the question is: Is there a smarter way to play polyphone samples?

Every help is appreciated.

Best regards
Daniel