Abjad / abjad

Abjad is a Python API for building LilyPond files. Use Abjad to make PDFs of music notation.
https://abjad.github.io
GNU General Public License v3.0
234 stars 41 forks source link

Do not remove note-head tweaks during score transposition #1577

Closed trevorbaca closed 4 months ago

trevorbaca commented 5 months ago

Here is a score that contains a chord with note-head tweaks; the LilyPond format is correct:

staff = abjad.Staff("<d'' fs''>8 e'4")
abjad.attach(abjad.Violin(), staff[0])
abjad.tweak(staff[0].note_heads[1], r"\tweak color #red")
abjad.tweak(staff[1].note_head, r"\tweak color #blue")
string = abjad.lilypond(staff)
print(string)
\new Staff
{
    <
        d''
        \tweak color #red
        fs''
    >8
    \tweak color #blue
    e'4
}

But abjad.iterpitches.transpose_from_sounding_pitch() removes note-head tweaks from chords:

abjad.iterpitches.transpose_from_sounding_pitch(staff)
string = abjad.lilypond(staff)
print(string)
\new Staff
{
    <d'' fs''>8
    \tweak color #blue
    e'4
}

This is a bug.

Teach abjad.iterpitches.transpose_from_sounding_pitch() to preserve note-head tweaks.

trevorbaca commented 5 months ago

Same situation with abjad.itertpitches.transpose_from_written_pitch().

trevorbaca commented 4 months ago

Fixed in Abjad 3.20.