This article introduces a basic acoustic echo canceller based on the Least Mean Squares (LMS) algorithm. Acoustic echo cancellers are necessary for many modern communications products. I’m sure you’ve come across a time when you could hear your voice while speaking on the phone, correct? Well, that's an example of an acoustic echo. Acoustic echoes are a common problem that arise from audio signals bouncing off nearby objects and coupling into the microphone when the mic should only be picking up your voice or when directly coupling from a speaker microphone pair (like your phone). Without cancelling these effects, the communication system is pretty annoying to use!

Figure 1

Here, the speech signal from a loudspeaker is acoustically coupled into the microphone of a speaker phone or hands-free cell phone, which is heard at the remote signal source as a return echo. The echo is suppressed by an echo canceller at the echo source by the system modeled in the figure above. Assume the channel has the sampled data impulse response represented by the Z-transform:

$$H(Z) = 1 + 0.5Z^{-3} + 0.1Z^{-5}$$

and the echo canceller is a tapped delay filter of length 50 samples. First we will let the desired signal s(t) be zero and train the canceling filter with white noise. As a synopsis, the signals in the figure 1 are:

$$\text{speech signal}: s(t)$$

$$\text{echo}: r(t)$$

$$\text{acoustic channel}: h(t)$$

$$\text{acoustic channel output} = r(t)*h(t) \text{(convolution)}$$

$$\text{microphone input}: s(t) + r(t)*h(t) , \text{desired signal plus echo through acoustic channel}$$

$$\text{echo canceller}: \hat{h}(t)$$

$$\text{desired signal}: y(t)$$

The goal is to match the acoustic channel with our echo canceller so that we can invert the acoustic channels response and create only the desired signal at the microphone inputs (t). So lets see how this looks in Matlab code: