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.

Signal to Noise Measurement


Introduction

The signal-to-noise ratio of an audio signal gives a measurement of the quality of that signal. Signal-to-Noise ratio can be measured in real-time using statistics.
This laboratory shows how to evaluate a model of Signal-to-Noise Ratio measurement using Simulink® and run it on a Texas Instruments C6000 DSP.

Objectives

  • Run the Simulink model of signal-to-noise ratio measurement on a PC, to determine the optimum parameter settings.
  • Modify the Simulink model for real-time measurement of signal-to-noise ratio using the Texas Instruments C6713 DSK.
  • Run the project on the Texas Instruments C6713 DSK with a microphone and computer loudspeakers / headphones.

Level

Intermediate - Assumes prior knowledge of MATLAB® and Simulink. It also requires some understanding of statistics and some 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

Procedure

Opening the SignalToNoise Model

Start MATLAB 7.3.0 R2006b then open the SignalToNoise.mdl
Figure 1: Opening SignalToNoise Model
Figure 1 (graphics1.jpg)

Viewing the SignalToNoise Parent

The SignalToNoise parent is now displayed. Double-click on the Algorithm box.
Figure 2: SignalToNoise Parent
Figure 2 (graphics2.jpg)

Algorithm for Signal-to-Noise Ratio Measurement

The Signal-to-Noise Ratio algorithm is now displayed. Run the model.
Figure 3: Signal-to-Noise Ratio Algorithm
Figure 3 (fig3.jpg)

Output of the Model

Run the model.
Figure 4: Algorithm Output
Figure 4 (graphics4.jpg)
It will be seen that the output of the algorithm (“Unfiltered S/N”) varies from frame to frame. The next step is to fine-tune the algorithm parameters.

Tuning the Simulink Model

The model is run several times to determine the best values of the parameters:
  • To evaluate the algorithm accuracy for different frequencies
  • To determine the optimal frame length
  • To set the optimum delay time
  • To evaluate the effect of sampling frequency
  • To obtain a consistent algorithm output.

Evaluating the Algorithm Accuracy for Different Frequencies

Change the sine wave frequency from 500 Hz (default) to 1000 Hz then run the model several times. Make a note of the four different meter outputs (S/N Ratio from RMS Signals, Unfiltered S/N, Filtered S/N and Buffered).
Figure 5: Changing the Sine Wave Frequency
Figure 5 (graphics5.jpg)
Repeat using 1500Hz and 2000Hz.
Question: Does the input frequency of the Sine Wave have an effect on the accuracy of the algorithm? If it does, then it would be useful to put a digital filter at the input to the algorithm to limit the frequency band.

Sine Wave 300 Hz

Change the Sine Wave Frequency to 300Hz then run the model.
Figure 6: Setting the Sine Wave to 300 Hz
Figure 6 (graphics6.jpg)
Make a note of the accuracy of the model.

Changing the Frame Sizes

Increase the Samples per frame to 1024 in both the “Sine Wave” and the “Random Source” Blocks.
Figure 7: Adjusting Frame Size for Sine Wave
Figure 7 (graphics7.jpg)
Figure 8: Adjusting the Frame Size for the Random Source
Figure 8 (graphics8.jpg)
Run the model again.
Question: How does this change to the frame size affect performance?

Setting the Delay Value

Click on the “Delay” Block. Change the number of Delay (samples) to 50.
Figure 9: Setting the Delay (samples)
Figure 9 (graphics9.jpg)
Run the model again and make a note of the accuracy of the measurement.
Change Delay (samples)1 to 12 and run the model again.
Question: How does the value of delay (samples) affect the accuracy of the model?

Changing the Amount of Noise Present

Reload the original model to restore the initial settings.
Change the amount of Gain to make the gain 0.10 (10% noise).
Figure 10: Changing the Amount of Noise Present
Figure 10 (graphics10.jpg)
Run the model and make a note of the accuracy of the measurements. Repeat, but this time, use a gain of 0.01 (1% noise).
Question: Does the algorithm work better for high signal-to-noise ratios or for low signal-to-noise ratios? Make a note of the answer.

Changing the Sampling Frequency

Change the sample time in both the “Sine Wave” and the “Random Noise” blocks to 48000 Hz.
Figure 11: Changing the Sine Wave Sample Time
Figure 11 (graphics11.jpg)
Figure 12: Changing the Random Source Sample Time
Figure 12 (graphics12.jpg)
Run the model.
Question: Does the model produce better results with 8000Hz sampling or 48000 Hz sampling? Make a note of the answer.

