I\'m developing a project which requires me to stream audio from microphone from a client to a server. The code shown below is what I have written. When I run both the clie
I am not familiar with this, so don't get mad if I am way off here, but reading the api for DataLine it seems to function like a buffer, that you have to flush or drain in this case to get the output. Have you attempted to put the mic.drain()/speaker.drain() command in the while loop?
The problem is in client side, in the line
byte[] data = IOUtils.toByteArray(is);
It deals with the object itself, not with the content. So, you must change it to this:
byte[] data = new byte[1024];