TP-traitement-audio-visuel/TP10/TFCTT.m
2023-06-22 20:47:16 +02:00

23 lines
614 B
Matlab

function [Y, Y_plot, valeurs_tau, valeurs_f] = TFCTT(y, f_ech, n_fenetre, n_decalage, fenetre)
Y = buffer(y, n_fenetre, n_fenetre - n_decalage);
if fenetre == "hann"
f = hann(n_fenetre);
Y = Y .* f;
end
Y = fft(Y);
Y = Y(1:size(Y, 1) / 2, :);
valeurs_tau = 0:(1 / f_ech):(size(y, 1) / f_ech);
valeurs_f = 0:1 / size(Y, 1):f_ech;
% tronquage à 16kHz
seuil = 16000;
Y_plot = Y;
Y(floor(seuil / f_ech * size(Y, 1):end), :) = 0;
Y_plot(floor(seuil / f_ech * size(Y, 1):end), :) = mean(Y_plot(floor(seuil / f_ech * size(Y, 1):end), :), "all");
end