Using AEC with VC components

Subscribe to RSS news feed

Echo effect most often occurs when a side's B microphone picks up a signal from side A and rebroadcasts it back at site A:

That usually results in a feedback loop.

AEC module monitors incoming signal on side B, and then removes it from the outgoing signal, taking the room environment into account:

Microsoft has implemented AEC as an effect for the capture buffer used in DirectSound API since Windowx XP SP2.

Sample demo application

Because AEC is a part of DirectSound, we cannot use our WaveIn and WaveOut components. Instead we have create a new DX_FullDuplex component, which takes care of creating necessary DirectX buffers for audio capture and rendering.

We assign CodecIn as a consumer of DX_FullDuplex component, so it will receive and encode audio captured by AEC.

Encoded audio is sent to remote side, and incoming signal is sent to CodecOut component for decoding (decompression).

After decoding, a PCM stream should be sent to DX_FullDuplex component, therefore we assign it as a consumer of CodecOut:

DX_FullDuplex -> CodecIn -> IPClient -> CodecOut -> DX_FullDuplex

AEC limitations

Microsoft implementation of AEC has some limitations:

  • you must be running Windowx XP SP2 or later for AEC to be enabled;
  • internally audio is processed with 16 kHz sampling rate;
  • no hardware acceleration can be used along with AEC;
  • other application using DirectSound (like WinAmp) may prevent AEC of successful activation;
  • if you have more than one soundcard, make sure same card is used as default recording and playback device.

Under Windows 2000 our demo will not be able to create full duplex interface even with AEC turned off:

That is reported as DirectSound error code (0x887800032) at the application's status bar.

Download

Precompiled binary of this sample is included in the Demos package.