code: public MidiEvent[] getMidiEventsFor(MultiNote notes, KeySignature key, long elapsedTime) throws InvalidMidiDataException
    {
      Vector notesVector = notes.getNotesAsVector();
      MidiEvent[] events = new MidiEvent[2*notesVector.size()+1];
      for (int j=0; j<notesVector.size(); j++)
      {
        Note note = (Note)(notesVector.elementAt(j));
        float noteLength = getNoteLengthInTicks(note);//, defaultLength);
        if (!note.isRest())
        {
          ShortMessage myNoteOn = new ShortMessage();
          myNoteOn.setMessage(ShortMessage.NOTE_ON, getMidiNoteNumber(note, key), 50);
          events[j] = new MidiEvent(myNoteOn,elapsedTime);
        }
      }
  
      events[notesVector.size()] = new MidiEvent(new NotationMarkerMessage((MultiNote)notes), elapsedTime);
  
      for (int j=0; j<notesVector.size(); j++)
      {
        Note note = (Note)(notesVector.elementAt(j));
        long noteLength = getNoteLengthInTicks(note);//, defaultLength);
        if (!note.isRest())
        {
          ShortMessage myNoteOff = new ShortMessage();
          myNoteOff.setMessage(ShortMessage.NOTE_OFF , getMidiNoteNumber(note, key), 50);
          events[notesVector.size()+j+1] = new MidiEvent(myNoteOff,elapsedTime+noteLength);
        }
      }
      return events;
    }
docs: Returns the corresponding midi events for a multi note.