0

I have one application based on webrtc. Currently I need to capture the system audio(by wasapi),but the mixed captured audio contains the audio stream which is my application's, if I send this audio stream to peer, he would listen echo.

The article Audio and Video / Core Audio APIs / Stream Management / Loopback Recording says

WASAPI provides loopback mode primarily to support acoustic echo cancellation (AEC).

How to understand it? How to clear the audio which is produced by my application? In other words, I find that the chrome doesn't have this issue when I call the "getdisplaymedia", the captured audio stream doesn't contain audio which is produced by chrome.

Roman R.
  • 68,205
  • 6
  • 94
  • 158
TONY
  • 101
  • 7

1 Answers1

0

The quoted statement means that in order to remove echo it is useful and necessary to have access to audio signal played through speakers because it will come back to michrophone or other audio recording hardware and would create an echo problem unless it is effectively subtracted.

Windows provides API to get this mixed audio signal going out to audio output devices: "Loopback Recording".

Also, Windows provides another software component and API: Voice Capture DSP:

The voice capture DMO includes the following DSP components:

  • Acoustic echo cancellation (AEC) ...

Currently the voice capture DMO supports only single-channel acoustic echo cancellation (AEC), so the output from the speaker line must be single-channel. If microphone array processing is disabled, multi-channel input is folded down to one channel for AEC processing. If both microphone array processing and AEC processing are enabled, AEC is performed on each microphone element before microphone array processing.

Together those can be used to capture audio and address echo cancellation challenge.

AECMicArray sample gives you some code and further information:

The sample supports acoustic echo cancellation (AEC) and microphone array processing by using the AEC DMO, also called the Voice capture DSP, provided by Microsoft .

Roman R.
  • 68,205
  • 6
  • 94
  • 158
  • Now I want to record the loopback audio, not microphone's. The loopback audio has mixed the audio which my application playbacks. I want to record the audio which other application playbacks, not mine. – TONY Sep 09 '21 at 02:39
  • The original MSDN article explains this topic, doesn’t it? – Roman R. Sep 09 '21 at 06:14
  • 1
    Pretty much as documented, or you can also use [this sample](https://matthewvaneerde.wordpress.com/2008/12/16/sample-wasapi-loopback-capture-record-what-you-hear/) by Matthew van Eerde as a reference. – Roman R. Sep 09 '21 at 13:52