本文整理汇总了Python中Song.markSongEnd方法的典型用法代码示例。如果您正苦于以下问题:Python Song.markSongEnd方法的具体用法?Python Song.markSongEnd怎么用?Python Song.markSongEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Song
的用法示例。
在下文中一共展示了Song.markSongEnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialSongUI
# 需要导入模块: import Song [as 别名]
# 或者: from Song import markSongEnd [as 别名]
from NoteSequence import *
from MidiNote import *
def initialSongUI():
trackCount = raw_input('Enter track count: ')
tempo = raw_input('Enter a tempo: ')
key = raw_input('Enter a key: ')
length = raw_input('Enter a song length: ')
return (int(trackCount), int(tempo), str(key), str(length))
#Supports up to four tracks
#TODO: Make this a little more elegant
def determineVoice(currentTrackCount):
if currentTrackCount == 0: return ALTO
if currentTrackCount == 1: return BASS
if currentTrackCount == 2: return SOPRANO
if currentTrackCount == 3: return TENOR
if __name__ == '__main__':
choices = initialSongUI()
song = Song(choices[0], #Track Count
choices[1]) #Tempo
key = choices[2] #Key
length = int(choices[3]) #Length
for i in range(song.trackCount):
seq = NoteSequence(key, determineVoice(i), length)
seq.writeSequenceToTrack(song, i)
song.markSongEnd()
midi.write_midifile("example.mid", song.pattern)