版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
语音信号处理实验报告【实验一】实验题目Shorttimeanalysis实验要求WriteaMATLABprogramtoanalyzeaspeechandsimultaneously,onasinglepage,plotthefollowingmeasurements:1.theentirespeechwaveform2.theshort-timeenergy,En3.theshort-timemagnitude,Mn4.theshort-timezero-crossing,Zn5.thenarrowbandspectrogram6.thewidebandspectrogramUseboththespeechwaveformsinthewznjdx_normal.wav.Chooseappropriatewindowsizes,windowshifts,andwindowfortheanalysis.Explainyourchoiceoftheseparameters.实验程序clear[x,fs]=wavread('wznjdx_normal.wav');n=length(x);N=320;subplot(4,1,1);plot(x);h=linspace(1,1,N);En=conv(h,x.*x);subplot(4,1,2);plot(En);Mn=conv(h,abs(x));subplot(4,1,3);plot(Mn);fori=1:n-1ifx(i)>=0y(i)=1;elsey(i)=-1;endifx(i+1)>=0y(i+1)=1;elsey(i+1)=-1;endw(i)=abs(y(i+1)-y(i));endk=1;j=0;while(k+N-1)<nZm(k)=0;fori=0:N-1Zm(k)=Zm(k)+w(k+i);endj=j+1;k=k+N/2;endforw=1:jQ(w)=Zm(160*(w-1)+1)/(2*N);endsubplot(4,1,4);plot(Q);grid;figure(2);subplot(2,1,1);spectrogram(x,h,256,200,0.0424*fs);subplot(2,1,2);spectrogram(x,h,256,200,0.0064*fs);实验结果语谱图:(Matlab7.0用不了spectrogram)【实验二】实验题目Homomorphicanalysis实验要求WriteaMATLABprogramtocomputetherealcepstrumsofasectionofvoicedspeechandunvoicedspeech.Plotthesignal,thelogmagnitudespectrum,therealcepstrum,andthelowpasslifteredlogmagnitudespectrum.三、实验程序nfft=256;[x,fs]=wavread('wznjdx_normal.wav');fx=x;Xvm=log(abs(fft(fx,nfft)));xhv=real(ifft(Xvm,nfft));lifter=zeros(1,nfft);lifter(1:30)=1;lifter(nfft-28:nfft)=1;fnlen=0.02*fs;%20mswin=hamming(fnlen);%加窗n=fnlen;%窗宽度赋给循环自变量nnoverlap=0.5*fnlen;while(n<=length(x)-1)fx=x(n-fnlen+1:n).*win;n=n+noverlap;endxhvp=xhv.*lifter';figure;subplot(4,1,1)plot(lifter);title('倒谱滤波器');subplot(4,1,2)plot(x);title('语音信号波形');subplot(4,1,3)plot(Xvm);title('Xvm');subplot(4,1,4)plot(xhv);title('xhv');四、实验结果【实验三】一、实验题目LPanalysis二、实验要求WriteaMATLABprogramtoconvertfromaframeofspeechtoasetoflinearpredictioncoefficients.PlottheLPCspectrumsuperimposedonthecorrespondingSTFT.三、实验程序clear;[x,fs]=wavread('wznjdx_normal.wav');fx=x(4000:4160-1);p=10;[a,e,k]=aryule(fx,p);G=sqrt(e*length(fx));f=log(abs(fft(fx)));h0=zeros(1,160);h=log(G)-log(abs(fft(a,160)));figure(1);subplot(211);plot(fx);subplot(212);plot(f);holdon;plot((0:160-1),h,'r');四、实验结果【实验四】一、实验题目Pitchestimation二、实验内容Writeaprogramtoimplementthepitchestimationandthevoiced/unvoiceddecisionusingtheLPC-basedmethod.三、实验程序clear[x,fs]=wavread('wznjdx_normal.wav');n=length(x);Q=x';NFFT=512;N=256;Hamm=hamming(N);frame=30;M=Q(((frame-1)*(N/2)+1):((frame-1)*(N/2)+N));Frame=M.*Hamm';%lowpassfilter[b2,a2]=butter(2,900/4000);speech2=filter(b2,a2,Frame);%filter%residual[a,e]=lpc(speech2,20);errorlp=filter(a,1,speech2);%residual%Short-termautocorrelation.re=xcorr(errorlp);%Findmaxautocorrelationforlagsintheintervalminlagtomaxlag.minlag=17;%F0:450Hzmaxlag=160;%F0:50Hzfnlen=256;[remax,idx]=max(re(fnlen+minlag:fnlen+maxlag));figuresubplot(3,1,1);plot(Frame);subplot(3,1,2);plot(speech2);subplot(3,1,3);plot(re);text(500,0,'idx');idx=idx-1+minlagremax四、实验结果【实验五】一、实验题目Speechsynthesis二、实验内容WriteaprogramtoanalyzeaspeechandsynthesizeitusingtheLPC-basedmethod.三、实验程序主程序clear;[x,sr]=wavread('wznjdx_normal.wav');p=[1-0.9];x=filter(p,1,x);N=256;inc=128;y=lpcsyn(x,N,inc);wavplay(y,sr);子程序lpcsynfunctiony=lpcsyn(x,N,inc)%[x,sr]=wavread('wznjdx_normal.wav');%pre=[1-0.97];%x=filter(pre,1,x);%N=256;%inc=128;fn=floor(length(x)/inc);y=zeros(1,50000);for(i=1:fn)order=16;x(1:N,i)=x((i-1)*inc+1:(i+1)*inc);[A(i,:),G(i),P(i),fnlen,fnshift]=lpcana(x(1:N,i),order);if(P(i))%Voicedframe.e=zeros(N,1);e(1:P(i):N)=1;%Impulse-trainexcitation.else%Unvoicedframe.e=randn(N,1);%Whitenoiseexcitation.endyt=filter(G(i),A(i,:),e);j=(i-1)*inc+[1:N];y(j)=y(j)+yt';end;end子程序lpcanafunction[A,G,P,fnlen,fnshift]=lpcana(x,order)fnlen=256;fnshift=fnlen/2;n=length(x);[b2,a2]=butter(2,900/4000);speech2=filter(b2,a2,x);[A,e]=lpc(speech2,order);errorlp=filter(A,1,speech2);re=xcorr(errorlp);G=sqrt(e*length(speech2));minlag=17;maxlag=160;[remax,idx]=max(re(n+minlag:n+maxlag));P=idx-1+minlag;end四、实验结果【实验六】一、实验题目Speechenhancement二、实验内容Writeaprogramtoimplementthebasicspectralmagnitudesubtraction.三、实验程序clear[speech,fs,nbits]=wavread('wznjdx_normal.wav');%读入数据alpha=0.04;%噪声水平winsize=256;%窗长size=length(speech);%语音长度numofwin=floor(size/winsize);%帧数hamwin=zeros(1,size);%定义汉明窗长度enhanced=zeros(1,size);%定义增强语音的长度ham=hamming(winsize)';%%产生汉明窗x=speech'+alpha*randn(1,size);%信号加噪声noisy=alpha*randn(1,winsize);%噪声估计N=fft(noisy);nmag=abs(N);%噪声功率谱%分帧forq=1:2*numofwin-1frame=x(1+(q-1)*winsize/2:winsize+(q-1)*winsize/2);%对带噪语音帧间重叠一半取值hamwin(1+(q-1)*winsize/2:winsize+(q-1)*winsize/2)=...hamwin(1+(q-1)*winsize/2:winsize+(q-1)*winsize/2)+ham;%加窗y=fft(frame.*ham);mag=abs(y);%带噪语音功率谱phase=angle(y);%带噪语音相位%幅度谱减fori=1:winsizeifmag(i)-nmag(i)>0clean(i)=mag(i)-nmag(i);elseclean(i)=0;endend%频域中重新合成语音spectral=clean.*exp(j*phase);%反傅里叶变换并重叠相加enhanced(1+(q-1)*winsize/2:winsize+(q-1)*winsize/2)=...enhanced(1+(
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年四川拟任县处级任职资格理论考试冲刺模拟试题及答案
- 2026年湖北天门市专业技术职务水平能力测试(党建基础知识)冲刺模拟试题及答案
- 2026年国家电网职称考试(工业工程技术-质量与可靠性管理)(副高)练习题及答案
- 2025年度重庆市风景园林专业职称考试(风景园林)训练题及答案
- 护理记录的规范与格式要求
- 护理课件背景资源图
- 山东省枣庄市山亭区2025-2026学年八年级下学期6月核心素养评价语文试卷(含答案)
- 2026年重庆市沙坪坝一中中考历史二模试卷(含答案)
- 2025-2026学年重庆市渝中区九年级(上)期末物理试卷(含答案)
- 2026学年山西省晋城市二年级语文期末点睛提升仿真模拟题附答案详细答案和解析
- 机器人关节培训课件
- 《中国宫腔镜诊断与手术临床实践指南(2023版)》解读课件
- GB/T 25052-2024连续热浸镀层钢板和钢带尺寸、外形、重量及允许偏差
- (高清版)JTGT M72-01-2017 公路隧道养护工程预算定额
- 建筑垃圾清运服务投标方案技术标
- MOOC 当代社会中的科学与技术-南京大学 中国大学慕课答案
- 2024-2024年全国初中化学竞赛试卷及答案-副本
- 新概念英语青少版入门 B-Unit-3课件(共9张)
- 中华诗词学会入会细则
- 实习考勤表(完整版)
- 测量不确定度培训心得
评论
0/150
提交评论