Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Audio data from array to .wav

807606Apr 2 2007 — edited Apr 2 2007
Hello!

I am trying to make a .wav file that will contain audio data from a byte array

I have used the following code (the array is called newBuffer)
The .wav file is created, but it's not 'filled' with data (actually, the size of it is stuck at 9.8 KB :P). When I try to open it from an audio player it opens without error messages (but obviously I can't hear anything..)

Any ideas? Merci :)

ByteArrayInputStream bis=new ByteArrayInputStream(newBuffer);

AudioInputStream ais=new AudioInputStream(bis,audioFormat,newBuffer.length/audioFormat.getFrameSize());

AudioSystem.write(ais,AudioFileFormat.Type.WAVE,new File("16bitThres.wav"));

Message was edited by:
miss_elec
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2007
Added on Apr 2 2007
17 comments
426 views