After calculating the Fourier transform of a signal, I would like to recover the fundamental frequency as well as the harmonics of the recorded sound to determine its timbre.
Here is my code :
[signal,fe] = audioread('Flute6.wav');
subplot(2,1,1);
plot(signal);
N = length(signal);
t=(0:N-1)/fe;
f = (0:N-1)/N *fe;
f(f>=fe/2)=f(f>=fe/2)-fe;
f=fftshift(f);
X = fft(signal)/N;
X=fftshift(X);
%*************************************************%
xlim([10000,11000])
title('tracer du signal de base en fonction du temps');
subplot(2,1,2);
plot(f,abs(X));
xlim([-5000,5000]);
xlabel('frequence en hz');
ylabel('|signal(t)|');
title('tracer de la transformée de fourier');
The first high peak, named Fo
, is the fundamental frequency, the other peaks are the harmonics that appear at k*Fo
k in {1,...,N} .
I want a method that returns the amplitude of the fundamental as well as its frequency, and all the amplitudes and frequencies of the other peaks.
How can I find the peaks in my signal, as well as their frequencies and amplitudes?