I have found out 20 dominant frequencies of a song by splitting it into 20 sound-clips and applying Fourier transform on each one of the sound-clips. Now I am trying to reconstruct the song back from these 20 dominant frequencies.
info_ = audioinfo('../wws.wav'); % 11 secs long song
Fs = info_.SampleRate;
chunkDuration = 0.6;
numSamplesPerChunk = chunkDuration*Fs;
freq_vec = [];
for startLoc = 1:numSamplesPerChunk:info_.TotalSamples
endLoc = min(startLoc + numSamplesPerChunk - 1, info_.TotalSamples);
[x, Fs] = audioread('../wws.wav', [startLoc endLoc]);
x = x(:,1);
dt = 1/Fs;
t = 0:dt:(length(x)*dt)-dt; % time scale
L = length(t);
nfft = 2^nextpow2(L);
y = fft(x, nfft);
y = abs(y.^2);
y = y(1:1+nfft/2);
[v,k] = max(y);
f_scale = (0:nfft/2)* Fs/nfft;
freq_vec = [freq_vec, f_scale(k)];
end
freq_vec is the vector of dominant frequencies of the song. My question is how can I use these frequencies to build back the song.