I fixed the code of @Fat32 because there were two mistakes. The first one is a missing parenthesis. The second one is the reconstruction of the signal from the entire piece. Here is the correct versiona MATLAB experiment for phase:
[x Fs Nbit]= wavread('test.wav',1024*100); % Get a piece of song ;) x = x(:,1); % Get a single channel Y = abs(fft(x)); % Take FFT of the entire piece at once! y = real(ifft(Y)); % Throw away all-phase information and reconstruct y y2 = zeros(1,length(x)); % NOW: we will process in BLOCKS! for i=1:1024:100*1024 % get a block, take its fft, reconstruct a block from fft magnitude y2(i:i+1023) = real(ifft(abs(fft(x(i:i+1023))))); end figure,plot(x); % piece of a song figure,plot(y); % obtained from IFFT of MAGNITUDE only of complete piece figure,plot(y2);% obtained from IFFT of MAGNITUDE only of 1024 sample BLOCKS sound(x,Fs,Nbit); % the original sound(y,Fs,Nbit); % from single piece, this is garbage! sound(y2,Fs,Nbit); % block based, robotic but inteligible!