I have been given the task of doing audio compression using FFT. The assignment is below.
Below is my MATLAB code:
% part 1
[y, f] = audioread('file.wav');
y = y(1:1024*161);
% p = audioplayer(y,f);
% play(p)
Ya = fft(y);
Y = fftshift(abs(Ya));
N = length(Y);
w = -f/2+f/N:f/N:f/2;
figure(1)
plot(w,Y)
% part 2
Y1 = Ya((N/4):(3*N/4));
% part 3
y = ifft(Y1);
player = audioplayer(y,f);
play(player)
Now here is my problem. I was able to do part 1 and part 2 perfectly with no problem, but for part 3 the problem begins. I get no sound at all!!. Now in the prompt it asks to do FFTSHIFT before the IFFT, to me that does not matter, either how I get now sound. can somebody help me on how to fix this please?