Problems with Matlab Projects? You may face many Problems, but do not worry we are ready to solve your Problems. All you need to do is just leave your Comments. We will assure you that you will find a solution to your project along with future tips. On Request we will Mail you Matlab Codes for Registered Members of this site only, at free service...Follow Me.

Echo and Reverberation

Summary: This module shows how to implement the echo and reverberation effects using the DSK6713. The effects are simulated using Simulink. Those simualtion models are used to generate the DSP code for the real-time implementation.





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

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
Figure 1: Echo using .wav File
Figure 1 (graphics1.jpg)

Changing the Delay Time

Double-click on the “Delay” block and change the “Delay (samples)” to a different value.
Figure 2: Changing the Delay Time
Figure 2 (graphics2.jpg)
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
Figure 3: Reverberaton Using .wav File
Figure 3 (graphics3.jpg)

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.
Figure 4: Changing the Reverberation Gain
Figure 4 (graphics4.jpg)

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

Figure 5: Texas Instruments C6713 DSK Setup
Figure 5 (ngraphics5.jpg)
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
Figure 6: Startup Screen for Code Composer Studio (CCS)
Figure 6 (ngraphics6.jpg)

Opening an Existing Model

Start MATLAB 7.3.0 R2006b
In the top left hand corner of the MATLAB screen, select File -> Open.
Figure 7: Opening an Existing Model(CCS)
Figure 7 (graphics7.jpg)
The following screen will appear.
Figure 8: Selecting an Existing Model
Figure 8 (graphics8.jpg)
Highlight “C6713_Audio_Template” then click on “Open”.

Viewing the “C6713 Audio Template”

The “C6713_Audio_Template” is now displayed.
Figure 9: The C6713 DSK Audio Template>
Figure 9 (graphics9.jpg)

Overview of the Complete Echo Subsystem

You are now going to implement the Echo Subsystem shown below.
Figure 10: The Complete Echo Subsytem
Figure 10 (graphics10.jpg)

Implementing the Echo Subsystem

Double click on the “Effect 1” subsystem block. An empty model will appear.
Figure 11: The Blank “Effect 1” Subsystem
Figure 11 (graphics11.jpg)
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”.
Figure 12: Commonly Used Blocks
Figure 12 (graphics12.png)
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.
Figure 13: Blocks
Figure 13 (graphics13.jpg)

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”.
Figure 14: Setting the Integer Delay Time
Figure 14 (graphics14.jpg)

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”.
Figure 15: Setting the Data Conversion to Single
Figure 15 (graphics15.jpg)

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”.
Figure 16: Setting the Echo Delay Gain
Figure 16 (graphics16.jpg)

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.
Figure 17: Data Type Conversion to 16-bit Integer
Figure 17 (graphics17.jpg)

The Completed Echo Subsystem

Join the blocks as shown and add a title.
Figure 18: Joining the Blocks
Figure 18 (graphics18.jpg)

Returning to the Parent System

From the Toolbar, select the “Up Arrow” icon. This returns you to the next higher level.
Figure 19: Returning to the Parent System
Figure 19 (graphics19.jpg)

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.
Figure 20: Overview of the Reverberation Subsystem
Figure 20 (graphics20.jpg)
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.
Figure 21: The Blank “Effect 2” Subsystem
Figure 21 (graphics21.jpg)

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.
Figure 22: Outlining the Block to be Copied
Figure 22 (graphics22.jpg)
Release the left button on the mouse.
Figure 23: Block to be Copied is Marked
Figure 23 (graphics23.jpg)
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.
Figure 24: Blocks Dropped onto Subsystem
Figure 24 (graphics24.jpg)

Flipping the Blocks

The blocks are facing the wrong way. Turn them round using Format -> Flip Block.
Figure 25: Flipping the Blocks
Figure 25 (graphics25.png)

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.
Figure 26: Delay Time for Reverberation
Figure 26 (graphics26.jpg)
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”.
Figure 27: The Completed Reverberation Subsystem
Figure 27 (graphics27.jpg)

Returning to the Parent System

From the Toolbar, select the “Up Arrow” icon. This returns you to the next higher level.
Figure 28: Returning to the Parent System
Figure 28 (graphics28.jpg)

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.
Figure 29: The Improved Echo Subsystem
Figure 29 (graphics29.jpg)

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.
Figure 30: Building the Model
Figure 30 (graphics30.jpg)

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:
Figure 31: Switch Position 0
Figure 31 (ngraphics31.jpg)
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.
Figure 32: Switch Position 1 for Echo
Figure 32 (ngraphics32.jpg)

Switch Position for Reverberation

To run the “Reverberation” subsystem, set the DIP switch to 2.
Figure 33: Switch Position 2 for Reverberation
Figure 33 (ngraphics33.jpg)

Switch Position for Improved Echo

To run the “Improved Echo” subsystem, set the DIP switch to 3.
Figure 34: Switch Position 3 for Improved Echo
Figure 34 (ngraphics34.jpg)

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

Recent Comments

Popular Matlab Topics

Share your knowledge - help others

Crazy over Matlab Projects ? - Join Now - Follow Me

Sites U Missed to Visit ?

Related Posts Plugin for WordPress, Blogger...

Latest Articles

Special Search For Matlab Projects

MATLAB PROJECTS

counter

Bharadwaj. Powered by Blogger.