Java: sound capture

Is it possible to record the sound output of a computer in Java?

You can grab a microphone, but thatโ€™s not what I need, I need to grab the parts of the sound that the computer is playing, and I canโ€™t figure it out.

thank

+3
source share
1 answer

I think this is only possible if you have a virtual audio CD (built-in sound card driver with the โ€œWhat you hearโ€ function, Virtual Audio Cable , virtual audio streaming or the like). After that, you just find a mixer that matches the virtual audiovisual device and create a TargetDataLine.

You can do this by changing the following code example:

Mixer.Info[] mixersInfo = AudioSystem.getMixerInfo();

//select virtual audiodevice by vendor name, device name or version
Mixer.Info selectedMixerInfo = mixersInfo[0];
TargetDataLine recordLine = AudioSystem.getTargetDataLine(aAudioFormat, selectedMixerInfo);
+1

Source: https://habr.com/ru/post/1751338/


All Articles