!752 import javax.sound.sampled.*; p { new Client().captureAudio(); } sclass Client { boolean stopCapture = false; AudioFormat audioFormat; TargetDataLine targetDataLine; BufferedOutputStream out = null; BufferedInputStream in = null; Socket sock = null; private void captureAudio() ctex { /*sock = new Socket("192.168.1.5", 500); out = new BufferedOutputStream(sock.getOutputStream()); in = new BufferedInputStream(sock.getInputStream());*/ Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo(); for (int i = 0; i < l(mixerInfo); i++) { print("Mixer " + i + ": " + mixerInfo[i]); Line.Info[] lines = AudioSystem.getMixer(mixerInfo[i]).getTargetLineInfo(); for (int j = 0; j < l(lines); j++) print(" Target line " + j + ": " + lines[j]); } audioFormat = getAudioFormat(); Mixer mixer = AudioSystem.getMixer(mixerInfo[5]); /*DataLine.Info dataLineInfo = new DataLine.Info( TargetDataLine.class, audioFormat);*/ Line.Info dataLineInfo = mixer.getTargetLineInfo()[3]; // 0 (master) or 3 (PCM) targetDataLine = (TargetDataLine) mixer.getLine(dataLineInfo); targetDataLine.open(audioFormat); targetDataLine.start(); Thread captureThread = new CaptureThread(); captureThread.start(); } class CaptureThread extends Thread { byte tempBuffer[] = new byte[10000]; @Override public void run() { stopCapture = false; try { while (!stopCapture) { int cnt = targetDataLine.read(tempBuffer, 0, tempBuffer.length); //out.write(tempBuffer); //print("Bytes received: " + tempBuffer.length); print("min=" + min(tempBuffer) + ", max=" + max(tempBuffer)); } } catch (Exception e) { System.out.println(e); System.exit(0); } } } private AudioFormat getAudioFormat() { float sampleRate = 8000.0f; int sampleSizeInBits = 8; int channels = 1; boolean signed = true; boolean bigEndian = false; return new AudioFormat(sampleRate, sampleSizeInBits, channels, signed, bigEndian); } }