1

I want to capture audio from speaker using Waveform Audio API.

I have searched and found posts that explain how to use Waveform Audio to capture audio from microphone and save to file or playback. However, none explain how to capture audio from speaker.

My understanding is that if i provide handle to a playback device in waveInOpen() then i can capture sound from speaker. This is where i need help. How to get handle of a playback device? When I provide WAVE_MAPPER (or 0) for uDeviceID, it always records from mic. If I set any other value, I always get out of range error.

EDIT:

I have done some more research since i posted question. I have found other options/APIs that i can use for audio capture. I need help to point me in the right direction which one to use for capturing audio from speaker. I dont want anything fancy which involves lot of code. My target OS is XP and above.

waveInOpen & Mixer:

Comments/Discussion on these links hint that waveInOpen() can be used to grab audio from speaker. According to these, one has to open Mixer. I have used mixerOpen() to get mixer handle but dont know how to use this handle with waveInOpen().

How do I capture the audio that is being played?

Sound from mic vs sound from speaker

XAudio2:

Can i use XAudio2 to capture audio from speaker? If yes then please do share some sample code.

Community
  • 1
  • 1
  • The first link you included has 3 suggestions for doing what you're requesting. The last of the 3 is basically what I answered. I won't say the first isn't possible but in my experience I've never seen a sound card that has this capability. I just checked the one in my PC and also checked 4 pro audio devices lying around on my desk. Good luck. – jaket Jan 18 '15 at 21:57
  • Were you able to find a solution? I am also in need of recording system out audio. – Noitidart May 25 '16 at 10:05

1 Answers1

0

The API is not designed for that use case. The speaker output is a output device and accessed by waveOutOpen. A workaround is to install a virtual sound card like the one at this like and that will allow you to redirect the audio output back to an audio input.

jaket
  • 9,140
  • 2
  • 25
  • 44
  • Thanks for your response. I have quickly visited the link you shared. I am looking for something simpler as all i need is capture capability without modifying sound or performing other more complex functions. I am going to edit my original post as i have done some more research. – Tom Dick N Harry Jan 18 '15 at 12:04