Skip to content

Adaptive Noise and Echo Cancellation

Copy this iframe to your website:

1
<iframe src="https://dmccreary.github.io/signal-processing/sims/adaptive-noise-cancellation/main.html" width="100%" height="682px" scrolling="no"></iframe>

Run MicroSim in Fullscreen

Description

This MicroSim runs one normalized LMS (NLMS) adaptive filter on three classic problems, chosen from the drop-down list. In every case the filter output is \(y[n] = \mathbf{w}^T\mathbf{x}[n]\), the error is \(e[n] = d[n] - y[n]\), and the taps follow

\[\mathbf{w} \leftarrow \mathbf{w} + \frac{\mu\, e[n]\, \mathbf{x}[n]}{\varepsilon + \|\mathbf{x}[n]\|^2}, \qquad \varepsilon = 0.05 .\]
  • Noise cancellation. The primary input is \(d = s + P * x\): a clean two-tone signal \(s\) plus white noise \(x\) that reached the sensor through an unknown 10-tap path \(P\). The reference input is \(x\) itself, so the error \(e\) becomes the cleaned signal. Signal leaks into reference adds \(0.3\,s\) to the reference.
  • Echo cancellation. A speech-like far-end signal \(x\) plays through a loudspeaker and returns to the microphone through an echo path \(H\) (a 4-sample delay and 20 decaying taps) scaled by the echo level \(g\). Near-end talker adds a local voice (double-talk); Freeze during double-talk stops adaptation while that voice is active, like an ideal double-talk detector.
  • Equalization. Random \(\pm 1\) training symbols \(a[n]\) pass through the dispersive channel \(C = [0.31, 0.69, 0.54, -0.31, 0.23]\) plus noise. The equalizer learns to output \(a[n - \Delta]\), where the delay \(\Delta\) minimizes the Wiener (optimum) MSE for the chosen length. Decision-directed replaces the training symbol by the sign of the output.

The sliders set the step size \(\mu\), the filter length \(M\), the noise level, echo level or channel noise, and the speed. The MicroSim opens paused; press Run to start the adaptation and Pause to freeze it. Changing \(M\) or pressing Reset restarts the same random run. The stem plot compares the learned taps with the true path (system identification), or shows the equalizer and the combined response \(C * w\). The convergence curve plots noise reduction, ERLE \(= 10\log_{10}(E[d^2]/E[e^2])\) (echo part only), or MSE.

This simulation is used in Chapter 11: Adaptive Signal Processing.

Lesson Plan

Learning Objectives

After using this MicroSim, students will be able to:

  1. Apply the NLMS update to noise cancellation, echo cancellation and equalization, identifying the input \(x\), the desired signal \(d\) and the useful output in each configuration
  2. Analyze how the step size \(\mu\) trades convergence speed against steady-state noise reduction, using the misadjustment estimate \(\mu/(2-\mu)\)
  3. Explain why the filter length must cover the unknown path or channel, by comparing the learned taps with the true path
  4. Evaluate when an adaptive canceller fails: a reference that contains the signal, double-talk during echo cancellation, and decision-directed training from a closed eye
  5. Interpret ERLE, noise reduction, misalignment, mean-squared error, symbol error rate and eye opening as measures of performance

Target Audience

Undergraduate students in a digital signal processing course (junior or senior engineering, physics or computer science). Plan 30 to 40 minutes for the four activities.

Prerequisites

  • FIR filters and convolution
  • Mean-squared error and the Wiener filter idea (Chapter 11)
  • The LMS and NLMS update equations (Chapter 11)
  • Decibels as a power ratio

Activities

The numbers below come from the sim's own engine. Each run uses the same random numbers, so Reset reproduces them. Read-outs are averages over the last few hundred samples, so in steady state they wander by a few dB.

Activity 1: Step size in noise cancellation (10 min). Start with the defaults (\(\mu = 0.05\), \(M = 16\), \(\sigma = 1.00\)). The input SNR is about −4 dB. Noise reduction passes 10 dB near \(n = 1{,}260\) and settles around 20 dB (between about 17 and 23 dB), so the output SNR is about 16 dB. The green output now follows the dashed clean signal. Set \(\mu = 0.01\) and press Reset: 10 dB now takes until \(n \approx 2{,}550\), but the reduction settles near 27 dB. With \(\mu = 0.50\) it reaches its final value within 200 samples, but that value is only about 9 dB. With \(\mu = 1.00\) it settles near 4 dB, and with \(\mu = 1.50\) near −2 dB, which is worse than no canceller at all.

Activity 2: Filter length, noise level and leakage (10 min). Return to \(\mu = 0.05\). Set \(M = 4\): the taps panel shows that taps 4 to 9 of \(P\) are outside the filter, and the noise reduction stops near 8.5 dB. Set \(M = 16\) again and change the noise level. With \(\sigma = 0.50\) the reduction settles near 14 dB and with \(\sigma = 2.00\) near 26 dB, yet the output SNR stays near 16 dB in both cases. Finally check Signal leaks into reference. The "Signal kept" read-out falls to about 57% and the noise reduction to 9 to 10 dB: the filter now also cancels part of \(s\), and the green output is visibly smaller than the dashed clean signal.

