public void ExportToMidi(File filename) {
		AtomicBoolean[][] temp;
		synchronized(_matrix) {
			temp = _matrix.clone();
		}
		MidiFile mf = new MidiFile(_tempo.get());
		mf.progChange(this.getInstrument().getSynthNum());
		
		for (int i = 0;i<COLS;i++) {
			int counter = 0;
			for (int j=0;j<ROWS;j++) {
				if (temp[j][i].get()) {
					mf.noteOn(0, _player.convertPitch(j), this.getVolume());
				}
			}
			for (int j=0;j<ROWS;j++) {
				if (temp[j][i].get()) {
					if (counter==0) {
						mf.noteOff(MidiFile.QUAVER, _player.convertPitch(j));
						counter++;
					}
					else {
						mf.noteOff(0, _player.convertPitch(j));
						counter++;
					}
				}
			}
			if (counter==0) {
				mf.noteOnOffNow(MidiFile.QUAVER, -1, 0);
			}
		}
		//mf.noteOnOffNow(MidiFile.QUAVER, -1, 0);
		try {
			mf.writeToFile(filename);
		}
		catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}