The Fully Optimized Simulation

You should now know what are the optimum parameters for the simulation.
Set these parameters and run the model.

Summary of Simulation

You have now run the signal-to-noise ratio model and should be aware of the best settings for consistency of measurements, delay and sampling frequency.
You are now ready to go to the C6713 DSK Model.

Real-Time Model for TI C6713 DSK

Texas Instruments C6713 DSK Setup

Figure 13: Texas Instruments C6713 DSK Setup
Figure 13 (fig13.jpg)
Alternatively, you can use computer loudspeakers.

Starting Code Composer Studio

There are several stages required in order to implement the Signal-to-Noise measurement. These are now described.

Starting up Code Composer Studio

Start Code Composer Studio for C6713 DSK and use Debug -> Connect
Figure 14: Startup Screen for Code Composer Studio (CCS)
Figure 14 (fig14.jpg)

The Texas Instruments C6713 DSK Model

You will now use the knowledge you have gained during the PC Simulation to produce an optimized version of this algorithm for use with the Texas Instruments C6713 DSK.

Opening the C6713 DSK Model

Open the SignalToNoiseDSK6713.mdl.
The parent is shown in Figure 15.
Figure 15: SignalToNoiseDSK6713.mdl
Figure 15 (graphics15.jpg)
Double click on the “function()” block.

Viewing the Signal-to-Noise Measurement Algorithm

The details of the C6713 Algorithm are shown in Figure 16.
Figure 16: Audio Noise Gate
Figure 16 (fig16.jpg)

Setting the Sampling Rate and Frame Size

Double-click on the “Mic In C6713 DSK ADC” block.
Set the Sampling rate (Hz) and Samples per frame fields to the best value you found while carrying out the Simulation. The values may be different to those written here.
Figure 17: Setting the Sampling Rate and Frame Size
Figure 17 (graphics17.jpg)

Setting the Delay Size

Double-click on the “Delay” block. Set the Delay (samples) to the best value found during simulation. The value will not be 999!
Figure 18: Setting the Delay Size
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)

Building the Model

Selecting Real-Time Workshop

Select Tools -> Real-Time Workshop -> Build Model.
Figure 20: Building the Model
Figure 20 (graphics20.jpg)

The Completed Model Running on Code Composer Studio

From the folders on the left, select the source code for the project.
Figure 21: The Completed Model Running in Code Composer Studio
Figure 21 (fig21.jpg)

Different Settings on the C6713 DSK

Microphone Straight Through to Loudspeakers

To check out the microphone and loudspeakers, set the DIP switches on the C6713 DSK as follows:
Figure 22: Switch Position 0
Figure 22 (fig22.jpg)
The microphone is fed directly to the loudspeakers. There is no noise gate.

Switch Position for the Audio Noise Gate

To run the Audio Noise Gate, set the DIP switch to 1.
Figure 23: Switch Position 1 for Audio Noise Gate
Figure 23 (fig23.jpg)
Note that when you are not speaking, there is no audio output at all – just silence.

Modifying the Model

The next stage is to modify the model. You can change the smoothing filter. If the filter is too long, the delay will be noticeable.

Changing the Filter Type

Double-click on the “Lowpass” block. Change the Order to a value other than 10.
Figure 24: Changing the Number of Filter Elements
Figure 24 (graphics24.jpg)

Re-building the Model

Select Tools -> Real-Time Workshop -> Build Model.
Figure 25: Re-building the Model
Figure 25 (graphics25.jpg)

Running the Updated Model

Run the updated model and listen to the effect on the audio noise gate.

Some Things to Try

You may wish to experiment with different settings. Here are some suggestions.

Add an Input Filter

While running the Simulation, you will have noticed that the Signal-to-Noise Algorithm works better on some frequencies than others.
Add the appropriate filter to select only the frequencies where the algorithm works well.

Process Stereo Inputs

Change the input from “Microphone” to “Stereo Line Input”.
Add a second channel to make the processing stereo.

Best Signal Selection

When stage 3.2 has been completed, modify the model so that the output is the better of the two stereo inputs.
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.

FOOTNOTES

  1. The Delay (samples) should be smaller than the frame size, otherwise the frames do not overlap.

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.