Introduction
Echo and Reverberation are two of the simplest applications of Digital Signal Processing (DSP). This laboratory shows how models of Echo and Reverberation can be designed using MATLAB and Simulink, and run them in real-time on the Texas Instruments C6000 DSPs.
Objectives
- Design models of Echo and Reverberation for the Texas Instruments C6000 family of DSP devices using MATLAB® and Simulink®.
- Modify an existing Simulink model.
- Run the model in real-time on the Texas Instruments C6713 DSK.
Level
Beginner - Assumes only very basic knowledge of MATLAB and Simulink. It is suitable for students with limited knowledge of Texas Instruments DSPs.
Hardware and Software Requirements
This laboratory was originally developed using the following hardware and software:
- MATLAB R2006b with Embedded Target for TI C6000.
- Code Composer Studio (CCS) v3.1
- Texas Instruments C6713 DSK hardware
- Microphone and computer loudspeakers/headphones
Related Files
- Powerpoint Presentation - EchoAndReverberation.ppt
- Simulink Model for Echo Simulation - EchoUsingWav.mdl
- Simulink Model for Reverberation Simulation - ReverberationUsingWav.mdl
- Simulink Model for Real-Time - EchoAndReverberationDSKC6713.mdl
- Audio Template for the DSK6713C6713_Audio_Template.mdl
Simulation
We shall start by running the Echo and Reverberation Simulink models. These use .wav files as the inputs.
Echo using Wave File
Opening the Echo Simulink Model
From MATLAB, open EchoUsingWav.mdl
Changing the Delay Time
Double-click on the “Delay” block and change the “Delay (samples)” to a different value.
Run the model and hear how the effect has changed. Try a few different settings between 100 and 20000 “Delay (samples)”.
Reverberation using Wave File
Opening the Reverberation Simulink Model
From MATLAB, open ReverberationUsingWav.mdl
Changing the Delay Time
Double-click on the “Delay” block. Change the “Delay (samples)” to a different value then run the model and listen to the effect.
Changing the Gain
Double-click on the “Gain” block. Change the “Gain” to 0.95 then run the model. Listen to the effect.
Questions
- Why does Reverberation require a shorter delay time than echo?
- What effect does the “Gain” block have on the stability of the reverberation system?
Real-Time Model for TI C6713 DSK
Texas Instruments C6713 DSK Setup
Alternatively, you can use computer loudspeakers.
Connect the C6713 hardware to a USB port of the computer and turn on the supply to the board.
If the board is powered, then the green LED lights on the board will come on during self-test.
Starting Code Composer Studio
The stages required to implement Echo and Reverberation are now described.
Starting Code Composer Studio
Start Code Composer Studio for C6713 DSK and use Debug -> Connect
Opening an Existing Model
Start MATLAB 7.3.0 R2006b
In the top left hand corner of the MATLAB screen, select File -> Open.
The following screen will appear.
Highlight “C6713_Audio_Template” then click on “Open”.
Viewing the “C6713 Audio Template”
The “C6713_Audio_Template” is now displayed.
Overview of the Complete Echo Subsystem
You are now going to implement the Echo Subsystem shown below.
Implementing the Echo Subsystem
Double click on the “Effect 1” subsystem block. An empty model will appear.
You will now drag-and-drop some library components onto the model.
The Simulink Library Browser – Commonly Used Blocks
Select View -> Library Browser. Expand the “Simulink” section.
A list of available blocks will appear. We are initially interested in the “Commonly Used Blocks”.
From “Commonly Used Blocks”, drag-and-drop a ”Gain” block, a “Sum” block and two “Data Type Conversion” blocks onto the model.
The Simulink Library Browser - Discrete
From the Simulink Library Browser, select “Discrete”. Highlight “Integer Delay” and drag-and-drop this block onto the model.
Setting the Integer Delay Time
The delay time will be 0.5 seconds. Using a sampling rate of 8000 Hz, this requires 8000 x 0.5 = 4000 samples. In the equation given in the lecture, this would make N = 4000.
Double click on the “Integer Delay” block. Change the “Number of delays” field to 4000, then click on “OK”.
Setting the Output Data Conversion to Single
We want to set the gain to 0.9. If you multiply an integer value by 0.9, then the value 0.9 will be rounded-down to zero. Instead, you need to convert the integer value to a floating-point value such as “single”, and then convert it back later. Click on “OK”.
Setting the Delay Gain
We required that 0.9 of the delayed input is added to the normal input. Therefore, set the “Gain” to 0.9 then click on “OK”.
Setting the Output Data Conversion to int16
Double click on the second “Data Type Conversion” block. Set the “Output data type mode” to int16. This is compatible with the DAC on the C6713 DSK.
The Completed Echo Subsystem
Join the blocks as shown and add a title.
Returning to the Parent System
From the Toolbar, select the “Up Arrow” icon. This returns you to the next higher level.
The Reverberation Subsystem
The next subsystem to be implemented will be Reverberation.
Overview of the Completed Reverberation Subsystem
We are now going to implement the Reverberation System shown below.
Note that the reverberation subsystem is very similar to that of echo. We will cut-and-paste from the Echo Subsystem
Opening the Effects 2 Subsystem
From the “C6713 Audio Template” top level, double-click on the “Effect 2” subsystem.
Copying a Block from the Echo Subsystem
Double click on the “ Effect 1” subsystem. Cut-and-paste a copy of the echo block as follows: while left-clicking the mouse, mark the area to be copied.
Release the left button on the mouse.
From pull-down menu, select Edit -> Copy (or Ctrl + C)
Blocks Dropped onto Effect 2 Subsystem
Return to the “Effect 2” subsystem and Edit -> Paste (Ctrl + V) into the model.
Flipping the Blocks
The blocks are facing the wrong way. Turn them round using Format -> Flip Block.
Changing the Integer Delay for Reverberation.
Because the sound goes round several times with reverberation, a shorter delay time can be used. Here the delay time is 0.1 seconds.
Set the “Number of delays” to 800 then click on “OK”.
Completing the Reverberation Subsystem
Connect the blocks as shown below. Change the title to “Reverberation Subsystem”.
Returning to the Parent System
From the Toolbar, select the “Up Arrow” icon. This returns you to the next higher level.
The Improved Echo Subsystem
The final subsystem to be implemented will be “Improved Echo”. This is based on the “Echo” subsystem, but with several delay paths.
The Complete Improved Echo Subsystem
Double click on the “Effect 3” subsystem box. The required components are shown below.
Implementing the Improved Echo Subsystem
You should now have enough knowledge to implement this subsystem block without further assistance. This time you are on your own!
Building the Model
Select Tools -> Real-Time Workshop -> Build Model.
Running the Model
Microphone Straight Through to Loudspeakers
To check out the microphone and loudspeakers, set the DIP switches on the C6713 DSK as follows:
The microphone is fed directly to the loudspeakers without any digital signal processing.
Switch Position for Echo
To run the “Echo” subsystem, set the DIP switch to 1.
Switch Position for Reverberation
To run the “Reverberation” subsystem, set the DIP switch to 2.
Switch Position for Improved Echo
To run the “Improved Echo” subsystem, set the DIP switch to 3.
Some Things to Try
Change the Echo Delay
Change the value of the “Integer Delay” block for echo. Listen to the effect of using short and long delays. Set the delay time to a large value and sing a round such as “Frere Jacques” or “Row, Row, Row your Boat”.
Change the Amount of Reverberation Gain
In the “Reverberation Subsystem” block, change the “Gain” from 0.8 to higher and lower values. Notice how the system can become unstable if the gain is too large.
Modify the Improved Echo Subsystem
In the “Improved Echo Subsystem”, you may wish to experiment with the number of delay elements, the delay times and the amounts of gain. Try to make the echo as realistic as possible.
Create Your Own Subsystem
Add your own subsystem block and add your own signal processing. You might want to design a subsystem with both echo and reverberation.
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be trademarks or registered trademarks of their respective holders.
0 comments:
Post a Comment