tags:

views:

46

answers:

1

Is it possible to capture soundoutput of the computer in Java?

It is possible to capture the microphone but that's not what I need, I need to capture parts of sound that the computer is playing and I can't figure it out.

Thanks

A: 

I think it's possible only if you have virtual audiodevice (native soundcard driver with "What U Hear" feature, Virtual Audio Cable, Virtual Audio Streaming or similar). After that you just find a mixer that corresponds to virtual audiodevice and create TargetDataLine.

You can do it by modifying 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);
Dmitry