High performance VoIP SDK for .Net developers

VoIP SIP SDK

How to implement Acoustic Echo Cancellation (AEC)

This article is a brief introduction about Acoustic Echo Cancellation (AEC) in relation with Ozeki VoIP SIP SDK. After reading through this page you will be fully familiar with all the essential terms concerning AES technology and what you will need for creating your own solution using Ozeki VoIP SIP SDK.

Introduction

AEC is the process of removing echo from a voice communication in order to improve voice quality on a telephone call. In addition to improving subjective quality, this process increases the capacity achieved through silence suppression by preventing echo from traveling across a network.

Acoustic echo arises when sound from a loudspeaker—for example, the earpiece of a telephone handset—is picked up by the microphone in the same room—for example, the mic in the very same handset. The problem exists in any communications scenario where there is a speaker and a microphone.

Ozeki VoIP SIP SDK has a great set of methods provided for AES technology. You can use them for making your voice call quality better.

The following program code uses the background support of Ozeki VoIP SIP SDK, therefore you will need to download and install the SDK on your computer before starting to use the program code. You will also need to have Visual Studio 2010 or compatible IDE and .NET Framework installed on your system, as the program code below is written in C# language.

Source code explanation

The Acoustic Echo Cancellation can be used through the Ozeki.Media.MediaHandlers.AudioQualityEnhancer class. This class contains an AcousticeEchoCancellationproperty that can be set for the echo cancellation. The initialization of the echo cancellation object is shown in Code 1. The echo canceller works with the echo coming from the speaker.

var audioProcessor = new AudioQualityEnhancer();
audioProcessor.SetEchoSource(speaker);

Code 1 - The initialization of the AudioQualityEnhancer

As the AudioQualityEnhancer is a MediaHandler, it needs to be connected to the proper MediaHandlers in order to work. If you want to use it for echo cancellation, you need to put the AudioQualityEnhancer between the microphone and the PhoneCallAudioSender. In this case an AudioMixerMediaHandler object also needs to be set between the AudioQualityEnhancer and the sender in order to create an outgoing audio stream from the voice coming from the microphone and the echo cancelled sound (Code 2).

In this case the outgoingDataMixer is an instance of the AudioMixerMediaHandler class. The other handlers are the standard Microphone and PhoneCallAudioSender objects.

if (microphone != null) mediaConnector.Connect(microphone, audioProcessor);
mediaConnector.Connect(audioProcessor, outgoingDataMixer);
mediaConnector.Connect(outgoingDataMixer, phoneCallAudioSender);

Code 2 -Connecting the AudioQualityEnhancer into the MediaHandler line

From this point, the call can be done the same way as in any other softphone application, the only difference will occur in the sound quality.

This article introduced you the basic knowledge about Acoustic Echo Cancellation technology and showed how Ozeki VoIP SIP SDK can help you to fulfill your wishes about this topic. If you have read through this page carefully, you already have all the knowledge you need to start on your own solution.

As you are now familiar with all the terms concerning this topic, now it is time to take a step further and explore what other extraordinary solution Ozeki VoIP SIP SDK can provide to you.

If you have any questions or need assistance, please contact us at info@voip-sip-sdk.com

You can select a suitable Ozeki VoIP SIP SDK license for your project on Pricing and licensing information page

Related Pages