当前位置: 首页>>代码示例>>Python>>正文


Python Song.wrapNotesAndTimes方法代码示例

本文整理汇总了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)
开发者ID:shanemoon,项目名称:AutoMusic,代码行数:40,代码来源:Main.py

示例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
开发者ID:shanemoon,项目名称:AutoMusic,代码行数:32,代码来源:AutoComposeSong.py


注:本文中的Song.wrapNotesAndTimes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。