语言信号处理asp第5章作业_第1页
语言信号处理asp第5章作业_第2页
语言信号处理asp第5章作业_第3页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、第七小组题 1:function y=frame2volume(volume)waveFile=朝辞 frameSize=256;overlap=128;间_T.wav;y,bits=wavread(waveFile);fprf(Length of %s is %g sec.n, waveFile, length(y)/fs); frameMat=buffer(y, frameSize, overlap);fram=size(frameMat, 2);m, 1);%计算音量大小m, 1);volume1=zeros(fravolume2=zeros(frafor i=1:framframe=f

2、rameMat(:,i);frame=frame-mean(frame); % zero-justifiedvolume1(i)=sum(abs(frame);% method 1volume2(i)=10*log10(sum(frame.2); % method 2endtime=(1:length(y)/fs; frameTime=(0:fram-1)*(frameSize-overlap)+0.5*frameSize)/fs;subplot(3,1,1); plot(time, y); ylabel(waveFile);subplot(3,1,2); plot(frameTime, vo

3、lume1, .-); ylabel(Volume (Abs. sum);subplot(3,1,3); plot(frameTime, volume2, .-); ylabel(Volume (Decibels); xlabel(Time (sec);题 2: wavefile=myvoice.wav; framesize=256;overlap=128;%量y,bits=wavread(wavefile);framemat=buffer(y,framesize,overlap);%矩阵清音框 fram=size(framemat,2);%帧数赋值volume1=zeros(fravolum

4、e2=zeros(fram,1);m,1);for i=1:framframe=framemat(:;i);%逐帧求解 frame=frame-mean(frame); volume1(i)=sum(abs(frame);%method1volume2(i)=10*log(sum(frame.2);%method2endvolume=wave2volume(wavefile,fra题 3:% fs=16000; % 取样频率时间% duration=4; % channel=1; % 单声道% %bits=8;% fprf(按任意键后开始 %g 秒% fprf(中.);:, duration)

5、; pause% y=wavrecord(duration*fs, fs, channel);% duration*fs 是资料点数% fprf(结束n);% fprf(按任意键后开始% wavplay(y,fs);:); pauses and Settingsstud桌面第五章实验myVoie2% wavfiles=C:% wavwrite(y,fs,wavfiles);s and Settingsstud桌面第五章实验myVoie2.wav;waveFile=C:frameSize=512; overlap=352;y, fs, nbits=wavRead(waveFile);fprf(L

6、ength of %s is %g sec.n, waveFile, length(y)/fs); frameMat=buffer(y, frameSize, overlap);fram=size(frameMat, 2);volume1=zeros(fravolume2=zeros(fram, 1);m, 1);for i=1:framframe=frameMat(:,i);frame=frame-mean(frame); % zero-justifiedvolume1(i)=sum(abs(frame);% method 1volume2(i)=10*log10(sum(frame.2);

7、 % method 2endtime=(1:length(y)/fs; frameTime=(0:fram-1)*(frameSize-overlap)+0.5*frameSize)/fs;subplot(3,1,1); plot(time, y); ylabel(waveFile);subplot(3,1,2); plot(frameTime, volume1, .-); ylabel(Volume (Abs. sum);subplot(3,1,3); plot(frameTime, volume2, .-); ylabel(Volume (Decibels); xlabel(Time (s

8、ec);总结:如果发音时肺活量相同,则音量的大小和嘴型是没有关系的!题 4:第一小题:Fs = 16000; % 采样频率% 时间长度% 采样点数% 声音频率T = 0.5;n = Fs*T; f = 440;y = 0.8*sin(2*pi*f*T*linspace(0,1,n+1);sound(y,Fs); time=(1:length(y)/Fs; plot(time,y);第二小题:BFs = 16000; % Tn f y=2;Fs*T; 440;% % % sin(2*pi*f*T*linspace(0,1,n+1);sound(y,Fs,8); time=(1:length(y)

9、/Fs;plot(time,y);感想:这道题的难点是分辨率不知道怎么加进去,最后结果与题目有出入,不知道是不是分辨率,声音听起来和题目也有出入.题 5:音频 a:waveFile=朝辞 frameSize=100;overlap=50;间_T.wav;%音框长度为 100 时%量 50y, fs, nbits=wavRead(waveFile); %导入fprf(Length of %s is %g sec.n, waveFile, length(y)/fs); frameMat=buffer(y, frameSize, overlap);%切音框fram=size(frameMat, 2)

10、;%计算音量volume=zeros(fram, 1);for i=1:framframe=frameMat(:,i);frame=frame-median(frame); volume(i)=sum(abs(frame);% method 1endframeSize1=200; overlap1=100;frameMat1=buffer(y, frameSize1, overlap1);fram1=size(frameMat1, 2);volume1=zeros(fram1, 1);for i=1:fram1frame1=frameMat1(:,i);frame1=frame1-median

11、(frame1);volume1(i)=sum(abs(frame1);% method 1endframeSize2=300; overlap2=150;frameMat2=buffer(y, frameSize2, overlap2);fram2=size(frameMat2, 2);volume2=zeros(fram2, 1);for i=1:fram2frame2=frameMat2(:,i);frame2=frame2-median(frame2); volume2(i)=sum(abs(frame2);% method 1endframeSize3=400; overlap3=2

12、00;frameMat3=buffer(y, frameSize3, overlap3);fram3=size(frameMat3, 2);volume3=zeros(fram3, 1);for i=1:fram3frame3=frameMat3(:,i);frame3=frame3-median(frame3); volume3(i)=sum(abs(frame3);% method 1endframeSize4=500; overlap4=250;frameMat4=buffer(y, frameSize4, overlap4);fram4=size(frameMat4, 2);volum

13、e4=zeros(fram4, 1);for i=1:fram4frame4=frameMat4(:,i);frame4=frame4-median(frame4); volume4(i)=sum(abs(frame4);% method 1endtime=(1:length(y)/fs; frameTime=(0:fra frameTime1=(0:fra frameTime2=(0:fra frameTime3=(0:fra frameTime4=(0:fram-1)*(frameSize-overlap)+0.5*frameSize)/fs;m1-1)*(frameSize1-overl

14、ap1)+0.5*frameSize1)/fs; m2-1)*(frameSize2-overlap2)+0.5*frameSize2)/fs m3-1)*(frameSize3-overlap2)+0.5*frameSize3)/fs m4-1)*(frameSize4-overlap2)+0.5*frameSize4)/fssubplot(2,1,1); plot(time, y); ylabel(waveFile);subplot(2,1,2);plot(frameTime,volume,frameTime1,volume1,frameTime2,volume2,frameTime3,

15、volume3,frameTime4,volume4); ylabel(Volume (Abs. sum);音频 b: waveFile=E:ScourceFile朝辞间_T;frameSize=100;overlap=50;y, fs, nbits=wavRead(waveFile);fprf(Length of %s is %g sec.n, waveFile, length(y)/fs); frameMat=buffer(y, frameSize, overlap);fram=size(frameMat, 2);volume=zeros(fram, 1);for i=1:framfram

16、e=frameMat(:,i);frame=frame-median(frame); volume(i)=sum(abs(frame);% method 1endframeSize1=200; overlap1=100;frameMat1=buffer(y, frameSize1, overlap1);fram1=size(frameMat1, 2);volume1=zeros(fram1, 1);for i=1:fram1frame1=frameMat1(:,i);frame1=frame1-median(frame1); volume1(i)=sum(abs(frame1);% metho

17、d 1endframeSize2=300; overlap2=150;frameMat2=buffer(y, frameSize2, overlap2);fram2=size(frameMat2, 2);volume2=zeros(fram2, 1);for i=1:fram2frame2=frameMat2(:,i);frame2=frame2-median(frame2); volume2(i)=sum(abs(frame2);% method 1endframeSize3=400; overlap3=200;frameMat3=buffer(y, frameSize3, overlap3

18、);fram3=size(frameMat3, 2);volume3=zeros(fram3, 1);for i=1:fram3frame3=frameMat3(:,i);frame3=frame3-median(frame3); volume3(i)=sum(abs(frame3);% method 1endframeSize4=500; overlap4=250;frameMat4=buffer(y, frameSize4, overlap4);fram4=size(frameMat4, 2);volume4=zeros(fram4, 1);for i=1:fram4frame4=frameMat4(:,i

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论