chapter 3 echo and reverberation
TRANSCRIPT
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
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
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.
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
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
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
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.
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
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
+
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.
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.
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.
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
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
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.
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
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.
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.
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
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.
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
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.
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
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.
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
Chapter 3 - Slide Chapter 3 - Slide 2626© © 2010 Texas Instruments Inc 2010 Texas Instruments Inc © © 2010 Texas Instruments Inc 2010 Texas Instruments Inc
Console
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
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?
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
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?
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.
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?
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.