I am trying to make a simple Android application that streams live microphone audio to a server for playback. The resulting playback sounds strange, with large gaps in the a
Thanks for post Joshua .... great help for new bees :)
volumeControl.setValue(volumeControl.getMaximum());
removes illegalStateException at Server
and permission in android client
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
Here's something you could try, instead of:
// read the data into the buffer
recorder.read(buffer, 0, buffer.length);
// place contents of buffer into the packet
packet = new DatagramPacket(buffer, buffer.length, serverAddress, PORT);
Do not expect you received fully read buffer from recorder
but use actual read value instead
// read the data into the buffer
int read = recorder.read(buffer, 0, buffer.length);
// place contents of buffer into the packet
packet = new DatagramPacket(buffer, read, serverAddress, PORT);
Or something alike.