QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 1361|回复: 0
打印 上一主题 下一主题

董小姐-MATLAB版本【源代码】

[复制链接]
字体大小: 正常 放大
乐俊        

1

主题

11

听众

95

积分

升级  94.74%

  • TA的每日心情

    2014-9-22 14:55
  • 签到天数: 10 天

    [LV.3]偶尔看看II

    自我介绍
    wu

    群组第六届国赛赛前冲刺培

    跳转到指定楼层
    1#
    发表于 2014-9-1 20:17 |只看该作者 |倒序浏览
    |招呼Ta 关注Ta
    %《董小姐》
    %原词曲:宋东野
    %现曲:MATLAB 制作人:LG
    %曲谱见:http://www.jianpu.cn/pu/22/227160.htm
    %%
    clc;
    clear all;
    close all;

    fs = 44100;%采样率
    dt = 1/fs;
    T16=0.25;% E4/4时长0.25s
    t16 = 0:dt:T16;
    [temp, k] = size(t16);
    t4 = linspace(0,4*T16,4*k);
    t8 = linspace(0,2*T16,2*k);
    t3_16 = linspace(0,3*T16,3*k);
    [temp, i] = size(t4);
    [temp, j] = size(t8);

    f = 440*(1/2)^(5/12);% E大调
    d = 2^(1/12);

    % Modification functions
    mod4 = sin(pi*t4/t4(end));
    mod8 = sin(pi*t8/t8(end));
    mod16 = sin(pi*t16/t16(end));

    %休止符
    blk4 = zeros(1,i);%4分休止符
    blk8 = zeros(1,j);%8分休止符
    blk16 = zeros(1,k);%16分休止符

    %4分音符
    one4 = mod4.*sin(2*pi*f*d^1*t4);
    two4 = mod4.*sin(2*pi*f*d^3*t4);
    three4 = mod4.*sin(2*pi*f*d^5*t4);
    four4 = mod4.*sin(2*pi*f*d^6*t4);
    five4 = mod4.*sin(2*pi*f*d^8*t4);
    six4 = mod4.*sin(2*pi*f*d^10*t4);
    seven4 = mod4.*sin(2*pi*f*d^12*t4);
    upone4 = mod4.*sin(2*pi*f*d^13*t4);
    uptwo4 = mod4.*sin(2*pi*f*d^15*t4);
    upthree4 = mod4.*sin(2*pi*f*d^17*t4);
    %8分音符
    one8 = mod8.*sin(2*pi*f*d^1*t8);
    two8 = mod8.*sin(2*pi*f*d^3*t8);
    three8 = mod8.*sin(2*pi*f*d^5*t8);
    four8 = mod8.*sin(2*pi*f*d^6*t8);
    five8 = mod8.*sin(2*pi*f*d^8*t8);
    six8 = mod8.*sin(2*pi*f*d^10*t8);
    seven8 = mod8.*sin(2*pi*f*d^12*t8);
    upone8 = mod8.*sin(2*pi*f*d^13*t8);
    uptwo8 = mod8.*sin(2*pi*f*d^15*t8);
    upthree8 = mod8.*sin(2*pi*f*d^17*t8);
    %16分音符
    one16 = mod16.*sin(2*pi*f*d^1*t16);
    two16 = mod16.*sin(2*pi*f*d^3*t16);
    three16 = mod16.*sin(2*pi*f*d^5*t16);
    four16 = mod16.*sin(2*pi*f*d^6*t16);
    five16 = mod16.*sin(2*pi*f*d^8*t16);
    six16 = mod16.*sin(2*pi*f*d^10*t16);
    seven16 = mod16.*sin(2*pi*f*d^12*t16);
    upone16 = mod16.*sin(2*pi*f*d^13*t16);
    uptwo16 = mod16.*sin(2*pi*f*d^15*t16);
    upthree16 = mod16.*sin(2*pi*f*d^17*t16);
    upfive16 = mod16.*sin(2*pi*f*d^20*t16);

    % 连音符
    mod3_16 = sin(pi*t3_16/t3_16(end));
    one3_16 = mod3_16.*sin(2*pi*f*d^1*t3_16);
    two3_16 = mod3_16.*sin(2*pi*f*d^3*t3_16);
    three3_16 = mod3_16.*sin(2*pi*f*d^5*t3_16);
    four3_16 = mod3_16.*sin(2*pi*f*d^6*t3_16);
    five3_16 = mod3_16.*sin(2*pi*f*d^8*t3_16);
    six3_16 = mod3_16.*sin(2*pi*f*d^10*t3_16);
    seven3_16 = mod3_16.*sin(2*pi*f*d^12*t3_16);
    upone3_16 = mod3_16.*sin(2*pi*f*d^13*t3_16);
    uptwo3_16 = mod3_16.*sin(2*pi*f*d^15*t3_16);
    upthree3_16 = mod3_16.*sin(2*pi*f*d^17*t3_16);

    %曲谱
    melody = [blk4 five8 upone16 six3_16 blk8 blk8 six16 six16 six16 six16...
        seven8 five8 five16 six16 five3_16 three8 blk16 two16 three16 two16...
        three8 two16 five16 five4 blk8 two8 five8 two8...
        five8 three8 blk4 blk4 blk4...
        blk4 five8 upone16 six3_16 blk8 blk16 six16 seven16 five16...
        seven16 seven8 five16 seven8 five16 seven3_16 six8 blk8 five16 five16...
        six8 six16 six3_16 five8 blk4 three16 two8 three16...
        one4 blk4 blk4 blk4...
        blk4 five8 upone16 six3_16 blk8 blk8 six16 six16...
        seven16 seven3_16 seven8 five16 seven16 seven16 six16 six8 blk8 three16 five16...
        six8 five16 six16 five8 five3_16 six16 five8 two16 two8 five16 five16...
        five8 three3_16 blk4 blk4 blk4...
        blk4 five8 upone16 six3_16 blk8 six16 seven8 seven16...
        seven16 five16 five8 upone8 uptwo16 upone8 six3_16 blk16 five16 six16 five16...
        six4 blk16 five16 six16 six16 five3_16 seven3_16 seven16 upone16...
        upone4 upone4 blk4 blk4...
        blk8 upthree16 upthree16 upthree8 uptwo16 upthree8 uptwo8 uptwo16 uptwo8 upone16 upthree16...
        upthree16 upthree3_16 five8 upone16 six3_16 blk8 blk8 blk16 five16...
        upthree8 upthree16 uptwo16 upthree8 uptwo16 upthree8 uptwo8 uptwo16 upone16 upone8 five16...
        five16 upthree8 upthree16 upthree4 blk4 blk4...
        upthree8 six8 upthree8 upfive16 upthree16 upthree16 uptwo3_16 blk16 upone16 upone16 uptwo16...
        upthree8 five8 upthree8 uptwo16 five8 six3_16 blk16 six16 six16 five16...
        five8 five16 upone8 upone3_16 blk4 five8 upone16 upone16...
        one4 blk4 blk4 blk16 six16 six16 five16...
        five8 five16 upone8 upone3_16 blk4 five8 upone16 upone16...
        one4 blk4 blk4 blk4...
        blk4 blk4 blk4 blk4...
        blk4 blk4 blk4 blk4...
        five8 five16 upone8 upone3_16 blk4 five8 upone16 upone16...
        one4 blk4 blk4 blk4...
        blk4 blk4 blk4 blk4...
        ];
    sound(melody, fs);
    %%

    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

    关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

    手机版|Archiver| |繁體中文 手机客户端  

    蒙公网安备 15010502000194号

    Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

    GMT+8, 2025-10-1 07:52 , Processed in 0.491113 second(s), 49 queries .

    回顶部