import javax.sound.sampled.*; import java.applet.Applet; import java.awt.*; import java.awt.event.*; public class UjuHiir extends Applet implements MouseMotionListener, Runnable{ Button nupp=new Button("Piiksu"); int kandesagedus =10000; byte[] andmed=new byte[kandesagedus/4]; //5 sekundit int vanakorgus=800; int uuskorgus=vanakorgus; double nurk=0; SourceDataLine line; public UjuHiir(){ 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, 1024); line.start(); }catch(Exception viga){viga.printStackTrace();} koostaAndmed(); new Thread(this).start(); } void koostaAndmed(){ int sagedus=vanakorgus; //440 hertsi int nr=0; double tous_oktaavites=(Math.log(uuskorgus)-Math.log(vanakorgus))/Math.log(2); while(nr