Loading documents preview...
Practical Audio Experiments using the TMS320C5505 USB Stick
“Echo and Reverberation" Texas Instruments University Programme Teaching Materials
© 2010 Texas Instruments Inc
0-1
Echo and Reverberation
© 2010 Texas Instruments Inc
Chapter 3 - Slide 2
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.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 3
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
Direct Sound Echo
Listener © 2010 Texas Instruments Inc
Chapter 3 - Slide 4
Block Diagram of Echo • For the time being, we will consider only one echo path
• Output = Input + Delayed Input Simplified Echo Input
Output
+ + Delay
Gain Delayed Input
• Because of losses in the delayed path, Gain < 1. © 2010 Texas Instruments Inc
Chapter 3 - Slide 5
Equation for Simplified Echo Simplified Echo x(n)
y(n)
+ + z-N
G
G.x(n)z -N
y (n) x(n) Gx(n) z x(n)(1 Gz © 2010 Texas Instruments Inc
N
N
) Chapter 3 - Slide 6
Frequency Response • The frequency response of echo can be calculated using the following Matlab .m file.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 7
Frequency Response of Echo
© 2010 Texas Instruments Inc
Chapter 3 - Slide 8
Multiple Echo Paths • A real room will have several echo paths. Multiple Echo Paths Input
+ Output
Delayed Input 1 Delay1
Gain1
+ + Delayed Input 2
Delay2
© 2010 Texas Instruments Inc
Gain2
Chapter 3 - Slide 9
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.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 10
Reverberation • Reverberation is similar to echo, but uses a slightly different configuration • Click on the icon to hear reverberation.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 11
Reverberation on Stage Sound reaches the microphone from both the performer and the the loudspeakers.
Loudspeaker
Loudspeaker Performer
Microphone
© 2010 Texas Instruments Inc
Chapter 3 - Slide 12
Block Diagram of Reverberation
• Output = Input + Delayed Output
Simplified Reverberation Input
+
Output + Gain
Delay
Delayed Output
© 2010 Texas Instruments Inc
Chapter 3 - Slide 13
Simplified Reverberation Equation Simplified Reverberation x(n)
+
y(n) + G
Gy(n)z-N
z-N
y (n) x(n) Gy(n) z x(n) /(1 Gz © 2010 Texas Instruments Inc
N
N
) Chapter 3 - Slide 14
Matlab Model of Reverberation Using Matlab, the frequency response of reverberation can be calculated using the following .m file.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 15
Reverberation Frequency Response
© 2010 Texas Instruments Inc
Chapter 3 - Slide 16
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.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 17
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.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 18
C Code Implementation
© 2010 Texas Instruments Inc
Chapter 3 - Slide 19
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.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 20
Introduction to Laboratory
© 2010 Texas Instruments Inc
Chapter 3 - Slide 21
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.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 22
USB Stick Setup TMS320C5505 USB to PC Microphone Headphones
© 2010 Texas Instruments Inc
Chapter 3 - Slide 23
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.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 24
Files In Project
© 2010 Texas Instruments Inc
Chapter 3 - Slide 25
Console
© 2010 Texas Instruments Inc
Chapter 3 - Slide 26
Changing Echo Buffer Length
© 2010 Texas Instruments Inc
Chapter 3 - Slide 27
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?
© 2010 Texas Instruments Inc
Chapter 3 - Slide 28
Changing the Reverberation Buffer Length
© 2010 Texas Instruments Inc
Chapter 3 - Slide 29
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?
© 2010 Texas Instruments Inc
Chapter 3 - Slide 30
Programming Challenge • In the real world there are multiple echo and reverberation paths • Write your own code to combine both echo and reverberation.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 31
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?
© 2010 Texas Instruments Inc
Chapter 3 - Slide 32
References • A Digital Signal Processing Primer by Ken Steiglitz. ISBN 0-8053-1684-1.
© 2010 Texas Instruments Inc
Chapter 3 - Slide 33