720 likes | 1.65k Views
“Adaptive Noise Reduction". Texas Instruments University Programme Teaching Materials. Adaptive Noise Reduction. Objectives. To develop a model of a noise reduction system using the Least Mean Squares (LMS) Algorithm To run the model on the Texas Instruments TMS320C5505 USB Stick.
E N D
“Adaptive Noise Reduction" Texas Instruments University Programme Teaching Materials
Objectives • To develop a model of a noise reduction system using the Least Mean Squares (LMS) Algorithm • To run the model on the Texas Instruments TMS320C5505 USB Stick.
Introduction • A simple question. What is “noise”? • In the audio sense, “noise” refers to any other signals besides those we want to listen to. • Click on the icon to hear noise:
Graphic Equaliser Analogy • An adaptive filter can be thought of as a self-adjusting graphic equaliser: Input x(n) Output y(n) Slider adjustment using the Error e(n)
Adaptive Filter Equation • The most common type of Adaptive Filter is a Finite Impulse Response Filter (FIR), with N variable coefficients w.
The LMS Equation • The Least Mean Squares Algorithm (LMS) updates each coefficient on a sample-by-sample basis based on the error e(n). • This equation minimises the power in the error e(n).
Why Error Squared? • Squaring the error has two useful effects: • It removes the sign of the error to give the magnitude • It makes the filter converge faster: • Suppose the error is 5. The square of the error is 25, which applies a much larger e(n) • When the filter is near its final value, the coefficients w(n) only change by a small amount.
Choosing the value of variable µ • The value of µ (mu) is critical. • If µ is too small, the filter reacts slowly. • If µ is too large, the filter resolution is poor. • The selected value of µ is a compromise.
Acoustic Noise Reduction: Two Microphones • A popular application of acoustic noise reduction is for headsets for pilots • This uses two microphones.
Acoustic Noise Reduction: One Microphone • Scheme suitable for the TMS320C5505 USB Stick.
Operation of Noise Reduction • Assumption: that speech s does not change quickly. In this case, s’ = s + phase shift • If the delay is longer than the size of the filter, then delayed version of the noise n’ is not the same as the noise n • The adaptive filter shapes the delayed speech s’ to make it as similar as possible to the reference speech s • Note that random noise cannot be shaped.
The Simulink Model • Adaptive noise reduction can be modelled using Simulink.
Setting the Step size (mu) • The rate of convergence of the LMS Algorithm is controlled by the “Step size (mu)”. • This is the critical variable. • Some textbooks use “BETA” for the Step size.
Trace of Input to Model • “Input” = Signal + Noise.
Trace of LMS Filter Output • “Output” starts at zero and grows.
Trace of LMS Filter Error • “Error” contains the noise.
Implementation Variables • There are 3 variables that need to be carefully selected: • Filter length (typically 30) • Number of samples delay (typically 50) • Step size mu (~typically 0.002). The fixed point implementation uses the Q15 format value 560.
Audio Signal: Filter Length 10 Input Distortion Filter Large Error Error
Audio Signal: Filter Length 20 Input Filter Error
Audio Signal: Delay 10 Samples Input Distortion Filter Delay Error
Audio Signal: Delay 50 Samples Input Filter Delay Error
Audio Signal: Delay 200 Samples Input Filter Delay Error
Sine Wave: mu 5600 Input Filter Noise generated Error
Implementing the LMS Algorithm • The file adaptive_filter_asm.asm contains the C-callable function adaptive_filter_asm(); • There are two inputs (desired and input) • There are two outputs (filter and error) • DSPLIB also provides an implementation of the LMS algorithm.
USB Stick Setup TMS320C5505 USB to PC Microphone Headphones
Installing the Application • Copy the the code provided in Application 11 Adaptive Noise Reduction to the workspace • Follow the steps previously given in Chapter 1 to set up a new project.
Setting up the TMS320C5505 USB Stick • Plug in a microphone and computer loudspeakers / headphones into the TMS320C5505 USB Stick • Put the microphone near to a source of audio noise e.g. an off-station radio, fan or hair dryer • Speak into the microphone • Listen to the output.
Changing System Parameters • Change the number of filter elements from 30 to see how many elements you need • Change the step-size (mu or BETA) from 560 to see how the LMS algorithm converges.
Change Sampling Frequency • Change the sampling frequency from 48000 Hz to 8000 Hz in main.c and LED_flasher.c • Is the noise reduction system more or less effective than before?
Questions • Why is the Least Mean Squares (LMS) algorithm used for adaptive noise reduction? • What is the most critical variable when using the LMS algorithm? • Why has an assembly language version of the LMS algorithm been used, rather than a C code version?
References • Digital Signal Processing, A Practical Approach by Emmanuel C. Ifeachor and Barrie W. Jervis. ISBN 0201-59619-9. • Digital Signal Processing with C and the TMS320C30 by Rulph Chassaing. ISBN 0-471-55780-3.