Hi everyone, I need help with capturing audio from the audio output (if this is possible with Java tools at all)

try { Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo(); AudioFormat f = new AudioFormat(48000, 16, 2, true, false); DataLine.Info dataLineInfo = new DataLine.Info(TargetDataLine.class, f); Mixer mixer0 = AudioSystem.getMixer(mixerInfo[0]); TargetDataLine targetDataLine = (TargetDataLine) mixer0.getLine(dataLineInfo); targetDataLine.open(f); targetDataLine.start(); } catch (Exception e) { System.out.println(e); } 

when choosing other mixers crashes

 java.lang.IllegalArgumentException: Line unsupported: interface TargetDataLine supporting format PCM_SIGNED 48000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian 
  • 2
    Using Java is unlikely. Third-party libraries I think possible. Look, for example, github.com/jitsi/libjitsi - the AudioCaptureClient class with the AUDCLNT_STREAMFLAGS_LOOPBACK parameter allows using WASAPI Looback mode (only in Windows, but I think there is something similar for other platforms). - MSDN.WhiteKnight
  • Thank you, by chance there is no link with an example? - Minepolz320
  • No Unfortunately. - MSDN.WhiteKnight

0