⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jiachuanghou.m

📁 用matlab实现对语音信号的短时分析
💻 M
字号:
%%加窗后的语音信号为 jiachuanghou.wav
N=240
Y=WAVREAD('jiachuanghou',[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([0,(LL-1)*240,0,0.6])
% axis([12000,16000,0,0.06])

 %短时平均幅度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,0.015])

 %短时过零率 
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,60])

%零能比曲线
figure(1)
subplot(4,1,4)
jj=[1:(LL-1)*240];               
plot(jj, Zn./Em,'b');
grid
%axis([12000,16000,0,3*10^7])

% 
% Wn=[60/8000 ,500/8000]
% n=[1:240];
% B = FIR1(239,Wn,'bandpass');

%%%%%%浊音,取13270--13510个点
 %短时自相关函数
 temp=Y(13271:13510);
 %% %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 + -