Skip to content
Snippets Groups Projects
Commit 1e0146c5 authored by BOUZID Adam's avatar BOUZID Adam
Browse files

Update file Q_2_4.m

parent 0e1a7695
No related branches found
No related tags found
No related merge requests found
% Appel de la fonction simulée
x_sim = simule_piece(xe1, fe);
clear all
close all
% Corrélation croisée
[xc, lags] = xcorr(x_sim, xe1);
% ----- Chargement du signal réel -----
[x1, fe] = audioread("single_tone_cello-a3.wav");
x1 = x1(:,1); % Un seul canal si stéréo
x1 = x1(:); % Forcer en vecteur colonne
% Axe temporel en secondes
lags_time = lags / fe;
% ----- Conception du filtre -----
d = designfilt('lowpassfir', 'FilterOrder', 10, ...
'HalfPowerFrequency', 0.27);
% Affichage
figure;
plot(lags_time, xc);
xlabel('Décalage temporel (s)');
ylabel('Corrélation croisée');
title('réponse impulsionnelle');
grid on;
\ No newline at end of file
% ----- Application du filtre -----
x_filt = filter(d, x1);
% ----- Normalisation -----
x_filt = x_filt / max(abs(x_filt));
% ----- Écoute -----
sound(x1, fe); pause(2);
disp('Lecture : signal filtré avec filtre FIR amortisseur');
soundsc(x_filt, fe); pause(2);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment