In: Electrical Engineering
By using MATLAB
1. Divide a speech signal or music signal into frames of size N
= 64.
2. Compute the N?point DFT of each frame.
3. Save only first L = 20 DFT coefficients.
4. Reconstruct the frame from these L coefficients. (Do not disturb
the symmetry
of DFT during inverse DFT computation. X[k] = X[N ?k] for real
signals, N = 64
here. Pad zeros for missing DFT coefficients.)
5. Comment on the quality of reconstructed and the original speech
signal.
6. What is the effective data compression ratio? Note that DFT
coefficients may be
complex valued!
7. Repeat the above experiment for L = 10 and L = 5.
##----------------------------matlab code-------------------------------------------------##
load chirp.mat; % sound signal
sound(y, Fs); %-------- number of sample sampling frequencey
plot(y(1:13056));
N=64;
L=20 %----------- number of coefficient you want to kept
number_frame=floor(length(y)/N); % number of frame
sample_sig=y(1:N); %-------------- frame with 64 sample
reconst_sig=[];
for i=0:number_frame-2
each_frame=y((i*N)+1:N*(i+1)) ; %--------------each frame
each_frame=each_frame' ; % transpose of value
fft_frame=abs(fft(each_frame,N)); % fft of each frame
fft_val=fft_frame(1:L); % first 20 point
new_sig=[fft_val,zeros(1,N-L)]; % rest value with zero
padding
reconst = real(ifft(new_sig,N)); % inverse fourier transform
reconst_sig=[reconst_sig,reconst]; % reconstructed sppech.
end
hold on
plot(reconst_sig);
sound(reconst_sig, Fs);
##----------------Here the blue signal is the original signal and the red signal reconstructed signal.
##-----for L=20
##----------- for L=10;
##-----for L=5
##------------------------L=40
##-----------By reducing the the number of coefficient reconstructed signal is degraded.