Controlling 8th note splitting in rewrite_meter

7 views
Skip to first unread message

ma...@opus11.net

unread,
Mar 17, 2022, 6:50:39 AM3/17/22
to abjad-user
I'm not sure how to control how offbeat 8th notes are split when using rewrite_meter. This is my current process - note that I'm principally interested in the first beat.

music = "c16 c8 c16 c2."
container = abjad.Container(music)
meter = abjad.Meter((4, 4))
# meter = abjad.Meter((1, 4))
shards = abjad.mutate.split(container, [meter.duration], cyclic=True)
for shard in shards:
    abjad.Meter.rewrite_meter(shard, meter)

When defining meter as 4/4, this splits the 8th note into two tied 16ths. But if I use 1/4 meter, the 8th note is retained. The behaviour I actually want is to retain the offbeat 8th note in 4/4. Is there a way to achieve this?

Thanks,

Mark

Trevor Bača

unread,
Jul 11, 2022, 1:45:19 PM7/11/22
to abjad...@googlegroups.com

The default of “meter hierarchy” of abjad.Meter((4, 4)) looks like this:

>>> meter = abjad.Meter((4, 4))
>>> print(meter.pretty_rtm_format)
(4/4 (
    1/4
    1/4
    1/4
    1/4))

Rewriting c16 c8 c16 c2. with default abjad.Meter((4, 4)) splits the offbeat eighth note into a pair of tied sixteenths (as shown in your example):

>>> container = abjad.Container("c16 c8 c16 c2.")
>>> abjad.Meter.rewrite_meter(container, meter)
>>> abjad.show(container)

example-1.png
The metric hierarchy of any meter can be customized.

Here’s an example that customizes the structure of the first beat in the measure (but produces the same results as before):

>>> meter = abjad.Meter("(4/4 ((1/4 (1/8 1/8)) 1/4 1/4 1/4))")
>>> print(meter.pretty_rtm_format)
(4/4 (
    (1/4 (
        1/8
        1/8))
    1/4
    1/4
    1/4))
>>> container = abjad.Container("c16 c8 c16 c2.")
>>> abjad.Meter.rewrite_meter(container, meter)
>>> abjad.show(container)

example-2.png
And here’s an example that customizes the structure of the first beat in a different way, and probably gets closer to what you’re looking for:

>>> meter = abjad.Meter("(4/4 ((1/4 (1/16 1/16 1/16 1/16)) 1/4 1/4 1/4))")
>>> print(meter.pretty_rtm_format)
(4/4 (
    (1/4 (
        1/16
        1/16
        1/16
        1/16))
    1/4
    1/4
    1/4))
>>> container = abjad.Container("c16 c8 c16 c2.")
>>> abjad.Meter.rewrite_meter(container, meter)
>>> abjad.show(container)

example-3.png
If that output looks right, you’ll probably want to structure each beat in the measure the same way. Using a multiline string is easiest:

meter = abjad.Meter(
    r"""(4/4 (
    (1/4 (
        1/16
        1/16
        1/16
        1/16))
    (1/4 (
        1/16
        1/16
        1/16
        1/16))
    (1/4 (
        1/16
        1/16
        1/16
        1/16))
    (1/4 (
        1/16
        1/16
        1/16
        1/16))))"""
)

Though I sometimes find it tricky to understand what abjad.Meter is doing, the default values usually give pretty good output. When you want to change things, try customizing the meter hierarchy, like the examples here. It might also work to play with the values of boundary_depth, which I haven’t shown here.

A few more examples are available in the docs:

https://abjad.github.io/api/abjad/meter.html#abjad.meter.Meter.rewrite_meter

Trevor.


--
You received this message because you are subscribed to the Google Groups "abjad-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to abjad-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/abjad-user/924e6a2e-360a-4dcb-bdc5-badf8a18a238n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages