Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp-audio-ee-etudiant-v24ye
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
La purge estivale des projets de gitlab-df sera réalisée jeudi 10 juillet vers 10h.
Show more breadcrumbs
UEEE
sar-signal-audio
gr-vhdl-v24ye
tp-audio-ee-etudiant-v24ye
Commits
ab9b46bd
Commit
ab9b46bd
authored
1 month ago
by
YE Victor
Browse files
Options
Downloads
Patches
Plain Diff
Upload New File
parent
95e680b6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/SAR1Q2.m
+56
-0
56 additions, 0 deletions
src/SAR1Q2.m
with
56 additions
and
0 deletions
src/SAR1Q2.m
0 → 100644
+
56
−
0
View file @
ab9b46bd
%QUESTION 1.2
% Lire les deux fichiers audio
f1
=
fullfile
(
'wav'
,
'single_tone_piano1.wav'
)
f2
=
fullfile
(
'wav'
,
'single_tone_piano2.wav'
)
[
y1
,
Fs1
]
=
audioread
(
f1
);
[
y2
,
Fs2
]
=
audioread
(
f2
);
if
size
(
y1
,
2
)
==
2
y1
=
mean
(
y1
,
2
);
end
if
size
(
y2
,
2
)
==
2
y2
=
mean
(
y2
,
2
);
end
% Uniformiser la durée à 1 seconde max
N
=
min
([
length
(
y1
),
length
(
y2
),
Fs1
]);
y1
=
y1
(
1
:
N
);
y2
=
y2
(
1
:
N
);
% Pour obtenir un graphe avec moins d'artefacts de fréquence
window
=
hann
(
N
);
y1
=
y1
.*
window
;
y2
=
y2
.*
window
;
% FFT
Y1
=
fft
(
y1
);
Y2
=
fft
(
y2
);
% Spectres positifs
f
=
(
0
:
N
/
2
-
1
)
*
(
Fs1
/
N
);
mag1
=
abs
(
Y1
(
1
:
N
/
2
));
mag2
=
abs
(
Y2
(
1
:
N
/
2
));
% Normalisation
mag1
=
mag1
/
max
(
mag1
);
mag2
=
mag2
/
max
(
mag2
);
% Figure 1 pour piano1.wav
figure
;
semilogx
(
f
,
mag1
,
'b'
,
'LineWidth'
,
1.5
);
grid
on
;
xlabel
(
'Fréquence (Hz)'
);
ylabel
(
'Amplitude (linéaire)'
);
title
(
'Spectre de single_tone_piano1.wav'
);
xlim
([
20
Fs1
/
2
]);
datacursormode
on
;
% Figure 2 pour piano2.wav
figure
;
semilogx
(
f
,
mag2
,
'r'
,
'LineWidth'
,
1.5
);
grid
on
;
xlabel
(
'Fréquence (Hz)'
);
ylabel
(
'Amplitude (linéaire)'
);
title
(
'Spectre de single_tone_piano2.wav'
);
xlim
([
20
Fs1
/
2
]);
datacursormode
on
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment