matlab卡农代码微盘,MATLAB演奏国歌,除乐理知识基本抛弃卡农代码,未参照前国歌.......
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
最近很无聊,想起卡农代码,很是佩服,原卡农代码为小提琴三重奏,本人音乐修养不行,做不出来,在此感谢卡农大神代码的启发指点,并无多少相同
本帖第一部分为思路,第二部分为代码,第三部分为失败了的自动筛选代码,为省内存基本都是single数据
思路:先建立三个库矩阵,分别为标准音符、连音符、附点音符的89*8矩阵,sound1,、sound0_6,sound1.5,行表示钢琴的88键+空音键,列为全音符,2分符,4分符,8分符,16分符,32,64,128分符,理论上可扩展。按此思路可以囊括所有曲目。本希望抛弃单个取值赋变量的方法,奈何识别程序有问题,我也没找出来哪里出错了,所以后面又是手动赋值。切记可以实现自动筛选匹配音符的功能
%沈阳化工大学
%马红越
%不留联系方式了,太乱
%matlab版本2012b
fs=single(44100);%采样频率
dt=single(1/fs);
%速度
temp=90;%拍速
%四分符为基准,一拍时值
t4=60/temp;
t1=4*t4;
t2=2*t4;
t8=0.5*t4;
t16=0.25*t4;
t32=0.125*t4;
t64=t32/2;
t128=t64/2;
t=single([t1,t2,t4,t8,t16,t32,t64,t128]);
clear t1 t2 t4 t8 t16 t32 t64 t128;
%调幅函数
t1_5=t*1.5;
t0_6=t*2/3;
for j=1:length(t)
%标准音
temp=single(0:dt:t(j));
mod1{j}=single(sin(pi*temp/temp(end)));%标准音调幅函数
T1{j}=temp;%T1为标准音时值矩阵,
%1个点的附点长音
temp=single(0:dt:t1_5(j));
mod1_5{j}=single(sin(pi*temp/temp(end)));%附点音调幅函数
T1_5{j}=temp;%附点音时值
%三连音
temp=single(0:dt:t0_6(j));
mod0_6{j}=single(sin(pi*temp/temp(end)));%标准音调幅函数
T0_6{j}=temp;%T1为标准音时值矩阵,
%两个点
%t=t*1.5*1.5;
%for j=1:length(t);
% tem1=0:dt:t(j);
% k=length(tem1);
% mod1_25{j}=[mod256(temp),ones(1,k-i),mod256(tem)];%附点音调幅函数
% T1_25{j}=tem1;%附点音时值
end
clear dt t0_6 t1_5 t
%以A为基准,f=440hz
%中央区
c=261.63;
cp=277.18;ds=cp;
d=293.66;
dp=311.13;es=dp;
e=329.63;
f=349.23;
fp=369.99;gs=fp;
g=392.00;
gp=415.30;as=gp;
a=440.00;
ap=466.16;bs=ap;
b=493.88;
center4=single([c,cp,d,dp,e,f,fp,g,gp,a,ap,b]);
clear c cp ds d dp es e f fp gs g gp as a ap bs b
%全部音区,%88键
keys=center4;
for i=1:4
temp=center4/2^i;
tem=center4*2^i;
if i==4
temp(1:9)=[];
tem(2:end)=[];
end
keys=[temp,keys,tem];
end
clear center4
%国歌 1=G 2/4拍
%标准音长
for j=1:length(T1)
temp=cos(2*pi*keys'*T1{j});
temp(89,:)=single(0);%休止符
for i=1:89
sound1{i,j}=single(mod1{j}.*temp(i,:));
end
%cell sound1中j=1-8为 全音符,2分符,4分符,8分符,16分符,32分符,64分符,128分符
%i=1-88个音符
temp=cos(2*pi*keys'*T1_5{j});
temp(89,:)=single(0);%休止符
for i=1:89
sound1_5{i,j}=single(mod1_5{j}.*temp(i,:));
end
%cell sound1_5中j为 1附点的 全音符,2分符,4分符,8分符,16分符,32分符,64分符,128分符
%i=1-88个音符
temp=cos(2*pi*keys'*T0_6{j});
temp(89,:)=single(0);%休止符
for i=1:89
sound0_6{i,j}=single(mod0_6{j}.*temp(i,:));
end
%cell sound0_6中为三连音的 全音符,2分符,4分符,8分符,16分符,32分符,64分符,128分符
%i=1-88个音符
end
clear i j k temp tem T1_5 T1 T0_6 keys
do1_5f8=sound1_5{47,4};
mi1f16=sound1{51,5};
so1f8=sound1{54,4};
section1=[do1_5f8,mi1f16,so1f8,so1f8];
la1f4=sound1{56,3};
so1f4=sound1{54,3};
section2=[la1f4,so1f4];
mi1_5f8=sound1_5{51,4};
do1f16=sound1{47,5};
so0_6f8=sound0_6{54,4};
section3=[mi1_5f8,do1f16,so0_6f8,so0_6f8,so0_6f8];
mi1f4=sound1{51,3};
do1f4=sound1{47,3};
section4=[mi1f4,do1f4];
so0_6f8d=sound0_6{42,4};
section5=[so0_6f8d,so0_6f8d,so0_6f8d,so0_6f8d,so0_6f8d,so0_6f8d];
section=[section1,section2,section3,section4,section5];
clear section1 section2 section3 section4 section5
emf8=sound1{89,4};
so1f8d=sound1{42,4};
section6=[do1f4,emf8,so1f8d];
do1_5f4=sound1_5{47,3};
do1f8=sound1{47,4};
section7=[do1_5f4,do1f8];
la1f16d=sound1{44,5};
ti1f16d=sound1{46,5};
section8=[do1_5f8,do1f16,so1f8d,la1f16d,ti1f16d];
section9=[do1f4,do1f4];
mi1f8=sound1{51,4};
re1f16=sound1{49,5};
section10=[emf8,mi1f8,do1f8,re1f16,mi1f16];
section=[section,section6,section7,section8,section9,section10];
clear section6 section7 section8 section9 section10
section11=[so1f4,so1f4];
section12=[mi1_5f8,mi1f16,do1_5f8,mi1f16];
so1_5f8=sound1_5{54,4};
re1f4=sound1{49,3};
section13=[so1_5f8,mi1f16,re1f4];
re1f2=sound1{49,2};
section14=re1f2;
section15=[la1f4,so1f4];
section=[section,section11,section12,section13,section14,section15];
clear section11 section12 section13 section14 section15
section16=[re1f4,mi1f4];
section17=[so1f8,mi1f8,emf8,so1f8];
section18=[mi1f8,re1f16,mi1f16,do1f4];
emf4=sound1{89,3};
section19=[mi1f4,emf4];
so1_5f8d=sound1_5{42,4};
section20=[so1_5f8d,la1f16d,do1f8,do1f8];
section=[section,section16,section17,section18,section19,section20];
clear section16 section17 section18 section19 section20
section21=[mi1_5f8,mi1f16,so1f8,so1f8];
re1f8=sound1{49,4};
la1f4d=sound1{44,3};
section22=[re1f8,re1f16,re1f16,la1f4d];
re1_5f4=sound1_5{49,3};
section23=[re1_5f4,so1f8d];
section24=[do1_5f4,do1f8];
mi1_5f4=sound1_5{51,3};
section25=[mi1_5f4,mi1f8];
section=[section,section21,section22,section23,section24,section25];
clear section21 section22 section23 section24 section25
so1f2=sound1{54,2};
section26=so1f2;
section27=[do1_5f8,mi1f16,so1f8,so1f8];
section28=[la1f4,so1f4];
section29=[mi1_5f8,do1f16,so0_6f8,so0_6f8,so0_6f8];
section30=[mi1f8,emf8,do1f8,emf8];
section=[section,section26,section27,section28,section29,section30];
clear section26 section27 section28 section29 section30
sof4d=sound1{42,3};
section31=[sof4d,do1f4];
section32=[mi1_5f8,do1f16,so0_6f8,so0_6f8,so0_6f8];
section33=[mi1f8,emf8,do1f8,emf8];
section34=[sof4d,do1f4];
section35=[sof4d,do1f4];
section36=[sof4d,do1f4];
section37=[do1f4,emf4];
section=[section,section31,section32,section33,...
section34,section35,section36,section37];
clear section31 section32 section33 section34 section35 section36 section37
sound(section,fs);
matlab卡农代码微盘,MATLAB演奏国歌,除乐理知识基本抛弃卡农代码,未参照前国歌.......相关推荐
- tms320c6c语言代码微盘,TMS320C6
TMS320C64x学习笔记:1. DSP程序的编写与优化:由图5.1可以看出,优化C6000代码的基本途径由两条:优化C代码和优化线性汇编代码.因此,在编写C代码阶段就应该考虑到程序的结构和数据类型 ...
- 偏微分方程的matlab解法微盘,偏微分方程的MATLAB解法--陆君安.pdf
偏微分方程的MATLAB解法--陆君安.pdf 44494782 / 79306275 / 1 / 2159080011 / 0 / application/pdf / f7333cb3ba44e08 ...
- 雷达信号处理程序源码 python 需达围像识别 雷达系统仿真代码源码 matlab SAR 雷达系统仿真程序集合 雷达压制干扰matlab程序 线性调联(IFM)脉冲压缩雷达伤真
雷达信号处理程序源码 雷达系统仿真代码源码 matlab SAR 1.MAITOFPR 探地雷达数据处理MMITLAB程序 2.python 需达围像识别 3.SAR团达回波仿真matlab 4.SA ...
- matlab的灰色关联,灰色关联度Matlab代码
load x.txt %把原始数据存放在纯文本文件x.txt中,其中把数据的"替换替换成. for i=1:40 x(i,:)=x(i,:)/x(i,1); %标准化数据 end data= ...
- 基于IMAGE法的房间回响模型创建、C++代码实现、matlab仿真
基于IMAGE法的房间回响模型创建.C++代码实现.matlab仿真 1.模型简介 \qquad在处理声音信号时,我们要对信号先进行采集.那么我们就必须要有,一个发出声音的声源,一个进行声音采集的传感 ...
- matlab中codegen是什么,从 MATLAB 代码生成 C/C++ 代码。 - MATLAB codegen
- MathWorks 中国...
-c生成 C/C++ 代码,但不调用 make 命令. -config:dll使用默认配置参数生成动态 C/C++ 库. -config:exe使用默认配置参数生成静态 C/C++ 可执行文件. -c ...
- SiamFC代码配置复现 matlab版本
原创 SiamFC代码配置复现 2019-04-29 22:18:06 ZZXin_ 阅读数 1603更多 分类专栏: 深度学习 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议 ...
- A星融合DWA的路径规划算法,可实现静态避障碍及动态避障,代码注释详细,matlab源码
A星融合DWA的路径规划算法,可实现静态避障碍及动态避障,代码注释详细,matlab源码 ID:4525679980340317云的歌儿
- 光伏储能联合运行的直流微电网matlab/simulink 储能系统双向DCDC充放电控制 光伏+MPPT控制
光伏储能联合运行的直流微电网matlab/simulink 1.光伏+MPPT控制 2.储能系统双向DCDC充放电控制 3.有仿真+参考说明+相关文献+视频讲解 YID:335067471034488 ...
最新文章
- PRML-github code使用两个小攻略
- java遍历集合元素_遍历java集合元素的方法
- CodeForces - 1457D XOR-gun(位运算+暴力)
- 关于今天写Flex视频循环播放所出现的sdk问题
- python中汉字与变量不可同时出现_Python语言应用培训课(选择练习)
- 洽谈 “会话技术” 纯干货赶紧收藏吧
- linux仿真速度快吗,Linux上安装使用最快的GPU加速的终端仿真器Alacritty
- Spring Cloud —— 负载均衡与 Ribbon 应用
- cookie与token对比(转)
- 《Python cookbook》笔记二
- c语言链表复数,[蓝桥杯][算法提高VIP]复数求和-链表初学者看过来(C语言代码)...
- Java并发(基础知识)—— 创建、运行以及停止一个线程
- 2021-0413梦笔记
- 2015 年度新增开源软件排名 TOP100
- hutool生成二维码
- 蚂蚁调度AntJob-分布式任务调度系统
- 浏览器内核之渲染基础
- 三分钟快速了解typeScript的装饰器
- Ubuntu 18.04 Bionic Beaver Linux上安装TeamViewer
- 算法基础、算法比赛快速入门(java)
热门文章
- 这个 72k Star 的 GitHub 项目被封了
- 8款国产良心软件,一款比一款适用,请大家低调使用
- 2021年制冷与空调设备运行操作考试资料及制冷与空调设备运行操作免费试题
- canvas撒花瓣效果
- 沁恒微CH32V307开发板试用-RT-Thread+UART+LWIP+LED
- 新手学python,如何才能更快升职加薪,迎娶白富美,走上人生巅峰
- android蓝牙模块有哪些类型,蓝牙串口模块是什么?怎么用?有哪些种类?
- ubuntu 20.04安装 unity-tweak-tools 启动时遇到错误
- pandorabox php7,新路由3newifi D2专用潘多拉PandoraBox固件SFE快速转发超强信号不掉速eeprom...
- Word中的5个技巧,都很实用,收藏!