             }*/
           if ((i + 12 * j) % 2 == 0) {
             if (keyState[i + 12 * j + 1] == 1) {
-              midiSend(noteOn, keyMidi[i + 12 * j], getVelocity((i + 12 * j) / 2));
+              noteOn(keyboardChannel, keyMidi[i + 12 * j], getVelocity((i + 12 * j) / 2));
             } else {
               updateVelocity((i + 12 * j) / 2, (byte)1);
             }
           } else {
             if (keyState[i + 12 * j - 1] == 1) {
-              midiSend(noteOn, keyMidi[i + 12 * j], getVelocity((i + 12 * j) / 2));
+              noteOn(keyboardChannel, keyMidi[i + 12 * j], getVelocity((i + 12 * j) / 2));
             }
             else {
               updateVelocity((i + 12 * j) / 2, (byte)1);

        tempVelocity = 127;
      }
    }
    /*Serial.println("Velocity 2");
      Serial.print(tempVelocity, DEC);
      Serial.print(" ");
      Serial.println("Time 2");
      Serial.println(abs(millis()-noteTime[pPos]), DEC);
      Serial.println("Pos 2");
      Serial.println(pPos, DEC);
      delay(10);*/
    return tempVelocity;
  }
}

static const byte outClkPin = 12;
static const byte latchPin = 10;
//If a Analog mux is added, just connect the control pins in parallel and add the En pin to the list.
static const byte muxEn [] = {5};

//Constants
byte mask[] = { B00000001, B00000010, B00000100, B00001000, B00010000, B00100000, B01000000, B10000000 };//To read the columns values
static const byte  keyMidiCons[144] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
