So, I found that you are reading audio
from somewhere unknown, and then trying to write it into WAV
format. But WAV
format requires to write header, which should contain file length. Anyway WaveFileWriter
throws exception if feeded by stream without knowing length.
I guess your direction is Java -> oggenc
.
So, you are to learn oggenc
and know if it accepts headless WAV
stream. If so, then just pass your audio
to output stream, without processing with AudioSystem.write()
which is for headed WAV
s
According to here http://www.linuxcommand.org/man_pages/oggenc1.html you are able to accept RAW
with oggenc
.