Subject: abjad.Meter.rewrite() rewritting of chords tied to notes

2 views
Skip to first unread message

Davi Raubach

unread,
Apr 15, 2026, 4:59:36 AM (3 days ago) Apr 15
to abjad-user

Hi everyone,

I've encountered a bug in abjad.Meter.rewrite() specifically when a Chord is tied to a Note (or vice versa) and the meter grid forces a rhythmic split.

I have been facing similar issues when writing chords where only specific notes are tied (I am currently composing for pipe organ).

Abjad docs modified example:

import abjad

string = "| 2/4 c'2 ~ |"
string += "| 4/4 c'32 d'2.. ~ <d' f'>16 e'32 ~ |"
string += "| 2/4 e'2 |"
container = abjad.parsers.reduced.parse_reduced_ly_syntax(string)
staff = abjad.Staff()
staff[:] = container
print(abjad.lilypond(staff))
string = "(4/4 ((2/4 (1/4 1/4)) (2/4 (1/4 1/4))))"
rtc = abjad.rhythmtrees.parse(string)[0]
meter = abjad.Meter(rtc)
meter.rewrite(staff[1][:])
print(abjad.lilypond(staff))

Output:

\new Staff
{
    {
        %%% \time 2/4 %%%
        c'2
        ~
    }
    {
        %%% \time 4/4 %%%
        c'32
        d'2..
        ~
        <d' f'>16
        e'32
        ~
    }
    {
        %%% \time 2/4 %%%
        e'2
    }
}
\new Staff
{
    {
        %%% \time 2/4 %%%
        c'2
        ~
    }
    {
        %%% \time 4/4 %%%
        c'32
        d'4...
        ~
        d'4...
        e'32
        ~
    }
    {
        %%% \time 2/4 %%%
        e'2
    }
}

Expected output: 

\new Staff
{
    {
        \time 2/4 %%%
        c'2
        ~
    }
    {
        \time 4/4 %%%
        c'32
        d'4...
        ~

        d'4. ~
     d'32 ~
        <d' f'>16
     e'32
        ~
    }
    {
        \time 2/4 %%%
        e'2
    }
}


Is this a known limitation in how LogicalTie handles chords tied to single notes and vice-versa?

Best regards, 

Davi

Trevor Bača

unread,
Apr 15, 2026, 3:34:05 PM (3 days ago) Apr 15
to abjad...@googlegroups.com
Hi Davi,

I'm pretty sure this is a limitation in Abjad: I think Abjad assumes by default that all the notes or chords in a logical tie are "the same." That assumption probably doesn't cause any problem adding ties to notes or chords, but it doesn't surprise me that it breaks meter rewriting: presumably the entire duration of the logical tie is taken to be equal to the note which appears as the first element in the logical tie.

Hope you'll be able to find a workaround,

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 visit https://groups.google.com/d/msgid/abjad-user/3cac056b-14ad-46eb-8900-4af73c30bf34n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages