I am trying to modify the code found at the bottom of this page to capture system sound using Java. Here is the part that I modified in captureAudio ():
Mixer mixer = AudioSystem.getMixer(mixerInfo[0]); // "Java Sound Audio Engine" final TargetDataLine line = (TargetDataLine) mixer.getLine(info);
Now, when I run this code, it produces the following:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Line unsupported: interface TargetDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, mono, 2 bytes/frame, big-endian
I tried to change my format so that it corresponded to the required format, but the exception does not go and nothing is written. What am I doing wrong?
user347284
source share