4

How can i gain access to the current wave output sample stream?

In a December 2006 question on social.microsoft.com (How to record from 'Wave' or 'Stereo Mix' in Vista?) yjslash asked:

On Windows XP or earlier, I could capture the audio stream to the speaker. In other words, DirectSoundCapture was able to capture from the selected source line. And if "Wave Out Mix" or "Stereo Mix" or something similar was selected as recording source line, DirectSoundCapture was able to record the audio stream to the speaker.

To which Larry Osterman (MSFT) (audio team dev and StackOverflow user) responded:

What APIs did you use for this in XP? They should continue to work on Vista.

WASAPI has a special Loopback mode that allows a client to capture the post-mix audio stream, that may help as well

A question on Stackoverflow (How do I read system audio output in windows xp and windows 7?) also mentions that the WASAPI has the ability to sample the output mix, and that it's available starting with Windows Vista.

A January of 2007 a Windows Team blog entry mentions the ability to sample the audio output (for the purposes of echo cancellation; and what effect HDCP will have on it):

Will echo cancellation work less well for premium content?

We believe that Windows Vista provides applications with access to sufficient information to successfully build high quality echo cancellation functionality.

What API is used to sample the audio output? What access does Vista provide applications to do access the current audio output stream? What functions, and how to use them, of the WASAPI allows sampling/capture of the current audio output?

See also

Community
  • 1
  • 1
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219

1 Answers1

2

I found this (Loopback Recording) in MSDN, and also this (Capturing a Stream).

By the way, according to MSDN, WASAPI will not allow you to capture streams with DRM protection:

Windows Vista provides digital rights management (DRM). WASAPI does not permit loopback recording of digital streams that contain DRM-protected content. Similarly, a trusted audio driver does not permit a loopback device to capture digital streams that contain protected content. Windows Vista allows only trusted drivers to play protected content. For more information about trusted drivers and DRM, see the Windows DDK documentation.

yms
  • 10,361
  • 3
  • 38
  • 68
  • Given the Vista team's assertion "*We believe that Windows Vista provides applications with access to sufficient information to successfully build high quality echo cancellation functionality*", how does one build high quality echo cancellation functionality? There must be an API for it. – Ian Boyd Apr 27 '11 at 19:05
  • I think what they (msdn) mean is that they are providing you all the information you need to implement the algorithm yourself. But I do not think they provide an API for it. You can take a look at implementations on open source projects like mumble (http://sourceforge.net/projects/mumble/) or Speex (http://www.speex.org/), and you can take a look at descriptions on several algorithms in academic articles in citeseerx (http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.38.36&rank=1) – yms Apr 27 '11 at 19:23
  • i mean i cannot implement my echo cancellation algorithm if the only available api (WASAPI) will sometimes not capture playing output. – Ian Boyd Apr 27 '11 at 19:58
  • 1
    That assertion about DRM isn't quite true. If content is protected with a certain level of protection (and I'm not sure if any content is actually protected at that level), the system should degrade the quality of the audio received from the loopback tap. – Larry Osterman Apr 28 '11 at 01:54
  • @Larray Osterman, Interesting, have you tried this yourself? The assertion comes from MSDN, look at the links provided. – yms Apr 28 '11 at 02:43
  • 3
    Larry Osterman (MSFT Audio Dev) vs MSDN documentation. Prepare to fight. Fight! – Ian Boyd Apr 28 '11 at 13:44
  • Stereo Mix does still exist. http://social.technet.microsoft.com/Forums/en/w7itpromedia/thread/73415150-ec9b-44ea-8119-a2ea4f901ca0 – yincrash Sep 25 '11 at 02:03
  • @yincrash I am almost sure Stereo Mix is optional for the driver vendor, so it may not work in all systems. – yms Sep 25 '11 at 04:24