Public feed
#527204
/* * converts a raw file in source to speex format at destination */public SpeexAudioWriter(String source, String destination) throws FileNotFoundException{ this.destination = destination; targetFormat = Utilities.getSpeexAudioFormat(); FileInputStream input = new FileInputStream(source); Pcm2SpeexAudioInputStream inputStream = new Pcm2SpeexAudioInputStream(input,targetFormat,AudioSystem.NOT_SPECIFIED,16000); inputStream.setComment("Encoded with Speex speex-1.0.4", false); inputStream.setFramesPerPacket(16); //inputStream.setVbr(true); inputStream.setPacketsPerOggPage(32); System.out.println("frame rate:"+targetFormat.getFrameRate()); System.out.println("frame size:"+targetFormat.getFrameSize()); FileOutputStream file = new FileOutputStream("system/test.ogg"); byte[] buffer = new byte[8820]; try { int counter = 0; while(inputStream.read(buffer, 0, 8820) != -1){ System.out.println("step:"+ counter); file.write(buffer,0,8820); counter++; } System.out.println("*******************counter:"+counter ); file.close(); } catch (IOException e) { e.printStackTrace(); } }