//Kokkupandud lugu import javax.media.sound.midi.*; public class K3a{ public static void main(String argumendid[]) throws Exception{ Track track=new Track(); ShortEvent sev=new ShortEvent(); sev.setMessage(192, 0, 65, 0); //raja algus track.add(sev); sev=new ShortEvent(); sev.setMessage(144, 43, 65, 1); //144 - noodi algus track.add(sev); sev=new ShortEvent(); sev.setMessage(128, 43, 65, 50); //128 - noodi ots track.add(sev); Sequence sc=new Sequence(Sequence.PPQ, 10); System.out.println(sc.getDuration()+" "+sc.getLength()); sc.add(track); System.out.println(sc.getDuration()+" "+sc.getLength()); Sequencer seq=MidiSystem.getSequencer(null); seq.open(); seq.setSequence(sc); Synthesizer synthesizer=MidiSystem.getSynthesizer(null); synthesizer.open(); seq.addOutReceiver(synthesizer); seq.start(); } }