[ACCEPTED]-How do I capture the audio that is being played?-audio-recording
Assuming that you are talking about Windows, there 29 are essentially three ways to do this.
The 28 first is to open the audio device's main 27 output as a recording source. This is only 26 possible when the driver supports it, although 25 most do these days. Common names for the 24 virtual device are "What You Hear" or 23 "Wave Out". You will need to use 22 a suitable API (see WaveIn or DirectSound 21 in MSDN) to do the capturing.
The second 20 way is to write a filter driver that can 19 intercept the audio stream before it reaches 18 the physical device. Again, this technique 17 will only work for devices that have a suitable 16 driver topology and it's certainly not for 15 the faint-hearted.
This means that neither 14 of these options will be guaranteed to work 13 on a PC with arbitrary hardware.
The last 12 alternative is to use a virtual audio device, such 11 as Virtual Audio Cable. If this device is set as the defualt 10 playback device in Windows then all well-behaved 9 apps will play through it. You can then 8 record from the same device to capture the 7 summed output. As long as you have control 6 over the device that the application you 5 want to record uses then this option will 4 always work.
All of these techniques have 3 their pros and cons - it's up to you to 2 decide which would be the most suitable 1 for your needs.
You can use the Waveform Audio Interface, there 5 is an MSDN article on how to access it per PInvoke.
In 4 order to capture the sound that is being 3 played, you just need to open the playback 2 device instead of the microphone. Open for 1 input, of course, not for output ;-)
If you were using OSX, Audio Hijack Pro from Rogue Amoeba probably is the 5 easiest way to go.
Anyway, why not just 4 looping your audio back into your line in 3 and recording that? This is a very simple solution. Just 2 plug a cable in your audio output jack and 1 your line in jack and start recordung.
You have to enable device stero mix. if 1 you do this, direct sound find this device.
More Related questions