Activity 3: Echo cancellation and double-talk (10 min). Choose Echo cancellation (defaults \(\mu = 0.50\), \(M = 32\), \(g = 0.50\)). ERLE climbs in steps, because the filter only learns while the far end talks. It passes 10 dB near \(n = 1{,}390\) and 20 dB near \(n = 3{,}600\), and settles near 24 dB. The learned taps match \(H\), including its four zero taps of delay. Try \(M = 16\) (about 19 dB) and \(M = 8\) (about 5 dB). With \(M = 32\) again and the run converged (about \(n = 8{,}000\)), check Near-end talker. Within about 600 samples ERLE falls below −5 dB and then stays near −9 dB: the canceller now adds more echo than it removes, and the misalignment rises above 0 dB. Uncheck it and the filter recovers. Press Reset, check Freeze during double-talk, let it converge, then add the near-end talker: ERLE stays near 22 dB.

Activity 4: Equalization and the eye (10 min). Choose Equalization (defaults \(\mu = 0.10\), \(M = 11\), \(\sigma = 0.05\)). Before the equalizer the eye is closed (opening about −0.75) and about 25% of the symbols are wrong. With training, the eye opens after about 400 symbols. The MSE reaches −20 dB near \(n = 1{,}030\) and settles near −23.5 dB, close to the Wiener minimum of −23.7 dB at \(\Delta = 8\). The combined response \(C * w\) becomes a single spike at tap 8. Set \(M = 3\): the Wiener minimum is only −7.4 dB and the eye stays slightly closed (about −0.1). \(M = 5\) opens it (about +0.6). Back at \(M = 11\), check Decision-directed and press Reset: the MSE stays near +3 dB and about half the decisions are wrong. Uncheck it, train for 3,000 symbols, then check it again: the error rate stays at 0.0%.

Assessment

  1. In Activity 1 the residual noise is roughly \(\frac{\mu}{2-\mu}P_s\), where \(P_s = 0.40\) is the signal power. Predict the steady-state noise reduction for \(\sigma = 1\) and \(\mu = 0.5\), and compare it with the sim. Answer: \(\frac{0.5}{1.5} \times 0.40 = 0.133\), so the noise reduction is \(10\log_{10}(1/0.133) \approx 8.8\) dB. The sim settles near 9 dB.
  2. Why does the output SNR stay near 16 dB when the noise level changes from 0.5 to 2, as long as \(\mu = 0.05\)? Answer: the residual is set by the misadjustment, \(\frac{\mu}{2-\mu}P_s\), which does not depend on the noise level. So the output SNR is about \(10\log_{10}\frac{2-\mu}{\mu} = 15.9\) dB.
  3. Taps 4 to 9 of the noise path hold 11.7% of its energy. What is the best noise reduction a 4-tap canceller can reach with a white reference? Answer: \(10\log_{10}(1/0.117) = 9.3\) dB. The sim shows about 8.5 dB because misadjustment adds a little residual.
  4. During double-talk without freezing, ERLE becomes negative. Explain how a canceller can make the echo worse. Answer: the near-end voice is part of \(e[n]\) but is not correlated with the far-end input. The NLMS update treats it as error and pushes the taps away from \(H\) (misalignment above 0 dB), so \(y[n]\) no longer matches the echo.
  5. Why does decision-directed adaptation fail from the start but work after training? Answer: with a closed eye about a quarter of the decisions are wrong, so the filter is trained toward wrong targets. After training the eye is open and the decisions equal the training symbols, so the update is unchanged.

Common Misconceptions

"A bigger step size is always better because the filter converges faster." Activity 1 shows the price. \(\mu = 0.5\) reaches its final value within 200 samples, but that value is only about 9 dB. \(\mu = 0.01\) needs about 2,550 samples just to reach 10 dB, but it ends near 27 dB. \(\mu = 1.5\) makes the output worse than the input.

"Once an echo canceller has converged, it stays converged." Turning on the near-end talker shows that adaptation itself is the danger. Without a double-talk detector the taps wander far from \(H\) and ERLE drops from about 24 dB to about −9 dB. Freezing adaptation during double-talk keeps it near 22 dB.

References

  1. Adaptive filter - Wikipedia - structure of an adaptive filter and its noise-cancellation, echo-cancellation and equalization configurations
  2. Least mean squares filter - Wikipedia - the LMS and normalized LMS updates, step-size bounds and convergence
  3. Echo suppression and cancellation - Wikipedia - acoustic echo cancellation, ERLE and double-talk
  4. Adaptive equalizer - Wikipedia - training and decision-directed equalization of dispersive channels
  5. Eye pattern - Wikipedia - how intersymbol interference and noise open or close the eye
  6. System identification - Wikipedia - estimating an unknown system from its input and output, as the taps panel does
  7. The Scientist and Engineer's Guide to Digital Signal Processing - Steven W. Smith - free online textbook covering FIR filters and convolution