matlab演奏歌曲程序.docx

上传人:牧羊曲112 文档编号:3161241 上传时间:2023-03-11 格式:DOCX 页数:6 大小:37.16KB
返回 下载 相关 举报
matlab演奏歌曲程序.docx_第1页
第1页 / 共6页
matlab演奏歌曲程序.docx_第2页
第2页 / 共6页
matlab演奏歌曲程序.docx_第3页
第3页 / 共6页
matlab演奏歌曲程序.docx_第4页
第4页 / 共6页
matlab演奏歌曲程序.docx_第5页
第5页 / 共6页
亲,该文档总共6页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《matlab演奏歌曲程序.docx》由会员分享,可在线阅读,更多相关《matlab演奏歌曲程序.docx(6页珍藏版)》请在三一办公上搜索。

1、matlab演奏歌曲程序%matlab太强大了。开眼界了。听听吧。% 演奏者:Matlabsp=actxserver(SAPI.SpVoice);sp.Speak(王明强);sp.Speak(作曲者);sp.Speak(宋冬野);sp.Speak(演奏者);sp.Speak(Matlab);fs = 44100; % 采样率dt= 1/fs;T16=0.25;%十六分音符时长0.25秒t16=0:dt:T16;temp k=size(t16);t4=linspace(0,4*T16,4*k);t8=linspace(0,2*T16,2*k);temp i=size(t4);temp j=siz

2、e(t8);f=440*sqrt(0.5);% E大调d=2(1/12);blk4=zeros(1,i);%四分休止符blk8=zeros(1,j);%八分休止符blk16=zeros(1,k);%十六分休止符% Modification functionsmod4 = sin(pi*t4/t4(end);mod8 = sin(pi*t8/t8(end);mod16 = sin(pi*t16/t16(end);%四分音符one4=mod4.*sin(2*pi*f*d1*t4);two4=mod4.*sin(2*pi*f*d3*t4);three4=mod4.*sin(2*pi*f*d5*t4)

3、;four4=mod4.*sin(2*pi*f*d6*t4);five4=mod4.*sin(2*pi*f*d8*t4);six4=mod4.*sin(2*pi*f*d10*t4);seven4=mod4.*sin(2*pi*f*d12*t4);upone4=mod4.*sin(2*pi*f*d13*t4);uptwo4=mod4.*sin(2*pi*f*d15*t4);upthree4=mod4.*sin(2*pi*f*d17*t4);%八分音符one8=mod8.*sin(2*pi*f*d1*t8);two8=mod8.*sin(2*pi*f*d3*t8);three8=mod8.*sin

4、(2*pi*f*d5*t8);four8=mod8.*sin(2*pi*f*d6*t8);five8=mod8.*sin(2*pi*f*d8*t8);six8=mod8.*sin(2*pi*f*d10*t8);seven8=mod8.*sin(2*pi*f*d12*t8);upone8=mod8.*sin(2*pi*f*d13*t8);uptwo8=mod8.*sin(2*pi*f*d15*t8);upthree8=mod8.*sin(2*pi*f*d17*t8);%十六分音符one16=mod16.*sin(2*pi*f*d1*t16);two16=mod16.*sin(2*pi*f*d3*

5、t16);three16=mod16.*sin(2*pi*f*d5*t16);four16=mod16.*sin(2*pi*f*d6*t16);five16=mod16.*sin(2*pi*f*d8*t16);six16=mod16.*sin(2*pi*f*d10*t16);seven16=mod16.*sin(2*pi*f*d12*t16);upone16=mod16.*sin(2*pi*f*d13*t16);uptwo16=mod16.*sin(2*pi*f*d15*t16);upthree16=mod16.*sin(2*pi*f*d17*t16);upfive16=mod16.*sin(

6、2*pi*f*d20*t16);%特殊音符t8p=linspace(0,3*T16,3*k);t5_16=linspace(0,5*T16,5*k);t2=linspace(0,8*T16,8*k);mod8p=sin(pi*t8p/t8p(end);mod5_16=sin(pi*t5_16/t5_16(end);mod2=sin(pi*t2/t2(end);three8p=mod8p.*sin(2*pi*f*d5*t8p);five8p=mod8p.*sin(2*pi*f*d8*t8p);blk8p=zeros(1,3*k);six3_16=mod8p.*sin(2*pi*f*d10*t8p

7、);upone2=mod2.*sin(2*pi*f*d13*t2);upthree8p=mod8p.*sin(2*pi*f*d17*t8p);uptwo8p=mod8p.*sin(2*pi*f*d15*t8p);upone8p=mod8p.*sin(2*pi*f*d13*t8p);upone5_16=mod5_16.*sin(2*pi*f*d13*t5_16);upthree5_16=mod5_16.*sin(2*pi*f*d17*t5_16);%谱子melody=blk4 five8 upone16 six3_16 blk8 blk16 six16 six16 six16.seven8 fi

8、ve8 five8 six16 five8 three8p blk16 two16 three16 two16 three8 two16 five8 five4 blk8p two16 five8p two16 five16 three8p.blk4 blk4 blk4 blk4 five8 upone16 six3_16 blk8 blk16 six16 seven16 five16.seven16 seven8 five16 seven8 five16 seven16 six4 blk8 five16 five16 six8 six16 six8 five8p blk4 three16 t

9、wo8 three16 one4.blk4 blk4 blk4 blk4 five8 upone16 six3_16 blk4 six16 six16.seven8 seven16 seven8 five8 seven16 six16 six3_16 blk8 three16 five16 six8 five16 six16 five16 five8psix16 five8 two16 two8 five16 five8 three8p.blk4 blk4 blk4 blk4 five8 upone16 six3_16 blk8 six16 seven8 seven16 seven16 fiv

10、e16 five8 upone8 uptwo16 upone8 six3_16 blk16.five16 six16 five16 six4 blk16 five16 six16 five16 five8 seven4 seven16 upone16 upone2 blk4 blk4.blk16 upthree16 upthree16 upthree8 uptwo16 upthree8 uptwo8 uptwo16 upone16 uptwo8 upone16 upthree8 upthree8p five8 upone16 six3_16 blk8 blk8p.five16 uptwo16

11、upthree8 upthree16 uptwo16 uptwo16 upthree8 uptwo16 uptwo16 upthree8 uptwo8 uptwo16 upone16 upone8 five16 five16 upthree8 uptwo16 upthree5_16 blk4 blk4.upthree8 six8 upthree8 upfive16 upthree8 uptwo8p blk16.five16 upone16 uptwo16 upthree8 five8 upthree8 uptwo16 five8 six3_16 blk16.two16 six16 five16 five8 five16 upone8 upone8p blk4 five8 upone16 upone5_16;sound(melody,fs)sp.Speak(太牛逼了!);

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

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号