Hello everyone,
I'm currently working on a realtime voice chat system in Java. Classes to record and playback the audio have been supplied, my task is the networking side of things (UDP not TCP/IP).
The problem I'm having is with audio playback and delays. What I tried was to send each audio sample as soon as it was recorded, across the network and play it on the receiving end immediately - this resulted in no playback. If I recorded a number of samples, buffered them into a List and then sent the whole list using a loop, and then buffered the packets into a List on the receiving end, there was acceptable play back on the other side.
The problem is, there is a sizeable delay between recording and playing back the audio since I am recording 100 samples before sending them all. Also while the sending end is transmitting the 100 audio samples it is not recording anything so anything spoken into the microphone during this time is lost. The same is also true for the receiving end, it is not receiving any data packet while it is playing back the List so there is a delay and loss of data.
I considered using threads somehow to receive/record/playback/transmit concurrently but am I making a basic mistake in the implementation? I can post source code if necessary.
Thanks in advance for any help!


