import javax.sound.midi.*; import javax.swing.*; import java.awt.event.*; public class Noodirakend3 extends JApplet implements ActionListener{ public void init(){ JButton b=new JButton("Mängi"); getContentPane().add(b); b.addActionListener(this); } public void actionPerformed(ActionEvent e){ try{ Synthesizer synthesizer=MidiSystem.getSynthesizer(); synthesizer.open(); MidiChannel kanal=synthesizer.getChannels()[0]; //kanal 0; kanal.noteOn(60, 70); kanal.noteOn(64, 70); for(int korgus=16383; korgus>0; korgus-=500){ Thread.sleep(200); kanal.setPitchBend(korgus); } kanal.allNotesOff(); synthesizer.close(); }catch(Exception ex){ ex.printStackTrace(); } } }