Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp-audio-ee-etudiant-m24duboc
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
Show more breadcrumbs
UEEE
sar-signal-audio
gr-vhdl-m24duboc
tp-audio-ee-etudiant-m24duboc
Commits
586591e8
There was an error fetching the commit references. Please try again later.
Commit
586591e8
authored
1 month ago
by
GERBAUD Paul
Browse files
Options
Downloads
Patches
Plain Diff
Add new file
parent
4e45ee83
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
matlab 1.1
+39
-0
39 additions, 0 deletions
matlab 1.1
with
39 additions
and
0 deletions
matlab 1.1
0 → 100644
+
39
−
0
View file @
586591e8
% analyse_guitare.m
% Analyse du spectre d'un son de guitare (nylon-guitar.wav)
% Charger le fichier audio
[x, fe] = audioread('nylon-guitar.wav');
% Si le son est stereo, convertir en mono
if size(x,2) == 2
x = mean(x, 2);
end
% Nombre d'echantillons
N = length(x);
% Calcul de la FFT
X = fft(x);
% Deplacement du zero de la FFT au centre
X_shifted = fftshift(X);
% Axe des frequences
f = linspace(-fe/2, fe/2, N);
% Amplitude en dB
amplitude_dB = 20*log10(abs(X_shifted) + eps); % eps pour eviter log(0)
% Affichage du spectre
figure;
plot(f, amplitude_dB);
xlabel('Frequence (Hz)');
ylabel('Amplitude (dB)');
title('Spectre en amplitude de nylon-guitar.wav');
grid on;
xlim([-fe/2 fe/2]);
% Determination de la frequence fondamentale
[~, idx_max] = max(abs(X(1:floor(N/2)))); % Cherche sur les frequences positives
f1 = (idx_max-1) * fe/N;
disp(['Frequence fondamentale estimee : ', num2str(f1), ' Hz']);
\ 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