public static TIntList parseTimewise(byte[] rawmidi, int fileNumber) throws Exception {
		TIntList list = new TIntArrayList();

		TreeMultimap<Long, Integer> out = TreeMultimap.create();
		InputStream is = new ByteArrayInputStream(rawmidi);
		
		Sequence sequence = MidiSystem.getSequence(is);
		
//		File output = new File("txt/outputTimewise" + fileNumber + ".txt");

		long trackNumber = 0;

		int key = 0;
		long time = 0;
//		Files.write("",output,Charsets.UTF_8);
		
		for (Track track : sequence.getTracks()) {
			trackNumber++;
			//Files.append("Track: "+trackNumber+ "\r\n",output,Charsets.UTF_8); // write track number
			for (int i = 0; i < track.size(); i++) { 
				MidiEvent event = track.get(i);
				MidiMessage message = event.getMessage();
				if (message instanceof ShortMessage) {
					ShortMessage sm = (ShortMessage) message;

					if (sm.getCommand() == NOTE_ON) {
						key = sm.getData1();
						int velocity = sm.getData2();
						if (key > 0 && velocity > 0) {
							time = event.getTick();
							out.put(time, key);
							list.add(key);

						}
						
					}

				}
			}

		}
		//write results to file
//		Set<Map.Entry<Long, Integer>> entries = out.entries();
//		Iterator<Map.Entry<Long, Integer>> it = entries.iterator();
//		while (it.hasNext()) {
//			Map.Entry<Long ,Integer> next = it.next();
//			Files.append(next.getValue() + " ", output, Charsets.UTF_8);
//		}
		is.close();
		return list;
	}