import javax.sound.midi.*; public class Rada2{ static int toonika=40; static int kiirus=50; static Sequence sekvents; static Track td[]=new Track[3]; static int jd[]={0, 0, 0, 0, 1, 1, 0, 0, 2, 2, 1, 1, 0, 0, 0, 0}; //taktide duurid static int jnr=0; //takti järjekorranumber static void looKolmkola(Track t, int toonika){ try{ ShortMessage m[]=new ShortMessage[16]; for(int i=0; i0)?jnr-1:jd.length-1], false); sequencer.setTrackSolo(jd[jnr++], true); if(jnr>=jd.length)jnr=0; } }catch(Exception e){ e.printStackTrace(); } } } ); sequencer.setSequence(sekvents); sequencer.start(); sequencer.setTempoInBPM(kiirus); sequencer.setTrackSolo(jd[jnr++], true); } }