clear all
for i=1:20
fname=sprintf('D:\\study\\音频采样\\noise22050hz\\%d.wav',i);
x=wavread(fname);
x=x(:,1);
[c,l]=wavedec(x,3,'db4');
ca=appcoef(c,l,'db4',3);%近似系数
x=ca;
enframex=enframe(x,128,64);%对信号x分帧处理,每帧有128个采样点,相邻帧之间有50%的叠加率
[row,col]=size(enframex);%返回行,列,每一行代表一帧,每一列表示1到128个采样点
A=log10(abs(enframex).^2);
energy=zeros(row,1);
for j=1:row
energy(j)=sum(A(j,:));
end
s=0;
for j=1:row
s=s+energy(j);
end
s=0.7*(s/row);
noise(i)=0;
for k=1:row
if energy(k,1) noise(i)=noise(i)+1;
end
end
noiseshangbi(i,1)=noise(i)/row;
end
noiseshangbi