Acoustic Echo Cancellation Windows

The project enables Acoustic Echo Cancellation (AEC) on Linux.It supports PC, Raspberry Pi, ReSpeaker Core V2 and Pi-like devices.

It's a part of voice-engine.The goal is to make an open source smart speaker for daily use.It uses Linux ALSA API and SpeexDSP's AEC algorithm.

Build

In this case, specialised products are employed to perform echo cancellation. Because echo suppression has known limitations, in an ideal situation, echo cancellation alone will be used. However this is insufficient in many applications, notably software phones on networks with long delay and meager throughput. May 13, 2011  In 2007, during the fever over DRM being included in Windows Vista, a Windows Vista Team blog was created to respond to a lot of the concerns. One of the questions responded to the ability of VoIP software to perform echo cancellation when running on Windows Vista.

The commands will create ec and ec_hw.For devices without hardware audio loopback, ec is used. Otherwise, ec_hw is used.The hardware audio loopback means that audio output is captured by extra ADC and sent back as input audio channel.

64-bit editions of Windows require the iTunes 64-bit installer. Windows 7 or later. 400MB of available disk space. Software:. Ios software download free

ec for devices without hardware audio loopback

  • Acoustic echo cancelation windows xp/vista/7. Acoustic Echo Cancellation (AEC) with Speex and DirectSound. API for supporting Echo Cancellation in Windows Vista/7.
  • Drivers for KS audio devices register instances of KSCATEGORYACOUSTICECHOCANCEL to indicate to the operating system that the devices support the KS functional category that performs acoustic echo cancellation. For information about device interface classes for audio adapters, see Installing Device Interfaces for an Audio Adapter.

For devices without hardware audio loopback, we need a way to get audio output data.ec will be audio output broker reading audio data from a named pipe and playing it.Meanwhile it will record audio and remove the playing audio from the recording,and then output it to another named pipe. The audio stream diagram is like:

To use ec:

  1. Run ./ec -h to show its command line options

  2. Run arecord -L and aplay -L to get audio devices' name

  3. Select audio input/output devices ./ec -i {input device name} -o {output device name} -c {input channels}

    ec reads playback raw audio from the FIFO /tmp/ec.input and writes processed recording audio to the FIFO /tmp/ec.output

Use ec with ALSA plugins as ALSA devices

ALSA's file plugin can be used to configure the FIFO /tmp/ec.input as a playback device. As the file plugin requires a slave device to support capturing, but nomally we don't have an extra capture device, so the FIFO plugin is written to use the FIFO /tmp/ec.output as a capture device.

This might not have to do with your question, but if by multiple computers you mean playing with people connected to a private network at home then this will be useful. When I play with 5 or 6 people at home and 2 discs are required, we have to take the cd out of the host computer and put it in someone else's, wait for the 'cd' to appear by that person's name, then put the disc back in the host computer and start the game quickly. Aoe 2 no-cd patch.

  1. install the FIFO plugin

  2. copy asound.conf to ~/.asoundrc (or /etc/asound.conf) to apply the configuration.

Use ec with PulseAudio

PulseAudio has module-pipe-sink and module-pipe-source which can be used to configure /tmp/ec.input and /tmp/ec.output as the default audio output and input.

PulseAudio (version < 12) will create /tmp/ec.input and /tmp/ec.output. If the two FIFO already exist, PulseAudio will fail, we should delete the two FIFO (rm /tmp/ec.input /tmp/ec.output) and then launch PulseAudio. It means we must start PulseAudio before we start ec. For example, use the following commands to setup PulseAudio and ec.

We can also use PulseAudio's configuration file to load module-pip-sink and module-pipe-source. Just replace /etc/pulse/pulse.default.pa with pulse.default.pa.

If you have installed PulseAudio but want to disable it, we need to disable PulseAudio's autospawn feature by adding autospawn=no to ~/.config/pulse/client.conf or /etc/pulse/client.conf, and then run pulseaudio -k

ec for Raspberry Pi

The sound from the on-board audio jack of the Raspberry Pi has serious distortion, do not use the on-board audio jack!

  • ReSpeaker 2 Mic Hat for Raspberry Pi

    The delay between playback and recording is about 200. Try ./ec -i plughw:1 -o plughw:1 -d 200

ec_hw for devices with hardware audio loopback

Acoustic Echo Cancellation Windows 10

For devices such as ReSpeaker Core V2, ReSpeaker 6 Mic Array for Pi and ReSpeaker Linear 4 Mic Array for Pi,audio output is captured as one of the input channels. The audio stream diagram is simpler.

To use ec_hw:

Acoustic Echo Cancellation Windows 9

  1. Run ./ec_hw -h to show its command line options

  2. Run arecord -L to get audio input devices' name

  3. Select the audio input device ./ec_hw -i {input device name} -c {input channels} -l {loopback channel} -m {mic channel list}

    ec_hw uses channel 7 as playback audio, remove the playback from channels 0,1,2,3 and writes processed audio to the FIFO /tmp/ec.output

License

GPL V3

Credits

  • The ring buffer implementation is from PortAudio
  • SpeexDSP provides the excellent open source AEC algorithm
  • Using named pipe for I/O is inspired by snapcast
Active8 years, 4 months ago

In 2007, during the fever over DRM being included in Windows Vista, a Windows Vista Team blog was created to respond to a lot of the concerns. One of the questions responded to the ability of VoIP software to perform echo cancellation when running on Windows Vista.

This is what Nick White had to say by way of an FAQ:

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 information does Windows Vista provide to allow applications to build high quality echo cancellation functionality?

Note: Reading that statement, i get the impression that Windows Vista provides sufficient information to allow applications to successfully build high-quality echo cancellation functionality. Presumably the way Windows provides this information is through an API.

Echo cancellation works by sampling the playing output, and 'subtracting it' from the recorded microphone input.

Unfortunately, as MSDN notes, one cannot always sample playing output:

Windows Vista provides digital rights management (DRM). Content providers rely on DRM to protect their proprietary music or other content from unauthorized copying and other illegal uses. 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.

Presumably that means that using Loopback Mode from WASAPI is not the intended method to provide echo-cancellation services.

What is the intended API to allow the implementation of high quality echo cancellation?

Note: This is related to, but separate from, another question i asked: How to sample output audio mix?. This question is specifically looking for an expansion of the response by the Window Vista team that echo-cancellation is possible in Windows. This question is looking for the API; it can be a separate question of how to use it.

Googling for an answer, i get the impression that (while performing echo-cancellation) an application is allowed to sample DRM protected content, but the content will be degraded (i.e. 'sufficient information'). This would make any echo-cancellation worse, but still possible.

Or was the Windows team implying 'sufficient for most cases, but not while the user is listening to a song or playing a movie' - and that it is in fact not possible to successfully build high quality echo cancellation functionality?

Update: It should be noted i'm not looking for an echo-cancellation API, i'm looking for an API to sample the playing output - which is what's required to implement echo cancellation. Unless of course Windows Vista provides an echo-cancellation API (which is how they continue to protect Premium content). But i've not seen an echo-cancellation API either.

Community
Ian BoydIan Boyd
129k202 gold badges725 silver badges1041 bronze badges

1 Answer

If you are looking for an API to do echo cancellation, it looks like the voice capture dsp has built in support for acoustic echo cancellation.

Example:http://msdn.microsoft.com/en-us/library/dd443455(VS.85).aspx

Gabe
74k10 gold badges120 silver badges212 bronze badges
Chris Edmonds - MSFTChris Edmonds - MSFT

Not the answer you're looking for? Browse other questions tagged windowswindows-7audiowasapi or ask your own question.