clc
clear
[y,Fs] =audioread('nokia.wav')
N=length(y);
[f0,idx] = pitch(y,Fs);
subplot(2,1,1)
plot(y)
ylabel('Amplitude')
xlabel('Sample Number')
x=[y];
n=round(length(x)/40);
p=zeros(n,40);
for k=0:39
p(:,k+1)=x(1+n*k:n*(k+1));
end
framesize=N/Fs;
M=round(y/framesize);
for...
i=(M)
if (i==M)
frame=y([(framesize*(i-1)+1):length(y)]);
else
frame=y([(framesize*(i-1)+1):framesize*i]);
end
end
X=dct(y,32768);
s=framesize*X;
b=length(s');
ratio=N/b;
A=idct(X,y);
[rows,columns]= size(A)
extra = rows*ceil(numel(A)/rows) - numel(A);
MU=reshape([X(:);nan(extra,1)],rows,columns)
for...
i=M
if (i==M)
frame1=MU([(framesize*(i-1)+1):length(MU)]);
else
frame1=MU([(framesize*(i-1)+1):framesize*i]);
end
end
[R,C]= size(y);
err = (((y-MU).^2)/(R*C)); % error in this line
MSE=sqrt(err)
subplot(2,1,2)
plot(MU)
ylabel('Amplitude')
