import javax.sound.sampled.*; import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class heli440 extends Applet implements MouseMotionListener, Runnable{ Button nupp=new Button("Piiksu"); int kandesagedus =10000; byte[] andmed=new byte[kandesagedus/4]; //5 sekundit int korgus=800; SourceDataLine line; public heli440(){ setLayout(new BorderLayout()); addMouseMotionListener(this); try{ AudioFormat formaat = new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, kandesagedus, 8, 1, 1, kandesagedus, false); //8bitine heli, 1, kanal, 1 bait raami kohta line = (SourceDataLine) AudioSystem.getLine( new DataLine.Info(SourceDataLine.class, formaat, AudioSystem.NOT_SPECIFIED) ); line.open(formaat); line.start(); }catch(Exception viga){viga.printStackTrace();} koostaAndmed(); new Thread(this).start(); } void koostaAndmed(){ int sagedus=korgus; //440 hertsi int nr=0; while(nr