PySynth 可在一首歌中的说明创建一个合成的音频WAV文件列表。
使用方法:
% python ActivePython 2.5.0.0 (ActiveState Software Inc.) based on Python 2.5 (r25:51908, Mar 9 2007, 17:40:37) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import pysynth >>> test = ( ('c', 4), ('e', 4), ('g', 4), ('c5', 1) ) >>> pysynth.make_wav(test, fn = "test.wav") Writing to file test.wav [1/4] >>>
import pysynth import numpy as np import re #先限定音符12356 中国风五声调式 这样听起来比较自然 notes=np.array(["c4","d4","e4","g4","a4",]) #音符时值 durations=np.array([1,2,4,-2,-4,-8]) #随机生成音符 重音穿插其中 sn=[] for t in range(1