📄 wuchuang.m
字号:
% 没有加窗wuchuang.wav
N=240
Y=WAVREAD('wuchuang',[1 18000]);
L=length(Y)%30秒,每秒8000个点,一共240000个点
LL=length(Y)/N %一共 1000帧
figure(1)
set(1,'Position',[10,35,350,650])
%短时能量
Em=zeros(1,(LL-1)*240);
for ii=1:(LL-1)*240,
temp=Y(ii:ii+240);
Em(ii)=sum(temp.*temp);
end
subplot(4,1,1)
jj=[1:(LL-1)*240];
plot(jj, Em,'b');
grid
% axis([12000,16000,0.15,0.4])
%短时平均幅度Mn=sum(abs(Y))/N
Mn=zeros(1,(LL-1)*240);
for ii=1:(LL-1)*240,
temp=Y(ii:ii+240);
Mn(ii)=sum(abs(temp))/N;
end
figure(1)
subplot(4,1,2)
jj=[1:(LL-1)*240];
plot(jj, Mn,'b');
grid
% axis([12000,16000,0.02,0.04])
%短时过零率
Zn=zeros(1,(LL-1)*240);
for ii=2:(LL-1)*240,
temp1=sign(Y(ii:ii+240));
temp=sign(Y(ii-1:ii+240-1));
Zn(ii)=sum(abs(temp1-temp));
end
figure(1)
subplot(4,1,3)
jj=[1:(LL-1)*240];
plot(jj, Zn,'b');
grid
% axis([12000,16000,0,20])
%零能比曲线
figure(1)
subplot(4,1,4)
jj=[1:(LL-1)*240];
plot(jj, Zn./Em,'b');
grid
% axis([12000,16000,0,100])
%
% Wn=[60/8000 ,500/8000]
% n=[1:240];
% B = FIR1(239,Wn,'bandpass');
%%%%%%浊音,取13270--13510个点
%短时自相关函数
temp=Y(13271:13510);
%
% wc1 = 0.0075; wc2 = 0.9625;
% wn = [wc1/pi,wc2/pi];
% h = fir1(239,wn,blackman(240));
% h=reshape(h,240,1);
% temp= temp.*abs(h);
%
%% %temp2=reshape(temp,1,240);
%temp=temp2.*B;
Rn1=zeros(1,240);
for nn=[1:240],
for ii=[1:240-nn],
Rn1(nn) =Rn1(nn)+ temp(ii)*temp(nn+ii);
end
end
figure(2)
set(2,'Position',[400,35,350,650])
subplot(4,1,1)
jj=[1:240];
plot(jj, Rn1,'b');
grid
%axis([9,50,-0.01,0.02])
%短时平均幅度差函数
Yn1=zeros(1,240);
for nn=[1:240],
for ii=[1:240-nn],
Yn1(nn) =Yn1(nn)+ abs(temp(ii)-temp(nn+ii));
end
end
figure(2)
subplot(4,1,2)
jj=[1:240];
plot(jj, Yn1,'b');
grid
%%%%%%清音,取12120--12360个点
%短时自相关函数
temp=Y(12121:12360);
%% %temp2=reshape(temp,1,240);
%temp=temp2.*B;
Rn2=zeros(1,240);
for nn=[1:240],
for ii=[1:240-nn],
Rn2(nn) =Rn2(nn)+ temp(ii)*temp(nn+ii);
end
end
figure(2)
subplot(4,1,3)
jj=[1:240];
plot(jj, Rn2,'b');
grid
%axis([9,50,-0.01,0.02])
%短时平均幅度差函数
Yn2=zeros(1,240);
for nn=[1:240],
for ii=[1:240-nn],
Yn2(nn) =Yn2(nn)+ abs(temp(ii)-temp(nn+ii));
end
end
figure(2)
subplot(4,1,4)
jj=[1:240];
plot(jj, Yn2,'b');
grid
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -