尝试生成一下上古8bit音乐,感觉这个要学学乐理再来整了。

emmm,看了一些资料1大概了解这些8bit音乐是用这些波生成的了。
不过我对乐理一窍不通啊。怎么做个8bit声卡毫无思路。

这块内容怕是得先放一放了,等对乐理知识有点了解再来。

下面是我抄了点谱试着生成一下,效果极差!!!!(╯▔皿▔)╯生气!!!

from numpy.core.defchararray import mod
from wavCreate import *

sample_rate = 22050

Tunelist = [
    (3,0.5),
    (3,0.5),
    (3,0.5),
    (1,0.25),
    (3,0.25),
    (0,0.5),
    (5,0.5),
    (0,0.5),
    (0.5,0.5),
    (0,0.5),
    (1,0.5),
    (0,0.5),
    (0.5,0.5),
    (0,0.5),
    (0.3,0.5),
    (0,0.5),
    (0.6,0.5),
    (0.7,0.5),
    (0.7,0.5),
    (0.6,0.5),
    (3,0.5),
    (5,0.25),
    (6,0.25),
    (0,0.5),
    (4,0.25),
    (5,0.25),
    (0,0.5),
    (3,0.25),
    (0,0.5),
    (1,0.25),
    (2,0.25),
    (0.7,0.5),
    (0,0.5),
    (1,0.5),
    (0,0.5),
    (0.5,0.25)
]

## creat wave
def CreateWaveBaseOnStaff(Tunelist,basicMode,sample_rate = 22050):
    y_total = np.array([])
    TuneFre = 0
    for i in range(len(Tunelist)):
        mode = basicMode
        if Tunelist[i][0] == 0:
            mode = "None"
        elif Tunelist[i][0] > 10:
            TuneFre = TuneHigh[int(Tunelist[i][0] // 10)]
        elif Tunelist[i][0] < 1:
            TuneFre = TuneLow[int(Tunelist[i][0]*10)]
        else:
            TuneFre = TuneMid[Tunelist[i][0]] 
        y,t = createWave(sample_rate,fa = TuneFre,t_length = 0.5*Tunelist[i][1],mode=mode)
        y_total = np.concatenate((y_total,y))
    return y_total

y_square = CreateWaveBaseOnStaff(Tunelist,'square25',sample_rate)
y_triangle = CreateWaveBaseOnStaff(Tunelist,'triangle',sample_rate)
y_square2 = CreateWaveBaseOnStaff(Tunelist,'square50',sample_rate)

saveWave((y_square + y_square2 + y_triangle )/3,sample_rate,path = r'wave.wav')

尝试生成一下上古8bit音乐,感觉这个要学学乐理再来整了。_第1张图片


  1. 【编曲教程】如何制作8bit音乐?十分钟轻度解析马里奥配乐~ ↩︎

你可能感兴趣的:(8bit)