Acoustic Noise Cancellation

26
0 - 0 - 1 © 2007 Texas Instruments Inc, Content developed in partnership with Tel-Aviv University From MATLAB ® and Simulink ® to Real Time with TI DSPs Acoustic Noise Cancellation

Transcript of Acoustic Noise Cancellation

Page 1: Acoustic Noise Cancellation

0 - 0 - 11

© 2007 Texas Instruments Inc,

Content developed in partnership with Tel-Aviv University

From MATLAB® and Simulink® to Real Time with TI DSPs

Acoustic Noise Cancellation

Page 2: Acoustic Noise Cancellation

Slide Slide 22© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Objectives

• To develop a Simulink® model of a noise reduction system using the Least Mean Squares (LMS) Algorithm.

• To run the model on the Texas Instruments C6713 DSK.

Page 3: Acoustic Noise Cancellation

Slide Slide 33© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

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:

Page 4: Acoustic Noise Cancellation

Slide Slide 44© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Adaptive Filter Block Diagram

Adaptive Filter Block Diagram

d(n) Desired

y(n)

e(n)

+

-x(n)

Filter InputAdaptive Filter

e(n) Error Output

Filter Output

)()( e(n) nynd

Page 5: Acoustic Noise Cancellation

Slide Slide 55© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Adaptive Filter Equation

• The Adaptive Filter is a Finite Impulse Response Filter (FIR), with N variable coefficients w.

N

kk knxnw y(n)

0

)()(

Page 6: Acoustic Noise Cancellation

Slide Slide 66© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

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).

)()()( nxnenw 1)(nw kkk

Page 7: Acoustic Noise Cancellation

Slide Slide 77© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

The Least Mean Squares Algorithm

• 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.

Page 8: Acoustic Noise Cancellation

Slide Slide 88© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Audio Noise Reduction

• A popular application of acoustic noise reduction is for headsets for pilots. This uses two microphones.

Block Diagram of a Noise Reduction Headset

d(n) = speech + noise

y(n)

e(n)

+

-

x(n) = noise'

Adaptive Filter

e(n)Speech Output

Filter Output (noise)

Far Microphone

Near Microphone

Page 9: Acoustic Noise Cancellation

Slide Slide 99© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Noise Reduction using one Microphone

• This scheme is suitable for the C6713 DSK.

Adaptive Noise Reduction us ing a Single Input

d(n) = s + n

y(n)

e(n)

+

-

x(n) = s'+n'Adaptive Filter

e(n)Noise Output

n

Filter Outputs

Delay

Page 10: Acoustic Noise Cancellation

Slide Slide 1010© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Operation of C6713 Noise Reduction

• Assumption: that speech does not change quickly. In this case, s = s’ + phase shift.

• If the delay is longer than the size of the filter, then noise n ≠ n’.

• The Adaptive Filter shapes s’ to make it as similar as possible as it can to s.

• Random noise cannot be shaped.

Page 11: Acoustic Noise Cancellation

Slide Slide 1111© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Simulation

Page 12: Acoustic Noise Cancellation

Slide Slide 1212© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

The Simulink Model

• Open the following Simulink model: “AcousticNoiseCancellation”.

Page 13: Acoustic Noise Cancellation

Slide Slide 1313© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

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.

Page 14: Acoustic Noise Cancellation

Slide Slide 1414© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Trace of Input to Model

• “Input” = Signal + Noise.

Page 15: Acoustic Noise Cancellation

Slide Slide 1515© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Trace of LMS Filter Output

• “Output” starts at zero and grows.

Page 16: Acoustic Noise Cancellation

Slide Slide 1616© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Trace of LMS Filter Error

• “Error” contains the noise.

Page 17: Acoustic Noise Cancellation

Slide Slide 1717© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Introduction to Laboratory

Page 18: Acoustic Noise Cancellation

Slide Slide 1818© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Typical C6713 DSK Setup

USB to PC to +5V

Headphones Microphone

Page 19: Acoustic Noise Cancellation

Slide Slide 1919© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Modified Model for C6713 DSK • You will build the model

“AcousticNoiseReductionDSKC6713”.

Page 20: Acoustic Noise Cancellation

Slide Slide 2020© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Using Frames

• This model uses frames of data rather than individual bytes.

• The “Samples per frame” is set to 64.

Page 21: Acoustic Noise Cancellation

Slide Slide 2121© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Built Model Showing Frames

• When the model is built, the frames are shown as double lines.

Page 22: Acoustic Noise Cancellation

Slide Slide 2222© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Setting up the C6713 DSK

• Plug an microphone and computer loudspeakers / headphones into the C6713 DSK.

• Put the microphone next to a source of random noise e.g. an off-station radio.

• Speak into the microphone.

• Listen to the output.

Page 23: Acoustic Noise Cancellation

Slide Slide 2323© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Second Model for C6713 DSK • Open the model

“C6713_LMS_Noise_Reduction_Dual_Output”.

Page 24: Acoustic Noise Cancellation

Slide Slide 2424© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

The Second Simulink Model

• Uses a stereo signal:

– LMS Filter Output on one channel.

– LMS Filter Error on the other channel.

• Note that in order to process stereo data, the matrix “selector” and “matrix concatenation” must be used.

Page 25: Acoustic Noise Cancellation

Slide Slide 2525© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

Things You Can Try

• Change the number of filter elements from 32 to see how many elements you need.

• Change the step-size (mu) to see how the LMS converges.

• Try other adaptive filter algorithms e.g. RLS.

Page 26: Acoustic Noise Cancellation

Slide Slide 2626© © 2007 Texas Instruments Inc, 2007 Texas Instruments Inc,

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.