How to echo cancellation? / Noise management in WebRTC?

HOME © Muaz Khan . @WebRTCWeb . Github . Latest issues . What's New?

This tutorial is out-dated (written in 2013). Please check this tutorial instead:

Useful Links!

  1. Slides for what is the role of echo in WebRTC; and solutions!
  2. Download PDF for What is Echo?

Echo Scenarios:

  1. 44.1 kHz and non-44.1 kHz sample rate mismatches cause echo
  2. The "ambient noise reduction" which can be enabled on the built-in mic on Mac appears to cause a very small amount of echo


  1. Ensure both capture and render devices are set to either 44.1 or 48 kHz. You can do this through the "Audio MIDI Setup" application
  2. Disable "ambient noise reduction"

High volume can produce sound noise on some audio devices. The value may not be significant if audio device volume is controlled externally.

HTMLAudioElement.volume = 0.9;;

The GainNode is a simple element that lets us control the volume of the audio that’s coming into to it.

var context = new webkitAudioContext(),
var sineWave = context.createOscillator();

// Declare gain node
var gainNode = context.createGainNode();

// Connect sine wave to gain node

// Connect gain node to speakers

// Play sine wave

gainNode.gain.value = 0.9;

Try demo locally to control volume using GainNode.


  1. If you're newcomer, newbie or beginner; you're suggested to try RTCMultiConnection.js or DataChannel.js libraries.

Latest Updates


Enter your email too; if you want "direct" reply!