8/19/2019 Assignment2 Report
1/15
1
PRINCIPLES DIGITAL AUDIO AND VIDEO
ASSIGNMENT 2
ADIL SHAH 1600228
Q1 A TRIANGULAR
fs = 44100; [y fs] = wavread('Triangular'); plot(y); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
8/19/2019 Assignment2 Report
2/15
2
Q1 B SAW TOOTH
fs = 44100,
[y fs] = wavread('Saw Tooth'); plot(y); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
8/19/2019 Assignment2 Report
3/15
3
Q1 C IMPULSE
fs = 44100, [y fs] = wavread('Impulse'); plot(y); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
8/19/2019 Assignment2 Report
4/15
4
Q1 D WHITE NOISE
fs = 44100, [y fs] = wavread('White Noise'); plot(y); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
8/19/2019 Assignment2 Report
5/15
5
NOISE Q1 E PINK
fs = 44100, [y fs] = wavread('Pink Noise'); plot(y); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
8/19/2019 Assignment2 Report
6/15
6
Q1 F DIAL TONE
fs = 11025, [y fs] = wavread('Dial_tone'); plot(y); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
8/19/2019 Assignment2 Report
7/15
7
Q1 G MISSILE
fs = 11025, [y fs] = wavread('Missile'); plot(y); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
8/19/2019 Assignment2 Report
8/15
8
Q1 H MUSIC
fs = 44100, [y fs] = wavread('Music'); plot(y); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
8/19/2019 Assignment2 Report
9/15
9
Q1 I SINES
fs = 16000, [y fs] = wavread('Sines'); plot(y); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
8/19/2019 Assignment2 Report
10/15
10
Q1 J SQUARE WAVE OF FREQUENCY 1000 HZ
i=1:1000; for n=1:10000
if(mod(n,10)>=5) y(n)=1;
else y(n)=0;
end end fs = 10000; sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x)
8/19/2019 Assignment2 Report
11/15
11
Q3 SQUARE WAVE OF FREQUENCY 5 HZ AND AMPLITUDE 1
FOURIER SPECTRUM OF THE SQUARE WAVE
8/19/2019 Assignment2 Report
12/15
12
Phase plot for the first three harmonics
Phase plot of first six harmonics
THE OSCILLATIONS IN THE PEAKS OF THE PHASE PLOT CLEARLY INDICATE THE DIFFERENCE BETWEENTHE TWO HARMONICS
8/19/2019 Assignment2 Report
13/15
13
CODEclear all t=0:0.001:10; for n=1:length(t)
if(mod(t(n),0.2)
8/19/2019 Assignment2 Report
14/15
14
Question # 2
[y fs] = wavread('audio1'); sound(y,fs); x = fftshift(abs(fft(y)))/length(y); plot(x);
Fourier spectrum of first file.
Listening to audio and plotting the spectrum shows that it contains only one frequency.
8/19/2019 Assignment2 Report
15/15
15
Fourier spectrum of second audio file.
Listening to audio one can slightly guess that it has two frequencies.
Moreover, Zooming into the plot makes it clear that there are two frequencies. The second peak is at
0.0025 with an amplitude of 0.25 which is 0.01 tunes the amplitude of the first peak.
clear all fs = 8000; [y fs] = wavread('audio2');
sound(y,fs); x = fftshift(abs(fft(y)))/length(y); stem(x);
Recommended