How do I capture the audio that is being played?

Assuming that you are talking about Windows, there are essentially three ways to do this.

The first is to open the audio device’s main output as a recording source. This is only possible when the driver supports it, although most do these days. Common names for the virtual device are “What You Hear” or “Wave Out”. You will need to use a suitable API (see WaveIn or DirectSound in MSDN) to do the capturing.

The second way is to write a filter driver that can intercept the audio stream before it reaches the physical device. Again, this technique will only work for devices that have a suitable driver topology and it’s certainly not for the faint-hearted.

This means that neither of these options will be guaranteed to work on a PC with arbitrary hardware.

The last alternative is to use a virtual audio device, such as Virtual Audio Cable. If this device is set as the defualt playback device in Windows then all well-behaved apps will play through it. You can then record from the same device to capture the summed output. As long as you have control over the device that the application you want to record uses then this option will always work.

All of these techniques have their pros and cons – it’s up to you to decide which would be the most suitable for your needs.

Leave a Comment