@Override
	public String toString() {
		String trackInfo = "";

		for (int i = 0; i < track.size(); i++) {
			MidiEvent e = track.get(i);
			MidiMessage msg = e.getMessage();
			String msgString = "";

			if (msg instanceof javax.sound.midi.ShortMessage) {
				ShortMessage smg = ((ShortMessage) msg);
				int command = smg.getCommand();
				String commandType = "UnknownCommand";

				// determine the type of the command in this message
				if (command == ShortMessage.NOTE_OFF) {
					commandType = "NOTE_OFF";
				} else if (command == ShortMessage.NOTE_ON) {
					commandType = "NOTE_ON ";
				}

				msgString = "Event: " + commandType + " Pitch: "
				        + smg.getData1() + " ";
			} else {
				msgString = "***** End of track *****  ";
			}

			trackInfo = trackInfo + msgString + " Tick: " + e.getTick() + "\n";
		}

		return trackInfo;
	}