Esempio n. 1
0
 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
Esempio n. 2
0
 def slur_cells(self):
     self.transformed(calliope.SlurCells())
     return self
Esempio n. 3
0
#     )

# flute_line = melody_line()

# a.poke_to_staff(
#     flute_line.cells(4,8,12),
#     flute_line,
#     "flute",
#     )
# GroupUp()(a.score.staves["flute"].cells)

# # TO DO MAYBE... make this oboe line implementation less custom?
# oboe_line = calliope.Line(
#     calliope.Event(
#         rest=True,
#         beats=sum([p.beats for p in melody_line.phrases[:3]])
#         )
#     )

# for p,p1 in zip(melody_line.phrases[3:-1], melody_line.phrases[4:]):
#     oboe_line.append( calliope.Event(rest=True, beats=p[0].beats) )
#     oboe_line.append( calliope.Event(pitch=p1.events[0].pitch, beats=p[1].beats) )

# a.score.staves["oboe"].append(oboe_line)

calliope.SlurCells()(a.score.staff_groups("short_score"))

a.score.illustrate_me(
    # as_midi=True,
)
Esempio n. 4
0
Stutter()(l0.events[5, 6, 7])


# TO DO: Shouldn't have to sublcass just for illustrate_me file location!!!
class YoLineBlock(calliope.LineBlock):
    pass


l = YoLineBlock(
    l0,
    l1,
    l2,
)

calliope.SlurCells()(l)

# l.illustrate_me()

# c = calliope.Cell(pitches=((1,2,3),), rhythm=(4,))
# c.illustrate_me()

# calliope.SpanByType(by_type=calliope.Phrase)(l)
# s.staves["violin1"].append(l)
# s.illustrate_me()

# l1.illustrate_me()
# l.illustrate_me(
# #     as_midi=True
#     )
Esempio n. 5
0
import abjad, calliope

from folktale.lines.sing_line import SingLine

s = SingLine()

SING_CHORDS_FROM_CELLS = calliope.Line(*[
    calliope.Cell(factory=calliope.ChordsFromSelectable(p.cells), )
    for p in s.phrases
])

SING_CHORDS_FROM_CELLS.events.setattrs(beats=1)
calliope.SlurCells()(SING_CHORDS_FROM_CELLS)

SING_CELLS_PITCHES = [c.pitch for c in SING_CHORDS_FROM_CELLS.events]

SING_CELLS_PITCHES_GROUP_2 = [
    sorted(set(a) | set(b))
    for a, b in zip(SING_CELLS_PITCHES[:-1], SING_CELLS_PITCHES[1:])
]

SING_CHORDS_FROM_CELLS_GROUP_2 = calliope.Cell(
    pitches=(SING_CELLS_PITCHES_GROUP_2),
    rhythm=(1, ) * len(SING_CELLS_PITCHES_GROUP_2))

# SING_CHORDS_FROM_CELLS_GROUP_2.illustrate_me()