Java writes bad wave files

Posted by Cliff on Stack Overflow See other posts from Stack Overflow or by Cliff
Published on 2010-05-10T21:00:40Z Indexed on 2010/05/10 21:04 UTC
Read the original article Hit count: 179

Filed under:
|

I'm writing out wave files in Java using

AudioInputStream  output = new AudioInputStream(new ByteArrayInputStream(rawPCMSamples), new AudioFormat(22000,16,1,true,false), rawPCMSamples.length)
AudioSystem.write(output, AudioFileFormat.Type.WAVE, new FileOutputStream('somefile.wav'))

And I get what appears to be corrupt wave files on OSX. They won't play from Finder however using the same code behind a servlet writing directly to the response stream and setting the Content-Type to audio/wave seems to play fine in quicktime. What gives?

© Stack Overflow or respective owner

Related posts about java

Related posts about audio