语音信号的短时分析.docx

上传人:b****8 文档编号:30336106 上传时间:2023-08-13 格式:DOCX 页数:13 大小:17.71KB
下载 相关 举报
语音信号的短时分析.docx_第1页
第1页 / 共13页
语音信号的短时分析.docx_第2页
第2页 / 共13页
语音信号的短时分析.docx_第3页
第3页 / 共13页
语音信号的短时分析.docx_第4页
第4页 / 共13页
语音信号的短时分析.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

语音信号的短时分析.docx

《语音信号的短时分析.docx》由会员分享,可在线阅读,更多相关《语音信号的短时分析.docx(13页珍藏版)》请在冰豆网上搜索。

语音信号的短时分析.docx

语音信号的短时分析

语音信号的短时分析

一、实验目的

1.在理论学习的基础上,进一步地理解和掌握语音信号短时分析的意义,短时时域分析的基本方法。

2.进一步理解和掌握语音信号短时平均能量函数及短时平均过零数的计算方法和重要意义。

二、实验原理及方法

一定时宽的语音信号,其能量的大小随时间有明显的变化。

其中清音段(以清音为主要成份的语音段),其能量比浊音段小得多。

短时过零数也可用于语音信号分析中,发浊音时,其语音能量约集中于3kHz以下,而发清音时,多数能量出现在较高频率上,可认为浊音时具有较低的平均过零数,而清音时具有较高的平均过零数,因而,对一短时语音段计算其短时平均能量及短时平均过零数,就可以较好地区分其中的清音段和浊音段,从而可判别句中清、浊音转变时刻,声母韵母的分界以及无声与有声的分界。

这在语音识别中有重要意义。

三、实验仪器

微型计算机,Matlab软件环境

四、实验内容

1.上机前用Matlab语言完成程序编写工作。

2.程序应具有加窗(分帧)、计算、以及绘制曲线等功能。

3.上机实验时先调试程序,通过后进行信号处理。

4.对录入的语音数据进行处理,并显示运行结果。

5.依据曲线对该语音段进行所需要的分析,并作出结论。

6.改变窗的宽度(帧长),重复上面的分析内容。

五、预习和实验报告要求

1.预习课本有关内容,理解和掌握短时平均能量函数及短时平均过零数函数的意义及其计算方法。

2.参考Matlab有关资料,设计并编写出具有上述功能的程序。

六、上机实验报告要求:

1.报告中,实验目的、实验原理、实验步骤、方法等格式和内容的要求与其它实验相同。

2.画出求得的、曲线,注明语音段和所用窗函数及其宽度。

阐述所作分析和判断的过程,提出依据,得出判断结论。

七、思考题

1.语音信号短时平均能量及短时平均过零数分析的主要用途是什么?

2.窗的宽度(帧长)的改变,对的特性产生怎样的影响?

附:

所用语音信号文件名为one.wav

Matlab编程实验步骤:

1.新建M文件,扩展名为“.m”,编写程序;

2.选择File/Save命令,将文件保存在F盘中;

3.在CommandWindow窗中输入文件名,运行程序;

Matlab部分函数语法格式:

读wav文件:

x=wavread(`filename`)

数组a及b中元素相乘:

a.*b

创建图形窗口命令:

figure

绘图函数:

plot(x)

坐标轴:

axis([xminxmaxyminymax])

坐标轴注解:

xlabel(`…`)ylabel(`…`)

图例注解:

legend(`…`)

一阶高通滤波器:

y=filter([1-0.09375],1,x)

分帧函数:

f=enframe(x,len,inc)

x为输入语音信号,len指定了帧长,inc指定帧移,函数返回为n×len的一个矩阵,每一行都是一帧数据。

[x]=wavread('3.wav');

figure;

subplot(4,1,1);

plot(x);

axis([1length(x)-11]);

ylabel('Speech');

enhance=filter([1-0.9375],1,x);

FrameLen=240;

FrameInc=80;

yframe=enframe(x,FrameLen,FrameInc);

amp1=sum(abs(yframe),2);

subplot(4,1,2);

plot(amp1);

axis([1length(amp1)0max(amp1)]);

ylabel('Energy');

legend('amp1=∑│x│');

amp2=sum(abs(yframe.*yframe),2);

subplot(4,1,3);

plot(amp2);

axis([1length(amp2)0max(amp2)]);

ylabel('Energy');

legend('amp1=∑│x*x│');

%zcr=zeros(size(yframe,1),1)delta=0.02

%fori=1:

size(yframe,1)x=yframe(i,:

)forj=1:

length(x)-1ifx(j)*x(j+1)<0&abs(x(j)-x(j+1))>delta

%zcr(i)=zcr(i)+1endendend

