import javax.sound.sampled.*; import java.io.*; public class Helilindistus{ public static void main(String argumendid[]) throws Exception{ AudioFormat formaat=new AudioFormat(AudioFormat.Encoding.PCM_SIGNED, 8000, 8, 1, 1, 8000, true); DataLine.Info info=new DataLine.Info(TargetDataLine.class, formaat); TargetDataLine sisend=(TargetDataLine)AudioSystem.getLine(info); sisend.open(formaat, sisend.getBufferSize()); sisend.start(); byte andmed[]=new byte[24000]; int baitidearv=sisend.read(andmed, 0, andmed.length); AudioInputStream ais=new AudioInputStream( new ByteArrayInputStream(andmed), formaat, 24000 ); AudioSystem.write(ais, AudioFileFormat.Type.AU, new File("ise.au")); System.exit(0); } }