package proovid; import javax.sound.sampled.*; import java.io.*; public class HeliEsitus2{ 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(); SourceDataLine line = (SourceDataLine) AudioSystem.getLine( new DataLine.Info(SourceDataLine.class, formaat, AudioSystem.NOT_SPECIFIED) ); line.open(formaat); line.start(); byte andmed[]=new byte[24000]; for(int i=1; i<5; i++){ int baitidearv=sisend.read(andmed, 0, andmed.length); 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); } }