chapter 3 echo and reverberation

33
0 - 0 - 1 © 2010 Texas Instruments Inc Practical Audio Experiments using the TMS320C5505 USB Stick © 2010 Texas Instruments Inc “Echo and Reverberation" Texas Instruments University Programme Teaching Materials

Upload: douglas-mangini

Post on 01-Dec-2015

52 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Chapter 3 Echo and Reverberation

0 - 0 - 11

© 2010 Texas Instruments Inc

Practical Audio Experiments using the TMS320C5505 USB Stick

© 2010 Texas Instruments Inc

“Echo and Reverberation"

Texas Instruments University Programme

Teaching Materials

Page 2: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 22© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Echo and Reverberation

Page 3: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 33© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Objectives

• To explain echo and reverberation

• To implement them in C code

• To test the models using the Texas Instruments TMS320C5505 USB Stick with a microphone and headphones/computer loudspeakers.

Page 4: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 44© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Echo

• Echo is audible because the speed of sound is relatively slow, about 400 meters per second

• Click on icon to listen to echo.

Sound Source

Listener

DirectSound

Echo

Page 5: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 55© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Block Diagram of Echo

• For the time being, we will consider only one echo path

• Output = Input + Delayed Input

• Because of losses in the delayed path, Gain < 1.

Delay

Input +

+

Simplified Echo

GainDelayed Input

Output

Page 6: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 66© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Equation for Simplified Echo

)1)((

)( )()(N

N

Gznx

znGxnxny

z-N

x(n) y(n)+

+

Simplified Echo

G.x(n)z -NG

Page 7: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 77© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Frequency Response

• The frequency response of echo can be calculated using the following Matlab .m file.

Page 8: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 88© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Frequency Response of Echo

Page 9: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 99© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Multiple Echo Paths

• A real room will have several echo paths.

Delay1

Input

+

+

Multiple Echo Paths

Gain1De layed Input 1 Output

Delay2 Gain2De layed Input 2

+

Page 10: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1010© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Summary of Echo

• The Echo output is derived solely from the input

• Certain frequencies are attenuated

• Because the poles lie inside the unit circle, echo is stable.

Page 11: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1111© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Reverberation

• Reverberation is similar to echo, but uses a slightly different configuration

• Click on the icon to hear reverberation.

Page 12: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1212© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Reverberation on Stage

Microphone

Performer

LoudspeakerLoudspeaker

Sound reaches the microphone from both the performer and the the loudspeakers.

Page 13: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1313© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Block Diagram of Reverberation

• Output = Input + Delayed Output

Delay

Input Output+

+

Delayed Output

Simplified Reverberation

Gain

Page 14: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1414© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Simplified Reverberation Equation

)1/()(

)( )()(N

N

Gznx

znGynxny

z-N

x(n) y(n)+

+

Gy(n)z-N

Simplified Reverberation

G

Page 15: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1515© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Matlab Model of Reverberation

Using Matlab, the frequency response of reverberation can be calculated using the following .m file.

Page 16: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1616© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Reverberation Frequency Response

Page 17: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1717© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Summary of Reverberation • The output is derived from both the input and the previous output

• At certain frequencies, the output will be amplified

• Because the poles lie on the unit circle, reverberation can become unstable.

Page 18: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1818© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Real World Echo and Reverberation • A real room will have several echo paths

• When sound is reflected off a surface there will be “coloration”. Certain frequencies will be absorbed and there will be phase changes

• Therefore, a commercial echo / reverberation unit will contain many different delay paths.

Page 19: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 1919© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

C Code Implementation

Page 20: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2020© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

C Code Implementation

• This laboratory uses a sampling rate of 24000 Hz rather than 48000 Hz

• This allows longer delay times to be implemented

• The echo and delay buffers are implemented as circular buffers.

Page 21: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2121© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Introduction to Laboratory

Page 22: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2222© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Practical Echo and Reverberation

• In the Laboratory you will build a C code implementation for echo and reverberation

• You will be able to run different echo and reverberation effects on the TMS320C5505 USB Stick.

Page 23: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2323© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

USB Stick Setup TMS320C5505

USB to PC

Headphones

Microphone

Page 24: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2424© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Installing the Application

• Copy the code from Application 3 Echo and Reverberation to the workspace

• Follow the steps previously given in Chapter 1 to set up the new project.

Page 25: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2525© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Files In Project

Page 26: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2626© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Console

Page 27: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2727© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Changing Echo Buffer Length

Page 28: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2828© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Adjusting the Echo

• In the file echo.c, change the size of the delay buffer N

• How does the echo effect change as the value of N is decreased and increased?

• What is the maximum value of N supported by the hardware?

Page 29: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 2929© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Changing the Reverberation Buffer Length

Page 30: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 3030© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Adjusting the Reverberation

• In the file reverberation.c, change the value of N to change the reverberation buffer length. The current value is 200ms

• Change the value of DEPTH between 0 and 32767. Listen to the effect

• Question: What happens when DEPTH is 32767, that is 100% is fed back?

Page 31: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 3131© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Programming Challenge

• In the real world there are multiple echo and reverberation paths

• Write your own code to combine both echo and reverberation.

Page 32: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 3232© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

Questions

• What are the differences between echo and reverberation?

• Which of echo and reverberation requires the least memory to write your program?

• How would you ensure that reverberation remains stable?

Page 33: Chapter 3 Echo and Reverberation

Chapter 3 - Slide Chapter 3 - Slide 3333© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc

References

• A Digital Signal Processing Primer by Ken Steiglitz. ISBN 0-8053-1684-1.