Posts

Showing posts with the label javasound

Weird voice streaming and receiving audio through UDP

Weird voice streaming and receiving audio through UDP I was implementing two programs in Java, one sends through UDP the output audio and another one receives it and play it. While executing both programs (they communicate via loopback address), the only thing you can sometimes (every 10 seconds) hear is a voice (apparently of a woman) saying "ciao". The first time I heard it I was quite scared but now I am really curios to understand when this audio bytes come from. public static void main(String args) throws Exception { System.out.println("connect to " + Inet4Address.getLocalHost().toString() + " on port " + port); DatagramSocket serverSocket = new DatagramSocket(port); byte receiveData = new byte[1280]; //1280!!!!!! // ( 1280 for 16 000Hz and 3584 for 44 100Hz (use AudioRecord.getMinBufferSize(sampleRate, channelConfig, audioFormat) to get the correct size) format = new AudioFormat(sampleRate, 16, 1, true, false); while (statu...