Need help going from Garageband Midi to Arduino Uno

And here is the code for it-

#include <MIDI.h>
int milliseconds;
int notesToShutOff[10];
int noteDurations[10];

void setup() {
 MIDI.begin(MIDI_CHANNEL_OMNI);    
 MIDI.setHandleNoteOn(HandleNoteOn);
 pinMode(2,OUTPUT);
 pinMode(3,OUTPUT);
 pinMode(4,OUTPUT);
 pinMode(5,OUTPUT);
 pinMode(6,OUTPUT);
 pinMode(7,OUTPUT);
 pinMode(8,OUTPUT);
 pinMode(9,OUTPUT);
 noteDurations[2] = 50; // bass
 noteDurations[3] = 10;
 noteDurations[4] = 10;
 noteDurations[5] = 40; // snare
 noteDurations[6] = 100; // nothing
 noteDurations[7] = 10;
 noteDurations[8] = 10;
 noteDurations[9] = 40;
 noteDurations[10] = 40;
}

void loop() {
 milliseconds = millis();
 MIDI.read();
 for(int x=2; x<=10; x++){
    if(notesToShutOff[x] + noteDurations[x] < milliseconds){
     analogWrite(x,0);
    }
 }
}

void HandleNoteOn(byte channel, byte note, byte velocity) {
 if(note >= 35 && note <= 44 && velocity > 0){
    //velocity = (velocity * 2);
    int myPin=note-33; // to get a pinnumber between 2 and 9
    analogWrite(myPin, 255);
    notesToShutOff[myPin] = milliseconds;
 }
}