I need to identify the first few harmonics of a audio file by cancelling the noise of the specific signal. So I have partitioned the signal into 1024 Hz sample blocks and then took the FFT values of each block separately and finally add all FFT values and plot the waveform. Here is my matlab code. Somebody help me with the code since i cannot add the first block fft into total fft. Get an error. Please somebody help me
clc
clear
[signal,fs] =audioread('Female_55.wav'); %Only for plotting
t=0:1/fs:(length(signal)-1)/fs; %Only for plotting
fs0=fs/1024 %number of frequency blocks
t1=length(signal)/fs; %length of the waveform
s=1; %starting value
s1=1; %ending value
c1=1;
wavefft_tot= zeros(1025,1);
for blocks = 1:fs0
[signal1,fs1] =audioread('Female_55.wav',[s*c1 s1*1024]);
wavefft_next=abs(fft(signal1));
wavefft_prv=wavefft_next;
n=length(signal1)-1; %plotting information
f=0:fs1/n:fs1; %plotting information
if(s==1) && (c1==1)
c1=1;
s=1024;
s1=s1+1;
wavefft_tot= wavefft_next;
else
s1=s1+1;
c1=c1+1;
wavefft_tot=wavefft_tot+wavefft_prv;
end
end
figure(1);
plot(f,wavefft_tot);
xlabel('Frequency in Hz');
ylabel('Magnitude');
title('The Wave FFT');