matlab最炫名族风,matlab版 “最炫民族风” — 跟风之作(附音频效果)(转)[通俗易懂]

2022-11-08 19:05:05 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

晚上看到个帖,matlab演奏卡农,眼前一亮,以前从没想过用matlab出声,作者真乃大牛。看到一条评论:卡农算什么,有本事来最炫民族风。。。。于是我就手贱了。。。 花了几个小时。。。1/3在读懂卡农的程序,1/3在学习简谱知识(还好小学初中学过点),1/3在把简谱转换成代码。。。 不多说,程序如下,欢迎试听哈: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Most shining national wind//最炫民族风 on Matlab

% The Modification is from “canon”, not by me

fs = 44100; % sample rate

dt = 1/fs;

T16 = 0.125;

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] = size(t8);

% Modification functions

mod4=(t4.^4).*exp(-30*(t4.^0.5));

mod4=mod4*(1/max(mod4));

mod8=(t8.^4).*exp(-50*(t8.^0.5));

mod8=mod8*(1/max(mod8));

mod16=(t16.^4).*exp(-90*(t16.^0.5));

mod16=mod16*(1/max(mod16));

f0 = 2*146.8; % reference frequency

ScaleTable = [2/3 3/4 5/6 15/16 …

1 9/8 5/4 4/3 3/2 5/3 9/5 15/8 …

2 9/4 5/2 8/3 3 10/3 15/4 4 …

1/2 9/16 5/8];

% 1/4 notes

do0f = mod4.*cos(2*pi*ScaleTable(21)*f0*t4);

re0f = mod4.*cos(2*pi*ScaleTable(22)*f0*t4);

mi0f = mod4.*cos(2*pi*ScaleTable(23)*f0*t4);

fa0f = mod4.*cos(2*pi*ScaleTable(1)*f0*t4);

so0f = mod4.*cos(2*pi*ScaleTable(2)*f0*t4);

la0f = mod4.*cos(2*pi*ScaleTable(3)*f0*t4);

ti0f = mod4.*cos(2*pi*ScaleTable(4)*f0*t4);

do1f = mod4.*cos(2*pi*ScaleTable(5)*f0*t4);

re1f = mod4.*cos(2*pi*ScaleTable(6)*f0*t4);

mi1f = mod4.*cos(2*pi*ScaleTable(7)*f0*t4);

fa1f = mod4.*cos(2*pi*ScaleTable(8)*f0*t4);

so1f = mod4.*cos(2*pi*ScaleTable(9)*f0*t4);

la1f = mod4.*cos(2*pi*ScaleTable(10)*f0*t4);

tb1f = mod4.*cos(2*pi*ScaleTable(11)*f0*t4);

ti1f = mod4.*cos(2*pi*ScaleTable(12)*f0*t4);

do2f = mod4.*cos(2*pi*ScaleTable(13)*f0*t4);

re2f = mod4.*cos(2*pi*ScaleTable(14)*f0*t4);

mi2f = mod4.*cos(2*pi*ScaleTable(15)*f0*t4);

fa2f = mod4.*cos(2*pi*ScaleTable(16)*f0*t4);

so2f = mod4.*cos(2*pi*ScaleTable(17)*f0*t4);

la2f = mod4.*cos(2*pi*ScaleTable(18)*f0*t4);

ti2f = mod4.*cos(2*pi*ScaleTable(19)*f0*t4);

do3f = mod4.*cos(2*pi*ScaleTable(20)*f0*t4);

blkf = zeros(1,i);

% 1/8 notes

do0e = mod8.*cos(2*pi*ScaleTable(21)*f0*t8);

re0e = mod8.*cos(2*pi*ScaleTable(22)*f0*t8);

mi0e = mod8.*cos(2*pi*ScaleTable(23)*f0*t8);

fa0e = mod8.*cos(2*pi*ScaleTable(1)*f0*t8);

so0e = mod8.*cos(2*pi*ScaleTable(2)*f0*t8);

la0e = mod8.*cos(2*pi*ScaleTable(3)*f0*t8);

ti0e = mod8.*cos(2*pi*ScaleTable(4)*f0*t8);

do1e = mod8.*cos(2*pi*ScaleTable(5)*f0*t8);

re1e = mod8.*cos(2*pi*ScaleTable(6)*f0*t8);

mi1e = mod8.*cos(2*pi*ScaleTable(7)*f0*t8);

fa1e = mod8.*cos(2*pi*ScaleTable(8)*f0*t8);

so1e = mod8.*cos(2*pi*ScaleTable(9)*f0*t8);

la1e = mod8.*cos(2*pi*ScaleTable(10)*f0*t8);

tb1e = mod8.*cos(2*pi*ScaleTable(11)*f0*t8);

ti1e = mod8.*cos(2*pi*ScaleTable(12)*f0*t8);

do2e = mod8.*cos(2*pi*ScaleTable(13)*f0*t8);

re2e = mod8.*cos(2*pi*ScaleTable(14)*f0*t8);

mi2e = mod8.*cos(2*pi*ScaleTable(15)*f0*t8);

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/190858.html原文链接:https://javaforall.cn

0 人点赞