Digital Signal Processing Lab 5 NLMS adaptive filtering
Digital Signal Processing Lab 5: NLMS adaptive filtering in Matlab Toon van Waterschoot, Marc Moonen ESAT – Departement of Electrical Engineering KU Leuven, Belgium
Digital Signal Processing: Lab Sessions • Session 1: Signal generation & analysis in Matlab • Session 2: Embedded DSP implementation of energy-based voice • • • activity detector Session 3: Filter analysis & implementation in Matlab Session 4: Embedded DSP implementation of FIR filter Session 5: NLMS adaptive filtering in Matlab Session 6: Embedded DSP implementation of NLMS adaptive filter Session 7: Embedded DSP implementation of acoustic echo canceller 2 Image source: bigdata-madesimple. com
Acoustic Echo Cancellation • One of the most exemplary applications of adaptive filtering is acoustic echo cancellation (AEC) • In a hands-free voice communication scenario, the loudspeaker signal is fed back to the microphone through direct acoustic coupling as well as acoustic reflections • AEC is possible by estimating an acoustic echo path model to predict and subtract an echo signal estimate echo path model − + 3 echo path
NLMS adaptive filtering • Two particularly popular adaptive filtering algorithms are - Least Mean Squares (LMS) algorithm - Normalized Least Mean Squares (NLMS) algorithm • Both algorithms recursively estimate a length-L FIR echo path model using a length-L input signal buffer and an “a priori” error signal computed from the microphone signal y 4
NLMS adaptive filtering • Both LMS and NLMS can produce an echo-compensated signal • The LMS and NLMS algorithms require careful tuning of - - the step size parameter the regularization parameter (NLMS only) • The choice of these parameters is typically based on a trade-off between - - convergence speed steady-state error variance 5
NLMS adaptive filtering in Matlab • Experiment 5. 1: Measurement of laptop echo path - - - Download and unzip the folder Exp 5. 1. Use the function expsweep to generate an exponential sine sweep (ESS) signal of length 2 s, sweeping from 100 Hz to 7500 Hz, sampled at 16 k. Hz. Install Audacity or any other audio player that can simultaneously play back and record audio. Import the ESS signal into Audacity, make sure software playthrough is turned off, and hit the record button. Export the recording to a WAV file and read it into Matlab. Use the function sweep. IR function to calculate the echo path impulse response from the recorded signal. 6
NLMS adaptive filtering in Matlab • Exercise 5. 1: Analysis/simulation of laptop echo path - - - Plot the impulse response and the frequency response of the measured echo path. Take your time to interpret the results and compare with your colleagues. Note that the results for different laptops may be very different! Download the WAV file Ex 5_1. wav. Read the WAV file into Matlab and filter the resulting speech signal with the measured echo path. Listen to the original speech and the filtered speech. How do they differ? Generate a Gaussian white noise signal of 60 s, sampled at 16 k. Hz and filter it with the measured echo path. 7
NLMS adaptive filtering in Matlab • Exercise 5. 2: LMS adaptive filter driven by white noise - - Write a Matlab algorithm that applies the LMS algorithm with the Gaussian white noise signal as its input signal, and the filtered Gaussian white noise signal as its microphone signal. For each recursion of the LMS algorithm, compute the “misalignment” = squared difference between the estimated echo path model and the true echo path. At the end of the experiment, plot the misaligment vs. the recursion index. Repeat this procedure for different values of the step size parameter in the range , and plot the resulting misalignment curves on top of each other. What does this tell you about the choice of the step size? Plot and play back the echo-compensated signal. 8
NLMS adaptive filtering in Matlab • Exercise 5. 3: (N)LMS adaptive filter driven by speech - - Modify the Matlab algorithm such that it takes the speech signal as its input and the filtered speech signal as its microphone signal. Redo the misadjustment comparison for different step size values. What do you conclude? Modify the LMS algorithm into an NLMS algorithm, and repeat the misadjustment comparison for different step size values using a fixed regularization parameter. Plot and play back the echo-compensated signals resulting from LMS and NLMS. Can you explain the difference between the LMS and NLMS behavior? Which is more suitable for speech and why? 9
- Slides: 9