//Minimal phase transformation
//by deLuther Tech.
fnames=uigetfile(["*.wav","Wave files"],"","Select Sources",%t);
[rows,cols]=size(fnames);
if strcmp(fnames,"")==0 then cols=0; end
for i=1:cols
    [source,fs] = wavread(fnames(i));
    nfft = 2^nextpow2(fs);
    [nr,nc]=size(source);
    source=resize_matrix(source,nr,nfft);
    cepst=ifft(log(abs(fft(source))));
    cepst(2:nfft/2)=2*cepst(2:nfft/2);
    cepst(nfft/2+2:nfft)=0;
    mpimp=real(ifft(exp(fft(cepst))));
    mpimp=resize_matrix(mpimp,nr,nc);
    mpimp=mpimp/max(abs(mpimp));
    outname=strsubst(fnames(i),".wav","_mp.wav");
    wavwrite(mpimp,fs,32,outname);
end