tmp1=enframe(x(1:

end-1),FrameLen,FrameInc);

tmp2=enframe(x(2:

end),FrameLen,FrameInc);

signs=(tmp1.*tmp2)<0;

diffs=(tmp1-tmp2)>0.02;

zcr=sum(signs.*diffs,2);

subplot(4,1,4);

plot(zcr);

axis([1length(zcr)0max(zcr)]);

ylabel('ZCR');

legend('zcr');

[x]=wavread('3.wav');

figure;

subplot(4,1,1);

plot(x);

axis([1length(x)-11]);

ylabel('Speech');

enhance=filter([1-0.9375],1,x);

FrameLen=240;

FrameInc=80;

yframe=enframe(x,FrameLen,FrameInc);

amp1=sum(abs(yframe),2);

subplot(4,1,2);

plot(amp1);

axis([1length(amp1)0max(amp1)]);

ylabel('Energy');

legend('amp1=∑│x│');

amp2=sum(abs(yframe.*yframe),2);

subplot(4,1,3);

plot(amp2);

axis([1length(amp2)0max(amp2)]);

ylabel('Energy');

legend('amp1=∑│x*x│');

zcr=zeros(size(yframe,1),1);

delta=0.02

fori=1:

size(yframe,1);

a=yframe(i,:

forj=1:

length(a)-1

ifa(j).*a(j+1)<0&abs(a(j)-a(j+1))>delta

zcr(i)=zcr(i)+1

end

end

end

%tmp1=enframe(x(1:

end-1),FrameLen,FrameInc);

%tmp2=enframe(x(2:

end),FrameLen,FrameInc);

%signs=(tmp1.*tmp2)<0;

%diffs=(tmp1-tmp2)>0.02;

%zcr=sum(signs.*diffs,2);

subplot(4,1,4);

plot(zcr);

axis([1length(zcr)0max(zcr)]);

ylabel('ZCR');

legend('zcr');

functionf=enframe(x,win,inc)

%ENFRAMEsplitsignalupinto(overlapping)frames:

oneperrow.F=(X,WIN,INC)

%

%F=ENFRAME(X,LEN)splitsthevectorXupinto

%frames.EachframeisoflengthLENandoccupies

%onerowoftheoutputmatrix.ThelastfewframesofX

%willbeignoredifitslengthisnotdivisiblebyLEN.

%ItisanerrorifXisshorterthanLEN.

%

%F=ENFRAME(X,LEN,INC)hasframesbeginningatincrementsofINC

%ThecentreofframeIisX((I-1)*INC+(LEN+1)/2)forI=1,2,...

%Thenumberofframesisfix((length(X)-LEN+INC)/INC)

%

%F=ENFRAME(X,WINDOW)orENFRAME(X,WINDOW,INC)multiplies

%eachframebyWINDOW(:

%Copyright(C)MikeBrookes1997

%

%LastmodifiedTueMay1213:

42:

011998

%

%VOICEBOXhomepage:

http:

//www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html

%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%Thisprogramisfreesoftware;youcanredistributeitand/ormodify

%itunderthetermsoftheGNUGeneralPublicLicenseaspublishedby

%theFreeSoftwareFoundation;eitherversion2oftheLicense,or

%(atyouroption)anylaterversion.

%

%Thisprogramisdistributedinthehopethatitwillbeuseful,

%butWITHOUTANYWARRANTY;withouteventheimpliedwarrantyof

%MERCHANTABILITYorFITNESSFORAPARTICULARPURPOSE.Seethe

%GNUGeneralPublicLicenseformoredetails.

%

%YoucanobtainacopyoftheGNUGeneralPublicLicensefrom

%ftp:

//prep.ai.mit.edu/pub/gnu/COPYING-2.0orbywritingto

%FreeSoftwareFoundation,Inc.,675MassAve,Cambridge,MA02139,USA.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

nx=length(x);

nwin=length(win);

if(nwin==1)

len=win;

else

len=nwin;

end

if(nargin<3)

inc=len;

end

nf=fix((nx-len+inc)/inc);

f=zeros(nf,len);

indf=inc*(0:

(nf-1)).';

inds=(1:

len);

f(:

)=x(indf(:

ones(1,len))+inds(ones(nf,1),:

));

if(nwin>1)

w=win(:

)';

f=f.*w(ones(nf,1),:

);

End

语音信号的谱分析及应用

[x]=wavread('3.wav');

figure;

subplot(4,1,1);

plot(x);

axis([1length(x)-11]);

ylabel('Speech');

enhance=filter([1-0.9375],1,x);

FrameLen=240;

FrameInc=80;

yframe=enframe(x,FrameLen,FrameInc);

amp1=sum(abs(yframe),2);

subplot(4,1,2);

plot(amp1);

axis([1length(amp1)0max(amp1)]);

ylabel('Energy');

legend('amp1=∑│x│');

amp2=sum(abs(yframe.*yframe),2);

subplot(4,1,3);

plot(amp2);

axis([1length(amp2)0max(amp2)]);

ylabel('Energy');

legend('amp1=∑│x*x│');

%zcr=zeros(size(yframe,1),1)delta=0.02

%fori=1:

size(yframe,1)x=yframe(i,:

)forj=1:

length(x)-1ifx(j)*x(j+1)<0&abs(x(j)-x(j+1))>delta

%zcr(i)=zcr(i)+1endendend

tmp1=enframe(x(1:

end-1),FrameLen,FrameInc);

tmp2=enframe(x(2:

end),FrameLen,FrameInc);

signs=(tmp1.*tmp2)<0;

diffs=(tmp1-tmp2)>0.02;

zcr=sum(signs.*diffs,2);

subplot(4,1,4);

plot(zcr);

axis([1length(zcr)0max(zcr)]);

ylabel('ZCR');

legend('zcr');

[x]=wavread('3.wav');

figure;

subplot(4,1,1);

plot(x);

axis([1length(x)-11]);

ylabel('Speech');

enhance=filter([1-0.9375],1,x);

FrameLen=240;

FrameInc=80;

yframe=enframe(x,FrameLen,FrameInc);

amp1=sum(abs(yframe),2);

subplot(4,1,2);

plot(amp1);

axis([1length(amp1)0max(amp1)]);

ylabel('Energy');

legend('amp1=∑│x│');

amp2=sum(abs(yframe.*yframe),2);

subplot(4,1,3);

plot(amp2);

axis([1length(amp2)0max(amp2)]);

ylabel('Energy');

legend('amp1=∑│x*x│');

zcr=zeros(size(yframe,1),1);

delta=0.02

fori=1:

size(yframe,1);

a=yframe(i,:

forj=1:

length(a)-1

ifa(j).*a(j+1)<0&abs(a(j)-a(j+1))>delta

zcr(i)=zcr(i)+1

end

end

end

%tmp1=enframe(x(1:

end-1),FrameLen,FrameInc);

%tmp2=enframe(x(2:

end),FrameLen,FrameInc);

%signs=(tmp1.*tmp2)<0;

%diffs=(tmp1-tmp2)>0.02;

%zcr=sum(signs.*diffs,2);

subplot(4,1,4);

plot(zcr);

axis([1length(zcr)0max(zcr)]);

ylabel('ZCR');

legend('zcr');

functionf=enframe(x,win,inc)

%ENFRAMEsplitsignalupinto(overlapping)frames:

oneperrow.F=(X,WIN,INC)

%F=ENFRAME(X,LEN)splitsthevectorXupinto

%frames.EachframeisoflengthLENandoccupies

%onerowoftheoutputmatrix.ThelastfewframesofX

%willbeignoredifitslengthisnotdivisiblebyLEN.

%ItisanerrorifXisshorterthanLEN.

%F=ENFRAME(X,LEN,INC)hasframesbeginningatincrementsofINC

%ThecentreofframeIisX((I-1)*INC+(LEN+1)/2)forI=1,2,...

%Thenumberofframesisfix((length(X)-LEN+INC)/INC)

%F=ENFRAME(X,WINDOW)orENFRAME(X,WINDOW,INC)multiplies

%eachframebyWINDOW(:

nx=length(x);

nwin=length(win);

if(nwin==1)

len=win;

else

len=nwin;

end

if(nargin<3)

inc=len;

end

nf=fix((nx-len+inc)/inc);

f=zeros(nf,len);

indf=inc*(0:

(nf-1)).';

inds=(1:

len);

f(:

)=x(indf(:

ones(1,len))+inds(ones(nf,1),:

));

if(nwin>1)

w=win(:

)';

f=f.*w(ones(nf,1),:

);

End

语音信号倒谱与复倒谱的分析

clc;

clear;

tic,

[y,fs]=wavread('speech_10k.wav');

L=length(y);

fw=y.*hamming(L);

r=real(log(fft(fw,L)))

pfw=cceps(fw);

rpfw=rceps(fw);

z=rpfw(1:

30);

p=pfw(31:

L)

logz=real(exp(fft(z,L)));

logp=real(fft(p));

subplot(3,2,1);plot(y);title('原始波形')

subplot(3,2,3);plot(pfw);title('复倒谱')

subplot(3,2,5);plot(rpfw);title('实倒谱')

subplot(3,2,6);plot(logz);title('倒谱域滤波后的对数幅度谱')

subplot(3,2,4);plot(r);title('对数幅度谱')

subplot(3,2,2);plot(fw);title('加海明窗后的波形')

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 语文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1