Skip to content

3.10

Compare
Choose a tag to compare
@trevorbaca trevorbaca released this 02 Jun 14:22
· 196 commits to main since this release
v3.10

Abjad 3.10 works with Python 3.10 and LilyPond 2.23.6 (and later).

#1460: Cleaned up instrument classes

Abjad 3.10 reimplements Abjad's instrument classes as frozen data classes, removes four properties from all instrument classes, and changes the name of one property.

REMOVED:

    * abjad.Instrument.markup
    * abjad.Instrument.name
    * abjad.Instrument.short_markup
    * abjad.Instrument.short_name

CHANGED:

    OLD: abjad.Instrument.allowable_clefs=("treble", "bass")
    NEW: abjad.Instrument.clefs==("treble", "bass")

This means that instrument classes are left with four basic properties:

 >>> abjad.Flute()
Flute(clefs=('treble',), context='Staff', middle_c_sounding_pitch=NamedPitch("c'"), pitch_range=PitchRange(range_string='[C4, D7]'))

Use abjad.InstrumentName and abjad.ShortInstrumentName to handle those properties independently.

#1459 : Cleaned up instrument name, short instrument name

LilyPond uses \instrumentName to print markup to the left of the first system of a score. It makes no sense to change \instrumentName after it is first set because the value of \instrumentName is printed only once.

LilyPond uses \shortInstrumentName to print markup to left the of nonfirst systems of a score. Changing \shortInstrumentName is necessary whenever instrument changes (for example, from flute to piccolo) should be reflected to the left of each system. (Whether, and how, scores use left-positioned directives to reflective instrument changes seems to vary over time, and by publisher.)

Abjad 3.9 (and earlier) implemented abjad.StartMarkup and abjad.MarginMarkup classes to handle these two types of markup. Abjad 3.10 replaces these with abjad.InstrumentName and abjad.ShortInstrumentName classes that match LilyPond's \instrumentName and \shortInstrumentName commands.

OLD: abjad.StartMarkup(markup=abjad.Markup(r"\markup Cello"))
NEW: abjad.InstrumentName(r"\markup Cello")

OLD: abjad.MarginMarkup(markup=abjad.Markup(r"\markup Vc."))
NEW: abjad.ShortInstrumentName(r"\markup Vc.")

#1457 Cleaned up abjad.Octave initializer

OLD. Octave objects are usually initialized by octave number. But the abjad.Octave initialzer allowed for undocumented initialization by tick string:

>>> abjad.Octave("'")
Octave(number=4)

NEW. Use the new abjad.Octave.from_ticks() constructor instead:

abjad.Octave.from_ticks("'")
Octave(number=4)