def get_branches(self, *args, **kwargs): return [ calliope.Phrase(*[ calliope.Cell(rhythm=c, pitches=self.get_pitches(c, o)) for c in self.cell_rhythms ]) for o in self.octaves ]
def weave(self, staff, index=0, **kwargs): if self.phrase_tree: my_phrases = [ calliope.Phrase(*[calliope.Cell(*[e() for e in c]) for c in p]) for p in self.phrase_tree ] else: my_phrases = [ p() for p in self.selectable.get_cyclic(index).phrases ] my_line = calliope.Line(*my_phrases) if self.slur_cells == True: calliope.SlurCells()(my_line) return my_line
def tell(self): s = SingLine() s.extend([SingPhraseA1(), SingPhraseB(), SingPhraseA0()]) SingSeq(interval=7, pitch=0).transform(s) calliope.SmartRange().transform(s) s["phrase0"].respell = "sharps" s["phrase1"].respell = "sharps" s["phrase2"].respell = "sharps" s["phrase3"].respell = "flats" s.insert(0, SingPhraseA0()) s.insert(1, SingPhraseA1()) s.insert(2, SingPhraseB()) s.insert(3, SingPhraseA0()) s.events[0].pitch += 5 # SPECIAL case for first event clang_line = calliope.Line( *[ClangPhrase(selectable=p) for p in s.phrases]) # TO DO: make this into a factory trem_line = calliope.Line(*[ calliope.Phrase( calliope.Cell(pitches=([e.pitch for e in p.events[1, 3, 4]], ), rhythm=(p[0].beats + p[1].beats, )), calliope.Cell(pitches=([e.pitch for e in p.events[-1, -2, -3]], ), rhythm=(p[2].beats + p[3].beats, )), ) for p in s.phrases ]) lb = calliope.LineBlock( clang_line, s, trem_line, ) # calliope.SlurCells()(lb) return lb
def get_branches(self, *args, **kwargs): if self.pitch_analizer is None: self.warn("pitch_analyzer must be added to kwargs") return [] phrase_list = [] pitches = [self.pitch_analizer.pitches_at( self.start_at_beat + (p*self.pulse_beats) ) for p in range(sum(self.cells_pulses))] # TO DO: this is NOT very elegant! for bs in range(self.block_size): pulse_counter = 0 my_phrase = calliope.Phrase() for cp in self.cells_pulses: my_cell = calliope.Cell(rhythm=(self.pulse_beats,)*cp) my_pitches = [] for pulse in range(cp): my_pitch = pitches[pulse_counter] if len(my_pitch) == 0: my_pitches.append(None) else: my_pitches.append(my_pitch[bs % len(my_pitch)]) pulse_counter += 1 my_cell.pitches = my_pitches my_phrase.append(my_cell) phrase_list.append(my_phrase) phrase_list.reverse() return phrase_list
# # A little better # for e1,e2 in zip(l2.note_events, l1.note_events): # e1.pitch = [e1.pitch+2, e2.pitch] # e1.respell = "sharps" # for e in l1.events: # e.beats = e.beats / 2 # Pretty good for rhythm for p in l1.phrases[0, 1, 3]: p.rhythm = (0.75, 0.25, 0.5, 0.5) * 3 l1.phrases[2].rhythm = [0.5] * 10 + [1] l2 = l1() l2.insert(0, calliope.Phrase(rhythm=(12, ), pitches=(None, ))) l2.pop("phrase1") # for e in l2.select["phrase2", "phrase3"].note_events: e.pitch += 5 l1.extend(( calliope.Phrase(rhythm=(6, ), pitches=(None, )), l1["phrase1"](name="phrase4"), l1["phrase2"](name="phrase5"), l1["phrase3"](name="phrase6"), )) for e in l1.select["phrase4", "phrase5", "phrase6"].note_events: e.pitch -= 2
def __call__(self, **kwargs): return calliope.Phrase(*self.get_phrase_cells(**kwargs), **kwargs)