Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

ECE471

Lab#3
Voice Recording and FFT (20points)

Due: 3/27/2015

This lab exercise will show you how to record and play back audible messages in Matlab. You need to
perform spectrum analysis for the recorded voice and conduct some signal processing as you wish. You
will look at the effect of changing the sampling rate of the recorded signal and adding interferences at
different frequencies.
Lab assignment
1. Record your voice by using a microphone and the following Matlab code. Paste the following
Matlab code into an XXX.m file and run the program. When you hit run you the program will look
as though it has froze, this is when you need to speak into the microphone and you will have only 2
seconds. You can increase the recording time by changing the constant in the wavrecord()
function.
uint8 Fs;
Fs = 44100;
y = wavrecord(2*Fs,Fs);
wavplay(y,Fs);
y=y';

% sampling rate
% take 2*Fs samples, and save to variable y,
% play your voice

2. Examine the time domain plot to see what the voice signal looks like. Increase the volume of the
recorded signal by multiplying the signal by a constant that you choose.
3. Define three different frequencies that you will add as interference to the voice signal. Use (30,
3200, 4800) Hz since these fall in the audible range of frequencies and you want to be able to listen
to what the interference sounds like.
4. Set up the timing that will be used in the interference generation. Use the following Matlab code
and be sure to change the constant (2 in this case) to the amount of time that you recorded. Note
f1, f2, f3 are the frequencies that were set in step 3.
n1 = 0.5*sin(2*pi*f1*t); %interference at a specific frequency
n2 = 0.25*sin(2*pi*f2*t); % interference at a specific frequency
n3 = 0.3*sin(2*pi*f3*t); % interference at a specific frequency
5. Add the interference to the voice signal by summing them all together with the original signal.
6. Plot the time domain representation of the original signal, just the interference (n1+n2+n3), and all
the signals summed together.
7. Take the fft of the just the original signal and also of the noisy signal that has been summed
together.
8. Plot the magnitude of these two sets of data and identify the interference that was added to the
original signal.
9. Playback original voice and noisy voice.
10. Use fft to analyze the signal stored in lab3.mat ( download lab3.zip from D2L and unzip it ) and
plot its amplitude spectrum (Sampling rate is 2kHz). The analog signal is given as
x = cos(280t)+0.5cos(2150t)+0.8cos(2265t)+1.2cos(2380t);
11. Identify the frequency for each component in your plot. Explain the difference between your
results and the true frequencies.

You might also like