Skip to content
Snippets Groups Projects
Commit 1afbf416 authored by HENRY Chloe's avatar HENRY Chloe
Browse files

Upload New File

parent 4e45ee83
Branches main
No related tags found
No related merge requests found
%Question 1.1
[x,fe]=audioread("wav/single_tone_guitar_nylon_string_a2.wav");
soundsc(x,fe);
L=length(x);
Y=fft(x);
F=0:fe/L:fe-fe/L;
figure(1);
clf;
plot(F,abs(Y),'rd-');
grid;
xlabel('f(HZ)');
ylabel('fft_guitare');
[x2,fe2]=audioread("wav/single_tone_sax-alto-a3.wav");
soundsc(x2,fe2);
L2=length(x2);
Y2=fft(x2);
F2=0:fe2/L2:fe2-fe2/L2;
figure(2);
clf;
plot(F2,abs(Y2),'rd-');
grid;
xlabel('f(HZ)');
ylabel('fft-saxo');
%Question 1.2
[xp1,fep1]=audioread("wav/single_tone_piano1.wav");
soundsc(xp1,fep1);
Lp1=length(xp1);
Yp1=fft(xp1);
Fp1=0:fep1/Lp1:fep1-fep1/Lp1;
[xp2,fep2]=audioread("wav/single_tone_piano2.wav");
soundsc(xp2,fep2);
Lp2=length(xp2);
Yp2=fft(xp2);
Fp2=0:fep2/Lp2:fep2-fep2/Lp2;
figure(3);
clf;
plot(Fp1, 20*log10(abs(Yp1)),'b-',Fp2,20*log10(abs(Yp2)),'r-');
grid;
xlabel('f(HZ)');
ylabel('fft');
legend ('piano1','piano2');
%Question 1.3
figure(4);
clf;
plot(Fp1, abs(Yp1),'b-');
grid;
xlabel('f(HZ)');
ylabel('fft-piano-harmonieux');
%Question 1.4
t=0:fep1:2
list_f=[221 442 663 885 1108 1331 1556 1782]
liste_a=[7287.97 5565.18 1088.64 1414.52 980.919 671.72 528.634 101.402]
for k=1:8,
s=s+ liste_a(1,k).*sin(2* pi * list_f(1,k)*t)
end,
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment