package proovid; import javax.sound.sampled.*; import java.io.*; public class HeliEsitus{ 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); Thread.sleep(1000); SourceDataLine line = (SourceDataLine) AudioSystem.getLine( new DataLine.Info(SourceDataLine.class, formaat, AudioSystem.NOT_SPECIFIED) ); line.open(formaat); line.start(); line.write(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); } }