欢迎来到冰点文库! | 帮助中心 分享价值,成长自我!
冰点文库
全部分类
  • 临时分类>
  • IT计算机>
  • 经管营销>
  • 医药卫生>
  • 自然科学>
  • 农林牧渔>
  • 人文社科>
  • 工程科技>
  • PPT模板>
  • 求职职场>
  • 解决方案>
  • 总结汇报>
  • ImageVerifierCode 换一换
    首页 冰点文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    语音信号特征提取程序设计代码.docx

    • 资源ID:7431755       资源大小:13.57KB        全文页数:5页
    • 资源格式: DOCX        下载积分:12金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录 QQ登录
    二维码
    微信扫一扫登录
    下载资源需要12金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    语音信号特征提取程序设计代码.docx

    1、主程序:%fs=22050; %抽样频率x=wavread(2.wav);figure(1);subplot(211);plot(x);title(原始语音信号波形,fontsize,16,fontweight,bold);xlabel(样点数,fontsize,16,fontweight,bold);ylabel(幅值,fontsize,16,fontweight,bold);grid on;N=128;n=0:N-1;y=fft(x);mag=abs(y);f=(0:length(y)-1)*fs/length(y);%进行对应的频率转换figure(1);subplot(212);plo

    2、t(f,mag);title(原始信号频谱图,fontsize,16,fontweight,bold);xlabel(频率(Hz),fontsize,16,fontweight,bold);ylabel(幅值,fontsize,16,fontweight,bold);grid on;y=wavread(2.wav);%预加重figure();subplot(211);plot(x);xlabel(样点数,fontsize,16,fontweight,bold);ylabel(原始波形(幅值),fontsize,16,fontweight,bold);xx=double(y);subplot(2

    3、12);plot(xx);xlabel(样点数,fontsize,16,fontweight,bold);ylabel(预加重波形(幅值),fontsize,16,fontweight,bold);%对指定帧位置进行加窗处理Q=y;N=256;%窗长Hamm=hamming(N);%加窗(汉明窗)Rect=rectwin(N);%加窗(矩形窗)frame=60;%需要处理的帧位置M=Q(frame-1)*(N/2)+1):(frame-1)*(N/2)+N);Frame=M.*Hamm;%加窗后的语音帧frame=M.*Rect;figure();subplot(211);plot(Frame

    4、);ylabel(汉明窗,fontsize,16,fontweight,bold);subplot(212);plot(frame);ylabel(矩形窗,fontsize,16,fontweight,bold);%语音信号分帧figure();subplot(211);plot(y);xlabel(样点数,fontsize,16,fontweight,bold);ylabel(原始,fontsize,16,fontweight,bold);y=enframe(y,256,80);subplot(212);plot(y);xlabel(帧数,fontsize,16,fontweight,bol

    5、d);ylabel(分帧,fontsize,16,fontweight,bold);%端点检测x1,x2=vad(x);%调用函数vad实现%浊音, 取13270-13510个点%短时自相关函数temp=y(13271:13510);Rn1=zeros(1,240);for nn=1:240 for ii=1:240-nn Rn1(nn)=Rn1(nn)+temp(ii)*temp(nn+ii); endendfigure(6);subplot(211);jj=1:240;plot(jj,Rn1,b);title(浊音自相关函数,fontsize,16,fontweight,bold);xla

    6、bel(帧数,fontsize,16,fontweight,bold);ylabel(短时自相关函数,fontsize,16,fontweight,bold);grid on;%清音, 取12120-12360个点%短时自相关函数temp=y(12121:12360);Rn2=zeros(1,240);for nn=1:240 for ii=1:240-nn Rn2(nn)=Rn2(nn)+temp(ii)*temp(nn+ii); endendfigure(6);subplot(212);jj=1:240;plot(jj,Rn2,b);title(清音自相关函数,fontsize,16,fo

    7、ntweight,bold);xlabel(帧数,fontsize,16,fontweight,bold);ylabel(短时自相关函数,fontsize,16,fontweight,bold);grid on;分帧功能子程序:function f=enframe(x,win,inc) % F = ENFRAME(X,LEN) splits the vector X(:) up into % frames. Each frame is of length LEN and occupies % one row of the output matrix. The last few frames o

    8、f X % will be ignored if its length is not divisible by LEN. % It is an error if X is shorter than LEN. nx=length(x(:); nwin=length(win); if (nwin = 1) len = win; else len = nwin; end if (nargin 1) w = win(:); f = f .* w(ones(nf,1),:); End选端点功能子程序:function x1,x2 = vad(x)% x=audioread(1.wav);%幅度归一化到-

    9、1,1x = double(x);x = x / max(abs(x);%常数设置FrameLen = 240;FrameInc = 80;amp1 = 10;amp2 = 2;zcr1 = 10;zcr2 = 5;maxsilence = 8; % 6*10ms = 30msminlen = 15; % 15*10ms = 150msstatus = 0;count = 0;silence = 0;%计算过零率tmp1 = enframe(x(1:end-1), FrameLen, FrameInc);tmp2 = enframe(x(2:end) , FrameLen, FrameInc)

    10、;signs = (tmp1.*tmp2)0.02;zcr = sum(signs.*diffs, 2);%计算短时能量amp = sum(abs(enframe(filter(1 -0.9375, 1, x), FrameLen, FrameInc), 2);%调整能量门限amp1 = min(amp1, max(amp)/4);amp2 = min(amp2, max(amp)/8);%开始端点检测x1 = 0; x2 = 0;for n=1:length(zcr) goto = 0; switch status case 0,1 % 0 = 静音, 1 = 可能开始 if amp(n)

    11、amp1 % 确信进入语音段 x1 = max(n-count-1,1); status = 2; silence = 0; count = count + 1; elseif amp(n) amp2 | . % 可能处于语音段 zcr(n) zcr2 status = 1; count = count + 1; else % 静音状态 status = 0; count = 0; end case 2, % 2 = 语音段 if amp(n) amp2 | . % 保持在语音段 zcr(n) zcr2 count = count + 1; else % 语音将结束 silence = sil

    12、ence+1; if silence maxsilence % 静音还不够长,尚未结束 count = count + 1; elseif count minlen % 语音长度太短,认为是噪声 status = 0; silence = 0; count = 0; else % 语音结束 status = 3; end end case 3, break; endend count = count-silence/2;x2 = x1 + count -1;figure();subplot(311)plot(x)axis(1 length(x) -1 1)ylabel(Speech);line

    13、(x1*FrameInc x1*FrameInc, -1 1, Color, red);line(x2*FrameInc x2*FrameInc, -1 1, Color, red);subplot(312)plot(amp);axis(1 length(amp) 0 max(amp)ylabel(Energy);line(x1 x1, min(amp),max(amp), Color, red);line(x2 x2, min(amp),max(amp), Color, red);subplot(313)plot(zcr);axis(1 length(zcr) 0 max(zcr)ylabel(ZCR);line(x1 x1, min(zcr),max(zcr), Color, red);line(x2 x2, min(zcr),max(zcr), Color, red);


    注意事项

    本文(语音信号特征提取程序设计代码.docx)为本站会员主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 冰点文库 网站版权所有

    经营许可证编号:鄂ICP备19020893号-2


    收起
    展开