import java.io.*; import javax.sound.sampled.*; public class CDHeli1{ static AudioFormat formaat; static byte[] loe(String failinimi) throws Exception{ AudioInputStream sisse=AudioSystem.getAudioInputStream(new File(failinimi)); byte[] puhver=new byte[1024]; formaat=sisse.getFormat(); System.out.println(formaat); ByteArrayOutputStream malu=new ByteArrayOutputStream(); int kogus=sisse.read(puhver); while(kogus!=-1){ malu.write(puhver, 0, kogus); kogus=sisse.read(puhver); } return malu.toByteArray(); } static void mangi(byte[] andmed) throws Exception{ SourceDataLine line=(SourceDataLine)AudioSystem.getLine( new DataLine.Info(SourceDataLine.class, formaat, AudioSystem.NOT_SPECIFIED) ); line.open(); line.start(); line.write(andmed, 0, andmed.length); line.drain(); } static void kirjuta(byte[] andmed, String failinimi) throws Exception{ AudioInputStream ais=new AudioInputStream( new ByteArrayInputStream(andmed), formaat, andmed.length/4 ); AudioSystem.write(ais, AudioFileFormat.Type.WAVE, new File(failinimi)); } static void trykiEkraanile(byte[] andmed){ int pikkus=andmed.length/4; for(int i=0; i