码迷,mamicode.com
首页 > 其他好文 > 详细

[从头学声学] 第210节 乐音的偏混

时间:2016-05-12 17:06:15      阅读:208      评论:0      收藏:0      [点我收藏+]

标签:

剧情提要:
[机器小伟]在[工程师阿伟]的陪同下进行着声学神通的修炼。
这次要研究的是[乐音的偏混]。

正剧开始:

星历2016年05月10日 16:55:51, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和[机器小伟]一起研究[乐音的偏混]。


#乐音的偏混
#生成音乐文件内容
def waveDataGen():
    import wavename;
    import wavedata;

    vowelName_en = wavename.vowelName_en;
    size_ve = len(vowelName_en);
    vowelName_zh = wavename.vowelName_zh;
    size_vz = len(vowelName_zh);
    consonantName_zh = wavename.consonantName_zh;
    size_cz = len(consonantName_zh);
    musicToneName = wavename.musicToneName;
    size_mt = len(musicToneName);

    #print(size_ve, size_vz, size_cz, size_mt);
    #16 29 70 77

    #22k/s => 1.32M/min => 15.84M/12min
    data = [];

    for n in range(1, 13):
        swing = n;

        for i in range(size_cz):
            if i < swing or i > size_mt-swing-1:
                continue;

            voicePiece_1 = eval('wavedata.'+musicToneName[i-swing]);
            voicePiece_2 = eval('wavedata.'+musicToneName[i]);        
            voicePiece_3 = eval('wavedata.'+musicToneName[i+swing]);

            for j in range(3):                          
                data += voicePiece_1;            
                data += voicePiece_2;                           
                data += voicePiece_3;
                data += voicePiece_2;

            for j in range(30):
                data += idleWave;

        for i in range(100):
            data += idleWave;

    return data;


乐音的偏混(3*)
点击打开链接--乐音的偏混(3*)


乐音的偏混

点击打开链接--乐音的偏混


#生成音乐文件内容
def waveDataGen():
    import wavename;
    import wavedata;


    vowelName_en = wavename.vowelName_en;
    size_ve = len(vowelName_en);
    vowelName_zh = wavename.vowelName_zh;
    size_vz = len(vowelName_zh);
    consonantName_zh = wavename.consonantName_zh;
    size_cz = len(consonantName_zh);
    musicToneName = wavename.musicToneName;
    size_mt = len(musicToneName);


    #print(size_ve, size_vz, size_cz, size_mt);
    #16 29 70 77


    #22k/s => 1.32M/min => 15.84M/12min
    data = [];


    for n in range(12, 30):
        swing = n;


        for i in range(size_cz):
            if i < swing or i > size_cz-swing-1:
                continue;


            voicePiece_1 = eval('wavedata.'+consonantName_zh[i-swing]);
            voicePiece_2 = eval('wavedata.'+consonantName_zh[i]);        
            voicePiece_3 = eval('wavedata.'+consonantName_zh[i+swing]);


            for j in range(1):                          
                data += voicePiece_1;            
                data += voicePiece_2;                           
                data += voicePiece_3;
                data += voicePiece_2;
                data += voicePiece_1;            
                data += voicePiece_2;


            for j in range(30):
                data += idleWave;


        for i in range(100):
            data += idleWave;


    return data;

本节到此结束,欲知后事如何,请看下回分解。

[从头学声学] 第210节 乐音的偏混

标签:

原文地址:http://blog.csdn.net/mwsister/article/details/51364605

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!