本文整理汇总了Python中Song.wrapNotesAndTimes方法的典型用法代码示例。如果您正苦于以下问题:Python Song.wrapNotesAndTimes方法的具体用法?Python Song.wrapNotesAndTimes怎么用?Python Song.wrapNotesAndTimes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Song
的用法示例。
在下文中一共展示了Song.wrapNotesAndTimes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AutoMusic
# 需要导入模块: import Song [as 别名]
# 或者: from Song import wrapNotesAndTimes [as 别名]
def AutoMusic(self, parent, page_type, loadpic, waitpic,
incontainer, outcontainer, records, music):
"""
This is a callback function for 'Generate' button.
It takes the selected inputs from the listbox,
make an AutoComposeSong object, and execute its functions
to output a MIDI file.
* See 'AutoComposeSong.py' for the detailed explanation
on how these methods work.
"""
genre = self.genreList[int(self.gr_listbox.curselection()[0])]
key = eval(self.keyList[int(self.key_listbox.curselection()[0])])
cp = self.cpList[int(self.cp_listbox.curselection()[0])]
title = self.title.get()
mode = Tonics
numPhrase = 4
beat = 72
if self.entry_field.get() == '':
userInput = []
else:
userInput = Song()
userInput.reset()
userInputMelody = wrapNote(self.entry_field.get().split('-'))
userInputTimes = constant_times(userInputMelody, 2, beat)
userInput.wrapNotesAndTimes(userInputMelody, userInputTimes)
autoSong = AutoComposeSong()
autoSong.reset()
autoSong.setTitle(title)
autoSong.setup(genre, key, mode, cp, numPhrase, beat, userInput)
autoSong.exportMidi(1, 'Output MIDIs/' + title + '.mid')
self.page_factory(parent, page_type, loadpic, waitpic,
incontainer, outcontainer, records, autoSong)
示例2: wrapNote
# 需要导入模块: import Song [as 别名]
# 或者: from Song import wrapNotesAndTimes [as 别名]
return wrapNote(notes)
if __name__ == '__main__':
autoSong = AutoComposeSong('Test')
# Example Inputs
genre = 'New Age'
key = B
mode = Tonics
chordProgression = CP2
numPhrase = 80
beat = 48
# Excerpt from 'River Flows in You', by Yiruma
inputNotes = wrapNote([69, 68, 69, 68, 69, 64, 69, 62])
inputTimes = [72, 144, 216, 288, 360, 432, 504, 578]
userInput = Song()
userInput.wrapNotesAndTimes(inputNotes, inputTimes)
userInput = []
# Export the Automated Song
autoSong.setup(genre, key, mode, chordProgression, numPhrase, beat, userInput)
autoSong.exportMidi(1, 'TEST.mid')
print autoSong