public void run() {

		try {
			Synthesizer synthesizer = MidiSystem.getSynthesizer();
			synthesizer.open();
			MidiChannel channel = synthesizer.getChannels()[0];

			while (true) {

				if (play == true) {
					channel.programChange(instType);
					channel.noteOn(pitch, velocity);
					pause = 350;
					play = false;
				}
				try {
					Thread.sleep(pause);
				} catch (InterruptedException e) {
				} finally {
					channel.noteOff(pitch);
				}
				pause = 0;
			}
		} catch (MidiUnavailableException e) {
			e.printStackTrace();
		}
	}