Пример #1
0
def music(
    location,
    rmaker,
    *args,
    forget=False,
    preprocessor=None,
    rewrite_meter=None,
):
    commands = []
    arguments = []
    for arg in args:
        if issubclass(arg.__class__, rmakers.Command):
            commands.append(arg)
        else:
            arguments.append(arg)
    if rewrite_meter is not None:
        stack = rmakers.stack(
            rmaker,
            *commands,
            rmakers.trivialize(lambda _: abjad.Selection(_).tuplets()),
            rmakers.rewrite_rest_filled(
                lambda _: abjad.Selection(_).tuplets()),
            rmakers.rewrite_sustained(lambda _: abjad.Selection(_).tuplets()),
            rmakers.extract_trivial(),
            rmakers.RewriteMeterCommand(
                boundary_depth=rewrite_meter,
                reference_meters=[
                    abjad.Meter((4, 4))
                ],  # reference meters is for constructing special offset inventories (i.e. akasha 6/8)
            ),
            preprocessor=preprocessor,
        )
        handler = RhythmHandler(
            stack,
            forget=forget,
        )
    else:
        stack = rmakers.stack(
            rmaker,
            *commands,
            rmakers.trivialize(lambda _: abjad.Selection(_).tuplets()),
            rmakers.rewrite_rest_filled(
                lambda _: abjad.Selection(_).tuplets()),
            rmakers.rewrite_sustained(lambda _: abjad.Selection(_).tuplets()),
            rmakers.extract_trivial(),
            preprocessor=preprocessor,
        )
        handler = RhythmHandler(
            stack,
            forget=forget,
        )

    out = MusicCommand(
        location,
        handler,
        *arguments,
    )
    return out
Пример #2
0
    "(1 ((3 (1 1 1)) 1 2 2))",
    "(1 (1 2 2 3))",
    "(1 ((2 (1 1)) 2 3 1))",
    "(1 ((2 (1 1)) 3 1 2))",
])

rmaker_two = rmakers.stack(
    rmakers.talea(
        [3, -1, 2, -2, 3, 1, 2, 2, -3, 1, -2, 2],
        4,
        extra_counts=[0, 3, -1, 2, -2, 0, 3, 1, 2, 2, 0, -3, 1, -2, 2],
    ),
    rmakers.trivialize(abjad.select().tuplets()),
    rmakers.extract_trivial(abjad.select().tuplets()),
    rmakers.rewrite_rest_filled(abjad.select().tuplets()),
    rmakers.rewrite_sustained(abjad.select().tuplets()),
)

rmaker_three = evans.RTMMaker(rtm=[
    "(1 (2 2 1 3))",
    "(1 (2 2 1 4))",
    "(1 (3 3 3 5))",
    "(1 (4 4 4 5))",
    "(1 (4 4 3 4))",
    # "(1 (5 4 4 5))",
    "(1 (2 1 1 2))",
    # "(1 (5 5 5 5))",
    "(1 (1 1 1 1))",
    # "(1 (4 3 4 4))",
    "(1 (2 1 2 2))",
    "(1 (3 4 3 4))",
Пример #3
0
rmaker = rmakers.talea([1, 3, 2, 4, 5], 8, extra_counts=[1, 0, 1, 1, 2, 3, 4])


def quarters(divisions):
    divisions = evans.BacaSequence(divisions)
    divisions = evans.BacaSequence(
        evans.BacaSequence(_).quarters() for _ in divisions)
    divisions = evans.BacaSequence(divisions).flatten(depth=-1)
    return divisions


commands = [
    rmakers.trivialize(lambda _: abjad.Selection(_).tuplets()),
    rmakers.rewrite_rest_filled(lambda _: abjad.Selection(_).tuplets()),
    rmakers.rewrite_sustained(lambda _: abjad.Selection(_).tuplets()),
    rmakers.extract_trivial(),
    rmakers.RewriteMeterCommand(
        boundary_depth=-1,
        reference_meters=[
            abjad.Meter((6, 8)),
            abjad.Meter((9, 8)),
        ],
    ),
]

stack = rmakers.stack(
    rmaker,
    *commands,
    preprocessor=quarters,
)
Пример #4
0
# x
# x y 
# x y z
# x z
# 

selector = abjad.select().tuplets()[1:]
selector = selector.map(abjad.select().note(1))

last_leaf = abjad.select().leaf(-6)
nonlast_tuplets = abjad.select().tuplets()[:-1]

rhythm_maker_voice_one = rmakers.stack(
    rmakers.even_division([8], extra_counts=[0, 1]),
    rmakers.tie(abjad.select().leaves().get([0], 2)),
    rmakers.rewrite_sustained(),
    # rmakers.beam(),
    # rmakers.extract_trivial(),
    )

# rmakers.stack(rmakers.tuplet([(2, 2, 2), (2, 2, 2, 2)]), rmakers.beam(), rmakers.extract_trivial(),)

rhythm_maker_voice_four = rmakers.stack(
    rmakers.even_division([8], extra_counts=[0, 1]),
    rmakers.force_rest(abjad.select().leaves().get([0])),
    rmakers.tie(abjad.select().leaves().get([1], 2)),
    rmakers.rewrite_sustained(),
    # rmakers.beam(),
    # rmakers.extract_trivial(),
    )
    # rmakers.tuplet(