I am listening to live phone calls and am able to get the raw PCM bytes. I also able to listen to these bytes through java's audio api. These all works on an applet.
Now I want to be able to convert the raw PCM bytes of the phone call to WAV bytes so I could write it directly to a ServletOutputStream. This would allow browsers to actually listen to the phone calls.
Does anybody have any idea how I would be able to convert, on the fly, some raw PCM bytes[] to WAV bytes[]?
The examples I've seen all pertain to converting a file to another file.
How can I write a WAV file from byte array in java?
Thank you.
It is been a while but I think this might help someone. Here is my solution - I am writing bytes back to the any output stream (In my case it is servletoutputstream). First, I write WAV header(44 bytes) to output stream and write the pcm bytes (You need to convert pcm data to byte array). I used audio tag in html and specified src tag as my api url and it worked perfectly fine.
I was also stuck in quite same situation, here's how I figured things out.