本文整理汇总了Python中note.Note.set_kick方法的典型用法代码示例。如果您正苦于以下问题:Python Note.set_kick方法的具体用法?Python Note.set_kick怎么用?Python Note.set_kick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类note.Note
的用法示例。
在下文中一共展示了Note.set_kick方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: kick_drum_line
# 需要导入模块: from note import Note [as 别名]
# 或者: from note.Note import set_kick [as 别名]
def kick_drum_line(composition, drop_number):
new_note_list = []
duration = 44100 / 8
drop_increment = duration / drop_number
for i, note in enumerate(composition.get_notes()):
effect_start_time = note.get_start_time() - duration
effect_end_time = note.get_start_time()
if effect_start_time < 0 :
new_note_list.append(note)
continue
if i != 0:
if note.is_kick():
rollback = 0
indices_in_notes_list = len(new_note_list) - 1
#keep rolling back until "in drop time" notes are popped off
while True:
last_note = new_note_list[-1]
if last_note.get_start_time() > (last_note.get_end_time() - duration):
new_note_list.pop()
else:
break
last_note = new_note_list[-1]
last_note.set_end_time(effect_start_time)
scale = composition.get_scale()
closest = utilities.find_closest(scale, note.get_frequency())
index = scale.index(closest) + drop_number
ampl = note.get_amplitude()
for x in range(0, drop_number):
new_s_time = int(effect_start_time + x * drop_increment)
new_e_time = int(effect_start_time + (x+1) * drop_increment)
new_freq = scale[index]
nn = Note(new_s_time, new_e_time, new_freq, ampl)
nn.set_kick(True)
new_note_list.append(nn)
index -=1
new_note_list.append(note)
else:
new_note_list.append(note)
composition.notes = new_note_list