abjad.indicators
|
Arpeggio. |
Articulation. |
|
|
Bar line. |
|
LilyPond |
|
Fall or doit. |
Breath mark. |
|
|
Clef. |
|
Color fingering. |
|
Dynamic. |
|
Fermata. |
|
LilyPond |
|
LilyPond |
|
Key cluster. |
|
Key signature. |
Laissez vibrer. |
|
|
LilyPond literal. |
|
LilyPond markup. |
Metronome mark. |
|
|
Mode. |
|
LilyPond |
|
LilyPond |
|
Repeat. |
LilyPond |
|
|
LilyPond |
|
Staff change. |
LilyPond |
|
LilyPond |
|
|
Hairpin indicator. |
LilyPond |
|
|
LilyPond |
LilyPond |
|
|
LilyPond |
|
LilyPond |
|
Stem tremolo. |
|
LilyPond |
|
LilyPond |
|
LilyPond |
LilyPond |
|
|
LilyPond |
|
LilyPond |
|
LilyPond |
|
LilyPond |
|
LilyPond |
LilyPond |
|
|
Time signature. |
|
LilyPond |
- class abjad.indicators.Arpeggio(direction: Vertical | None = None)[source]
Arpeggio.
Without direction arrow:
>>> chord = abjad.Chord("<c' e' g' c''>4") >>> arpeggio = abjad.Arpeggio() >>> abjad.attach(arpeggio, chord) >>> staff = abjad.Staff([chord]) >>> abjad.show(staff)
With direction arrow:
>>> chord = abjad.Chord("<c' e' g' c''>4") >>> arpeggio = abjad.Arpeggio(direction=abjad.DOWN) >>> abjad.attach(arpeggio, chord) >>> staff = abjad.Staff([chord]) >>> abjad.show(staff)
Tweaks:
>>> chord = abjad.Chord("<c' e' g' c''>4") >>> arpeggio = abjad.Arpeggio() >>> bundle = abjad.bundle(arpeggio, r"- \tweak color #blue") >>> abjad.attach(bundle, chord) >>> staff = abjad.Staff([chord]) >>> abjad.show(staff)
- class abjad.indicators.Articulation(name: str)[source]
Articulation.
>>> abjad.Articulation("staccato") Articulation(name='staccato')
>>> abjad.Articulation(".") Articulation(name='.')
Use
direction=abjad.UP
like this:>>> note = abjad.Note("c'4") >>> articulation = abjad.Articulation("staccato") >>> abjad.attach(articulation, note, direction=abjad.UP) >>> abjad.show(note)
Use
direction=abjad.DOWN
like this:>>> note = abjad.Note("c'4") >>> articulation = abjad.Articulation("staccato") >>> abjad.attach(articulation, note, direction=abjad.DOWN) >>> abjad.show(note)
Use
dataclasses.replace()
like this:>>> import dataclasses >>> articulation = abjad.Articulation(".") >>> dataclasses.replace(articulation) Articulation(name='.')
- class abjad.indicators.BarLine(abbreviation: str = '|', site: str = 'after')[source]
Bar line.
Final bar line:
>>> staff = abjad.Staff("c'4 d'4 e'4 f'4", name="Staff") >>> score = abjad.Score([staff], name="Score") >>> bar_line = abjad.BarLine("|.") >>> abjad.attach(bar_line, staff[-1]) >>> abjad.show(staff)
Specify repeat bars like this; this allows you to bypass LilyPond’s
\volta
command:>>> staff = abjad.Staff("c'4 d' e' f' g' a' b' c''", name="Staff") >>> score = abjad.Score([staff], name="Score") >>> abjad.attach(abjad.BarLine(".|:"), staff[3]) >>> abjad.attach(abjad.BarLine(":|."), staff[-1]) >>> abjad.show(staff)
- class abjad.indicators.BeamCount(left: int = 0, right: int = 0)[source]
LilyPond
\setLeftBeamCount
,\setRightBeamCount
commands.>>> abjad.BeamCount() BeamCount(left=0, right=0)
- class abjad.indicators.BendAfter(bend_amount: int | float = -4)[source]
Fall or doit.
A fall:
>>> note = abjad.Note("c'4") >>> bend = abjad.BendAfter(-4) >>> abjad.attach(bend, note) >>> abjad.show(note)
A doit:
>>> note = abjad.Note("c'4") >>> bend = abjad.BendAfter(2) >>> abjad.attach(bend, note) >>> abjad.show(note)
Tweaks:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> bend_after = abjad.BendAfter(-4) >>> bundle = abjad.bundle(bend_after, r"- \tweak color #blue") >>> abjad.attach(bundle, staff[0]) >>> abjad.show(staff)
- class abjad.indicators.BreathMark[source]
Breath mark.
>>> voice = abjad.Voice("c'8 d' e' f' g' a' b' c''") >>> staff = abjad.Staff([voice]) >>> abjad.beam(voice[:4]) >>> abjad.beam(voice[4:]) >>> abjad.attach(abjad.BreathMark(), voice[3]) >>> abjad.attach(abjad.BreathMark(), voice[7]) >>> abjad.show(staff)
REGRESSION. Abjad parses LilyPond’s
\breathe
command correctly:>>> staff = abjad.Staff(r"c'4 d' e' f' \breathe") >>> abjad.show(staff)
Tweaks:
>>> note = abjad.Note("c'4") >>> breath = abjad.BreathMark() >>> bundle = abjad.bundle(breath, r"\tweak color #blue") >>> abjad.attach(bundle, note) >>> staff = abjad.Staff([note]) >>> abjad.show(staff)
- class abjad.indicators.Clef(name: str = 'treble', hide: bool = False)[source]
Clef.
Some available clefs:
>>> staff = abjad.Staff("c'8 d'8 e'8 f'8 g'8 a'8 b'8 c''8") >>> clef = abjad.Clef("treble") >>> abjad.attach(clef, staff[0]) >>> clef = abjad.Clef("alto") >>> abjad.attach(clef, staff[1]) >>> clef = abjad.Clef("bass") >>> abjad.attach(clef, staff[2]) >>> clef = abjad.Clef("treble^8") >>> abjad.attach(clef, staff[3]) >>> clef = abjad.Clef("bass_8") >>> abjad.attach(clef, staff[4]) >>> clef = abjad.Clef("tenor") >>> abjad.attach(clef, staff[5]) >>> clef = abjad.Clef("bass^15") >>> abjad.attach(clef, staff[6]) >>> clef = abjad.Clef("percussion") >>> abjad.attach(clef, staff[7]) >>> abjad.show(staff)
Clefs can be tagged:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> abjad.attach(abjad.Clef("treble"), staff[0], tag=abjad.Tag("+PARTS")) >>> abjad.show(staff)
>>> string = abjad.lilypond(staff, tags=True) >>> print(string) \new Staff { %! +PARTS \clef "treble" c'4 d'4 e'4 f'4 }
LilyPond can not handle simultaneous clefs:
>>> voice_1 = abjad.Voice("e'8 g' f' a' g' b'") >>> voice_2 = abjad.Voice("c'4. c,8 b,, a,,") >>> staff = abjad.Staff([voice_1, voice_2], simultaneous=True) >>> abjad.attach(abjad.Clef("treble"), voice_1[0], context="Voice") >>> command = abjad.VoiceNumber(1) >>> abjad.attach(command, voice_1[0]) >>> voice_1.consists_commands.append("Clef_engraver") >>> abjad.attach(abjad.Clef("treble"), voice_2[0], context="Voice") >>> abjad.attach(abjad.Clef("bass"), voice_2[1], context="Voice") >>> command = abjad.VoiceNumber(2) >>> abjad.attach(command, voice_2[0]) >>> voice_2.consists_commands.append("Clef_engraver") >>> staff.remove_commands.append("Clef_engraver") >>> abjad.show(staff)
But Abjad components work fine:
>>> for leaf in abjad.select.leaves(voice_1): ... leaf, abjad.get.effective(leaf, abjad.Clef) ... (Note("e'8"), Clef(name='treble', hide=False)) (Note("g'8"), Clef(name='treble', hide=False)) (Note("f'8"), Clef(name='treble', hide=False)) (Note("a'8"), Clef(name='treble', hide=False)) (Note("g'8"), Clef(name='treble', hide=False)) (Note("b'8"), Clef(name='treble', hide=False))
>>> for leaf in abjad.select.leaves(voice_2): ... leaf, abjad.get.effective(leaf, abjad.Clef) ... (Note("c'4."), Clef(name='treble', hide=False)) (Note('c,8'), Clef(name='bass', hide=False)) (Note('b,,8'), Clef(name='bass', hide=False)) (Note('a,,8'), Clef(name='bass', hide=False))
Middle-C position:
>>> abjad.Clef("treble").middle_c_position() StaffPosition(number=-6)
>>> abjad.Clef("alto").middle_c_position() StaffPosition(number=0)
Set
hide=True
when clef should not appear in output (but should still determine effective clef).>>> staff = abjad.Staff("c'4 d' e' f'") >>> abjad.attach(abjad.Clef("treble"), staff[0]) >>> abjad.attach(abjad.Clef("alto", hide=True), staff[2]) >>> abjad.show(staff)
>>> string = abjad.lilypond(staff) >>> print(string) \new Staff { \clef "treble" c'4 d'4 e'4 f'4 }
>>> for leaf in abjad.iterate.leaves(staff): ... leaf, abjad.get.effective(leaf, abjad.Clef) ... (Note("c'4"), Clef(name='treble', hide=False)) (Note("d'4"), Clef(name='treble', hide=False)) (Note("e'4"), Clef(name='alto', hide=True)) (Note("f'4"), Clef(name='alto', hide=True))
Gets middle C position.
to_pitch
(staff_position)Changes
staff_position
to pitch.to_staff_position
(pitch)Changes
pitch
to staff position.- to_pitch(staff_position) NamedPitch [source]
Changes
staff_position
to pitch.Treble clef:
>>> clef = abjad.Clef("treble") >>> for n in range(-6, 6): ... staff_position = abjad.StaffPosition(n) ... pitch = clef.to_pitch(staff_position) ... print(f"{staff_position!r:25}{pitch!r}") ... StaffPosition(number=-6) NamedPitch("c'") StaffPosition(number=-5) NamedPitch("d'") StaffPosition(number=-4) NamedPitch("e'") StaffPosition(number=-3) NamedPitch("f'") StaffPosition(number=-2) NamedPitch("g'") StaffPosition(number=-1) NamedPitch("a'") StaffPosition(number=0) NamedPitch("b'") StaffPosition(number=1) NamedPitch("c''") StaffPosition(number=2) NamedPitch("d''") StaffPosition(number=3) NamedPitch("e''") StaffPosition(number=4) NamedPitch("f''") StaffPosition(number=5) NamedPitch("g''")
Bass clef:
>>> clef = abjad.Clef("bass") >>> for n in range(-6, 6): ... staff_position = abjad.StaffPosition(n) ... pitch = clef.to_pitch(staff_position) ... print(f"{staff_position!r:25}{pitch!r}") ... StaffPosition(number=-6) NamedPitch('e,') StaffPosition(number=-5) NamedPitch('f,') StaffPosition(number=-4) NamedPitch('g,') StaffPosition(number=-3) NamedPitch('a,') StaffPosition(number=-2) NamedPitch('b,') StaffPosition(number=-1) NamedPitch('c') StaffPosition(number=0) NamedPitch('d') StaffPosition(number=1) NamedPitch('e') StaffPosition(number=2) NamedPitch('f') StaffPosition(number=3) NamedPitch('g') StaffPosition(number=4) NamedPitch('a') StaffPosition(number=5) NamedPitch('b')
Alto clef:
>>> clef = abjad.Clef("alto") >>> for n in range(-6, 6): ... staff_position = abjad.StaffPosition(n) ... pitch = clef.to_pitch(staff_position) ... print(f"{staff_position!r:25}{pitch!r}") ... StaffPosition(number=-6) NamedPitch('d') StaffPosition(number=-5) NamedPitch('e') StaffPosition(number=-4) NamedPitch('f') StaffPosition(number=-3) NamedPitch('g') StaffPosition(number=-2) NamedPitch('a') StaffPosition(number=-1) NamedPitch('b') StaffPosition(number=0) NamedPitch("c'") StaffPosition(number=1) NamedPitch("d'") StaffPosition(number=2) NamedPitch("e'") StaffPosition(number=3) NamedPitch("f'") StaffPosition(number=4) NamedPitch("g'") StaffPosition(number=5) NamedPitch("a'")
Percussion clef:
>>> clef = abjad.Clef("percussion") >>> for n in range(-6, 6): ... staff_position = abjad.StaffPosition(n) ... pitch = clef.to_pitch(staff_position) ... print(f"{staff_position!r:25}{pitch!r}") ... StaffPosition(number=-6) NamedPitch('d') StaffPosition(number=-5) NamedPitch('e') StaffPosition(number=-4) NamedPitch('f') StaffPosition(number=-3) NamedPitch('g') StaffPosition(number=-2) NamedPitch('a') StaffPosition(number=-1) NamedPitch('b') StaffPosition(number=0) NamedPitch("c'") StaffPosition(number=1) NamedPitch("d'") StaffPosition(number=2) NamedPitch("e'") StaffPosition(number=3) NamedPitch("f'") StaffPosition(number=4) NamedPitch("g'") StaffPosition(number=5) NamedPitch("a'")
- to_staff_position(pitch) StaffPosition [source]
Changes
pitch
to staff position.Changes C#5 to absolute staff position:
>>> pitch = abjad.NamedPitch("C#5")
>>> abjad.Clef("alto").to_staff_position(pitch) StaffPosition(number=7)
>>> abjad.Clef("treble").to_staff_position(pitch) StaffPosition(number=1)
>>> abjad.Clef("bass").to_staff_position(pitch) StaffPosition(number=13)
Labels absolute staff position:
>>> string = "g16 a b c' d' e' f' g' a' b' c'' d'' e'' f'' g'' a''" >>> staff = abjad.Staff(string) >>> clef = abjad.Clef("alto") >>> for note in staff: ... staff_position = clef.to_staff_position(note.written_pitch) ... markup = abjad.Markup(rf"\markup {staff_position.number}") ... abjad.attach(markup, note) ... >>> abjad.override(staff).TextScript.staff_padding = 5 >>> abjad.show(staff)
Labels staff position in bass clef:
>>> string = "g,16 a, b, c d e f g a b c' d' e' f' g' a'" >>> staff = abjad.Staff(string) >>> clef = abjad.Clef("bass") >>> for note in staff: ... staff_position = clef.to_staff_position(note.written_pitch) ... markup = abjad.Markup(rf"\markup {staff_position.number}") ... abjad.attach(markup, note) ... >>> abjad.attach(abjad.Clef("bass"), staff[0]) >>> abjad.override(staff).TextScript.staff_padding = 5 >>> abjad.show(staff)
- class abjad.indicators.ColorFingering(number: int)[source]
Color fingering.
Color fingerings indicate alternate woodwind fingerings by amount of pitch of timbre deviation:
>>> fingering = abjad.ColorFingering(1) >>> note = abjad.Note("c'4") >>> abjad.attach(fingering, note, direction=abjad.UP)
>>> abjad.show(note)
Tweaks:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> fingering = abjad.ColorFingering(1) >>> bundle = abjad.bundle(fingering, r"- \tweak color #blue") >>> abjad.attach(bundle, staff[0], direction=abjad.UP) >>> abjad.show(staff)
Gets markup of color fingering.
- markup
Gets markup of color fingering.
>>> fingering = abjad.ColorFingering(1) >>> string = abjad.lilypond(fingering.markup) >>> print(string) \markup { \override #'(circle-padding . 0.25) \circle \finger 1 }
- class abjad.indicators.Dynamic(name: str = 'f', command: str | None = None, hide: bool = False, leak: bool = False, name_is_textual: bool = False, ordinal: int | Infinity | NegativeInfinity | None = None)[source]
Dynamic.
>>> voice = abjad.Voice("c'8 d'8 e'8 f'8") >>> dynamic = abjad.Dynamic("f") >>> abjad.attach(dynamic, voice[0])
>>> abjad.show(voice)
Simultaneous dynamics in a single staff:
>>> voice_1 = abjad.Voice("e'8 g'8 f'8 a'8") >>> abjad.attach(abjad.Dynamic("f"), voice_1[0], context="Voice") >>> command = abjad.VoiceNumber(1) >>> abjad.attach(command, voice_1[0]) >>> abjad.override(voice_1).DynamicLineSpanner.direction = abjad.UP >>> voice_2 = abjad.Voice("c'2") >>> command = abjad.VoiceNumber(2) >>> abjad.attach(command, voice_2[0]) >>> abjad.attach(abjad.Dynamic("mf"), voice_2[0], context="Voice") >>> staff = abjad.Staff([voice_1, voice_2], simultaneous=True) >>> abjad.show(staff)
>>> for leaf in abjad.select.leaves(staff): ... dynamic = abjad.get.effective(leaf, abjad.Dynamic) ... print(f"{leaf!r}:") ... print(f" {dynamic!r}") ... Note("e'8"): Dynamic(name='f', command=None, hide=False, leak=False, name_is_textual=False, ordinal=None) Note("g'8"): Dynamic(name='f', command=None, hide=False, leak=False, name_is_textual=False, ordinal=None) Note("f'8"): Dynamic(name='f', command=None, hide=False, leak=False, name_is_textual=False, ordinal=None) Note("a'8"): Dynamic(name='f', command=None, hide=False, leak=False, name_is_textual=False, ordinal=None) Note("c'2"): Dynamic(name='mf', command=None, hide=False, leak=False, name_is_textual=False, ordinal=None)
Errors on nondynamic input:
>>> abjad.Dynamic("text") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<string>", line 9, in __init__ File "/Users/trevor/Repositories/Projects/abjad/source/abjad/indicators.py", line 1740, in __post_init__ raise Exception(message) Exception: letter 't' (in 'text') is not a dynamic.
Tweaks:
>>> voice = abjad.Voice("c'4") >>> dynamic = abjad.Dynamic("f") >>> bundle = abjad.bundle(dynamic, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> abjad.show(voice)
Use
command
like this; use to override LilyPond output when a custom dynamic has been defined in an external stylesheet. (In the example above,\sub_f
is a nonstandard LilyPond dynamic. LilyPond will interpret the output above only when the command\sub_f
is defined somewhere in an external stylesheet.)>>> abjad.Dynamic("f", command=r"\sub_f").command '\\sub_f'
With
direction
unset:>>> voice = abjad.Voice("c'2 c''2") >>> abjad.attach(abjad.Dynamic("p"), voice[0]) >>> abjad.attach(abjad.Dynamic("f"), voice[1]) >>> abjad.show(voice)
With
direction=abjad.UP
:>>> voice = abjad.Voice("c'2 c''2") >>> abjad.attach(abjad.Dynamic("p"), voice[0], direction=abjad.UP) >>> abjad.attach(abjad.Dynamic("f"), voice[1], direction=abjad.UP) >>> abjad.show(voice)
With
direction=abjad.DOWN
:>>> voice = abjad.Voice("c'2 c''2") >>> abjad.attach(abjad.Dynamic("p"), voice[0], direction=abjad.DOWN) >>> abjad.attach(abjad.Dynamic("f"), voice[1], direction=abjad.DOWN) >>> abjad.show(voice)
REGRESSION. Effort dynamics default to down:
>>> voice = abjad.Voice("c'2 c''2") >>> abjad.attach(abjad.Dynamic('"p"'), voice[0]) >>> abjad.attach(abjad.Dynamic('"f"'), voice[1]) >>> abjad.show(voice)
And may be overriden:
>>> voice = abjad.Voice("c'2 c''2") >>> abjad.attach(abjad.Dynamic('"p"'), voice[0], direction=abjad.UP) >>> abjad.attach(abjad.Dynamic('"f"'), voice[1], direction=abjad.UP) >>> abjad.show(voice)
Set
hide=True
when dynamic should not appear in output (but should still determine effective dynamic):>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("f"), voice[0]) >>> abjad.attach(abjad.Dynamic("mf", hide=True), voice[2]) >>> abjad.show(voice)
>>> string = abjad.lilypond(voice) >>> print(string) \new Voice { c'4 \f d'4 e'4 f'4 }
>>> for leaf in abjad.iterate.leaves(voice): ... dynamic = abjad.get.effective(leaf, abjad.Dynamic) ... print(f"{leaf!r}:") ... print(f" {dynamic!r}") ... Note("c'4"): Dynamic(name='f', command=None, hide=False, leak=False, name_is_textual=False, ordinal=None) Note("d'4"): Dynamic(name='f', command=None, hide=False, leak=False, name_is_textual=False, ordinal=None) Note("e'4"): Dynamic(name='mf', command=None, hide=True, leak=False, name_is_textual=False, ordinal=None) Note("f'4"): Dynamic(name='mf', command=None, hide=True, leak=False, name_is_textual=False, ordinal=None)
Set
leak=True
Is true to format LilyPond empty chord<>
symbol:Without leaked stop dynamic:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_dynamic = abjad.Dynamic("mf") >>> start_hairpin = abjad.StartHairpin(">") >>> stop_dynamic = abjad.Dynamic("pp") >>> abjad.attach(start_dynamic, voice[0]) >>> abjad.attach(start_hairpin, voice[0]) >>> abjad.attach(stop_dynamic, voice[-2]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4 >>> abjad.show(voice)
With leaked stop dynamic:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_dynamic = abjad.Dynamic("mf") >>> start_hairpin = abjad.StartHairpin(">") >>> stop_dynamic = abjad.Dynamic("pp", leak=True) >>> abjad.attach(start_dynamic, voice[0]) >>> abjad.attach(start_hairpin, voice[0]) >>> abjad.attach(stop_dynamic, voice[-2]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4 >>> abjad.show(voice)
Leaks format after spanners:
>>> voice = abjad.Voice("c'8 [ d' e' ] f'") >>> start_dynamic = abjad.Dynamic("mf") >>> start_hairpin = abjad.StartHairpin(">") >>> stop_dynamic = abjad.Dynamic("pp", leak=True) >>> abjad.attach(start_dynamic, voice[0]) >>> abjad.attach(start_hairpin, voice[0]) >>> abjad.attach(stop_dynamic, voice[-2]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4 >>> abjad.show(voice)
Leaked and nonleaked dynamic may be attached to the same leaf:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("f"), voice[0]) >>> abjad.attach(abjad.Dynamic("p", leak=True), voice[0]) >>> abjad.show(voice)
Leaks and tweaks on the same dynamic format correctly; LilyPond empty chord
<>
symbol appears before postevents:>>> voice = abjad.Voice("r4 d' e' f'") >>> dynamic = abjad.Dynamic("f", leak=True) >>> bundle = abjad.bundle(dynamic, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> abjad.show(voice)
>>> string = abjad.lilypond(voice) >>> print(string) \new Voice { r4 <> - \tweak color #blue \f d'4 e'4 f'4 }
Leak survives copy:
>>> import copy >>> dynamic = abjad.Dynamic("pp", leak=True) >>> copy.copy(dynamic) Dynamic(name='pp', command=None, hide=False, leak=True, name_is_textual=False, ordinal=None)
Name-is-textual:
>>> abjad.Dynamic("f").name_is_textual False
>>> dynamic = abjad.Dynamic("appena udibile", name_is_textual=True) >>> dynamic.name_is_textual True
Textual dynamics format like this when initialized without an explicit command:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> dynamic = abjad.Dynamic("appena udibile", name_is_textual=True) >>> abjad.attach(dynamic, voice[0]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4 >>> abjad.override(voice).DynamicText.X_extent = "#'(0 . 0)" >>> abjad.override(voice).DynamicText.self_alignment_X = abjad.LEFT >>> abjad.show(voice)
Textual dynamics format like this when initialized with an explicit command:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> dynamic = abjad.Dynamic( ... "appena udibile", ... command=r"\appena_udibile", ... name_is_textual=True, ... ) >>> abjad.attach(dynamic, voice[0])
Only LilyPond output is shown here because dynamic commands (like
\appena_udibile
shown here) are meant to be user-defined (and not included in Abjad):>>> string = abjad.lilypond(voice) >>> print(string) \new Voice { c'4 \appena_udibile d'4 e'4 f'4 }
REGRESSION. Textual names work with replace:
>>> import dataclasses >>> dynamic = abjad.Dynamic("appena udibile", name_is_textual=True) >>> dataclasses.replace(dynamic) Dynamic(name='appena udibile', command=None, hide=False, leak=False, name_is_textual=True, ordinal=None)
Gets ordinal.
Is true when double quotes enclose dynamic.
Is true when dynamic name begins in s- and ends in -z.
- get_ordinal() int | Infinity | NegativeInfinity | None [source]
Gets ordinal.
>>> abjad.Dynamic("f").get_ordinal() 2
>>> abjad.Dynamic("p").get_ordinal() -2
>>> abjad.Dynamic('"f"').get_ordinal() 2
>>> abjad.Dynamic('"p"').get_ordinal() -2
User-defined ordinals:
>>> barely_audible = abjad.Dynamic( ... "barely audible", ... name_is_textual=True, ... ordinal=-99, ... ) >>> barely_audible.get_ordinal() -99
>>> extremely_loud = abjad.Dynamic( ... "extremely loud", ... name_is_textual=True, ... ordinal=99, ... ) >>> extremely_loud.get_ordinal() 99
REGRESSION. Textual names without explicit ordinal return none:
>>> dynamic = abjad.Dynamic("appena udibile", name_is_textual=True) >>> dynamic.get_ordinal() is None True
- is_effort() bool [source]
Is true when double quotes enclose dynamic.
>>> voice = abjad.Voice("c'4 r d' r e' r f' r") >>> abjad.attach(abjad.Dynamic('"pp"'), voice[0]) >>> abjad.attach(abjad.Dynamic('"mp"'), voice[2]) >>> abjad.attach(abjad.Dynamic('"mf"'), voice[4]) >>> abjad.attach(abjad.Dynamic('"ff"'), voice[6]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4 >>> abjad.show(voice)
>>> voice = abjad.Voice("c'4 r d' r e' r f' r") >>> abjad.attach(abjad.Dynamic('"sf"'), voice[0]) >>> abjad.attach(abjad.Dynamic('"sfz"'), voice[2]) >>> abjad.attach(abjad.Dynamic('"rf"'), voice[4]) >>> abjad.attach(abjad.Dynamic('"rfz"'), voice[6]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4 >>> abjad.show(voice)
- is_sforzando() bool [source]
Is true when dynamic name begins in s- and ends in -z.
>>> abjad.Dynamic("f").is_sforzando() False
>>> abjad.Dynamic("sfz").is_sforzando() True
>>> abjad.Dynamic("sffz").is_sforzando() True
>>> abjad.Dynamic("sfp").is_sforzando() False
>>> abjad.Dynamic("sf").is_sforzando() False
>>> abjad.Dynamic("rfz").is_sforzando() False
- class abjad.indicators.Fermata(command: str = 'fermata')[source]
Fermata.
A short fermata:
>>> score = abjad.Score([abjad.Staff([abjad.Note("c'4")])]) >>> fermata = abjad.Fermata(command="shortfermata") >>> abjad.attach(fermata, score[0][0]) >>> abjad.show(score)
A fermata:
>>> score = abjad.Score([abjad.Staff([abjad.Note("c'4")])]) >>> fermata = abjad.Fermata() >>> abjad.attach(fermata, score[0][0]) >>> abjad.show(score)
A long fermata:
>>> score = abjad.Score([abjad.Staff([abjad.Note("c'4")])]) >>> fermata = abjad.Fermata("longfermata") >>> abjad.attach(fermata, score[0][0]) >>> abjad.show(score)
A very long fermata:
>>> score = abjad.Score([abjad.Staff([abjad.Note("c'4")])]) >>> fermata = abjad.Fermata("verylongfermata") >>> abjad.attach(fermata, score[0][0]) >>> abjad.show(score)
Tweaks:
>>> note = abjad.Note("c'4") >>> staff = abjad.Staff([note], name="Staff") >>> score = abjad.Score([staff], name="Score") >>> fermata = abjad.Fermata() >>> bundle = abjad.bundle(fermata, r"- \tweak color #blue") >>> abjad.attach(bundle, note) >>> abjad.show(score)
- class abjad.indicators.Glissando(zero_padding: bool = False)[source]
LilyPond
\glissando
command.>>> voice = abjad.Voice("c'4 d' e' f'", name="Voice") >>> glissando = abjad.Glissando() >>> bundle = abjad.bundle(glissando, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> abjad.show(voice)
- class abjad.indicators.InstrumentName(markup: str | Markup, *, context: str = 'Staff')[source]
LilyPond
\instrumentName
setting.>>> staff = abjad.Staff("c'4 d'4 e'4 f'4") >>> markup = abjad.Markup(r"\markup Cellos") >>> instrument_name = abjad.InstrumentName(markup) >>> abjad.attach(instrument_name, staff[0]) >>> abjad.show(staff)
Set instrument name to custom-defined function like this:
>>> staff = abjad.Staff("c'4 d'4 e'4 f'4") >>> instrument_name = abjad.InstrumentName(r"\my_instrument_name") >>> abjad.attach(instrument_name, staff[0])
>>> string = abjad.lilypond(staff) >>> print(string) \new Staff { \set Staff.instrumentName = \my_instrument_name c'4 d'4 e'4 f'4 }
Equality testing:
>>> name_1 = abjad.InstrumentName(r"\markup Harp", context="PianoStaff") >>> name_2 = abjad.InstrumentName(r"\markup Harp", context="PianoStaff") >>> name_3 = abjad.InstrumentName(r"\markup Harp", context="Staff")
>>> name_1 == name_1 True
>>> name_1 == name_2 True
>>> name_1 == name_3 False
>>> name_2 == name_1 True
>>> name_2 == name_2 True
>>> name_2 == name_3 False
>>> name_3 == name_1 False
>>> name_3 == name_2 False
>>> name_3 == name_3 True
- class abjad.indicators.KeyCluster(hide_flat_markup: bool = False, hide_natural_markup: bool = False)[source]
Key cluster.
Includes flat markup:
>>> chord = abjad.Chord("<c' e' g' b' d'' f''>8") >>> key_cluster = abjad.KeyCluster() >>> abjad.attach(key_cluster, chord, direction=abjad.UP) >>> staff = abjad.Staff([chord]) >>> abjad.show(staff)
Includes natural markup:
>>> chord = abjad.Chord("<c' e' g' b' d'' f''>8") >>> key_cluster = abjad.KeyCluster() >>> abjad.attach(key_cluster, chord, direction=abjad.UP) >>> staff = abjad.Staff([chord]) >>> abjad.show(staff)
Key cluster output includes overrides instead of tweaks. The reason for this is that chords contain multiple note-heads: if key cluster formatted tweaks instead of overrides, the five format commands shown above would need to be duplicated immediately before each note-head:
>>> chord = abjad.Chord("<c' e' g' b' d'' f''>8") >>> key_cluster = abjad.KeyCluster() >>> abjad.attach(key_cluster, chord, direction=abjad.UP) >>> string = abjad.lilypond(chord) >>> print(string) \once \override Accidental.stencil = ##f \once \override AccidentalCautionary.stencil = ##f \once \override Arpeggio.X-offset = #-2 \once \override NoteHead.stencil = #ly:text-interface::print \once \override NoteHead.text = \markup \filled-box #'(-0.6 . 0.6) #'(-0.7 . 0.7) #0.25 <c' e' g' b' d'' f''>8 ^ \markup \center-column { \natural \flat }
- class abjad.indicators.KeySignature(tonic: NamedPitchClass = NamedPitchClass('c'), mode: Mode = Mode(name='major'))[source]
Key signature.
>>> staff = abjad.Staff("e'8 fs'8 gs'8 a'8") >>> key_signature = abjad.KeySignature( ... abjad.NamedPitchClass("e"), abjad.Mode("major") ... ) >>> abjad.attach(key_signature, staff[0]) >>> abjad.show(staff)
>>> staff = abjad.Staff("e'8 fs'8 g'8 a'8") >>> key_signature = abjad.KeySignature( ... abjad.NamedPitchClass("e"), abjad.Mode("minor") ... ) >>> abjad.attach(key_signature, staff[0]) >>> abjad.show(staff)
Tweaks:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> key_signature = abjad.KeySignature( ... abjad.NamedPitchClass("e"), abjad.Mode("minor") ... ) >>> bundle = abjad.bundle(key_signature, r"\tweak color #blue") >>> abjad.attach(bundle, staff[0]) >>> abjad.show(staff)
Gets name of key signature.
- name
Gets name of key signature.
>>> abjad.KeySignature(abjad.NamedPitchClass("e"), abjad.Mode("major")).name 'E major'
>>> abjad.KeySignature(abjad.NamedPitchClass("e"), abjad.Mode("minor")).name 'e minor'
- class abjad.indicators.LaissezVibrer[source]
Laissez vibrer.
>>> chord = abjad.Chord("<c' e' g' c''>4") >>> laissez_vibrer = abjad.LaissezVibrer() >>> abjad.attach(laissez_vibrer, chord) >>> abjad.show(chord)
Tweaks:
>>> note = abjad.Note("c'4") >>> lv = abjad.LaissezVibrer() >>> bundle = abjad.bundle(lv, r"- \tweak color #blue") >>> abjad.attach(bundle, note) >>> abjad.show(note)
- class abjad.indicators.LilyPondLiteral(argument: str | list[str] = '', *, site: str = 'before', directed: bool = False)[source]
LilyPond literal.
Dotted slur:
>>> voice = abjad.Voice("c'8 d'8 e'8 f'8") >>> abjad.slur(voice[:]) >>> literal = abjad.LilyPondLiteral(r"\slurDotted", site="before") >>> abjad.attach(literal, voice[0]) >>> abjad.show(voice)
Use the
"absolute_before"
and"absolute_after"
format sites like this:>>> voice = abjad.Voice("c'8 d'8 e'8 f'8") >>> abjad.slur(voice[:]) >>> literal = abjad.LilyPondLiteral(r"\slurDotted", site="before") >>> abjad.attach(literal, voice[0]) >>> literal = abjad.LilyPondLiteral("", site="absolute_before") >>> abjad.attach(literal, voice[0]) >>> literal = abjad.LilyPondLiteral( ... "% before all formatting", ... site="absolute_before", ... ) >>> abjad.attach(literal, voice[0]) >>> literal = abjad.LilyPondLiteral("", site="absolute_after") >>> abjad.attach(literal, voice[-1]) >>> abjad.show(voice)
LilyPond literals can be tagged:
>>> voice = abjad.Voice("c'8 d'8 e'8 f'8") >>> abjad.slur(voice[:]) >>> literal = abjad.LilyPondLiteral(r"\slurDotted", site="before") >>> abjad.attach(literal, voice[0], tag=abjad.Tag("+PARTS")) >>> abjad.show(voice)
>>> string = abjad.lilypond(voice, tags=True) >>> print(string) \new Voice { %! +PARTS \slurDotted c'8 ( d'8 e'8 f'8 ) }
Multiline input is allowed:
>>> voice = abjad.Voice("c'8 d'8 e'8 f'8") >>> abjad.slur(voice[:]) >>> lines = [ ... r"\stopStaff", ... r"\startStaff", ... r"\once \override Staff.StaffSymbol.color = #red", ... ] >>> literal = abjad.LilyPondLiteral(lines, site="before") >>> abjad.attach(literal, voice[2], tag=abjad.Tag("+PARTS")) >>> abjad.show(voice)
>>> string = abjad.lilypond(voice, tags=True) >>> print(string) \new Voice { c'8 ( d'8 %! +PARTS \stopStaff %! +PARTS \startStaff %! +PARTS \once \override Staff.StaffSymbol.color = #red e'8 f'8 ) }
REGRESSION. Duplicate literals are allowed:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> literal = abjad.LilyPondLiteral("% text", site="before") >>> abjad.attach(literal, staff[0]) >>> literal = abjad.LilyPondLiteral("% text", site="before") >>> abjad.attach(literal, staff[0])
>>> string = abjad.lilypond(staff) >>> print(string) \new Staff { % text % text c'4 d'4 e'4 f'4 }
Directed literal:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> literal = abjad.LilyPondLiteral(r"\f", directed=True, site="after") >>> bundle = abjad.bundle( ... literal, ... r"- \tweak color #blue", ... r"- \tweak DynamicLineSpanner.staff-padding 5", ... ) >>> abjad.attach(bundle, staff[0]) >>> abjad.show(staff)
Nondirected literal. Proper use of the
directed
property entails searching the LilyPond docs to understand whether LilyPond treats any particular command as directed or not. Most LilyPond commands are directed. LilyPond insists that a few commands (include\breathe
,\key
,\mark
) must not be directed:>>> staff = abjad.Staff("c'4 d' e' f'") >>> literal = abjad.LilyPondLiteral( ... r"\breathe", ... directed=False, ... site="after", ... ) >>> bundle = abjad.bundle(literal, r"\tweak color #blue") >>> abjad.attach(bundle, staff[0]) >>> abjad.show(staff)
Tweaks:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> literal = abjad.LilyPondLiteral(r"\f", directed=True, site="after") >>> bundle = abjad.bundle(literal, r"- \tweak color #blue") >>> abjad.attach(bundle, staff[0]) >>> abjad.show(staff)
Is true when literal is directed.
- post_event
Is true when literal is directed.
- class abjad.indicators.Markup(string: str)[source]
LilyPond markup.
>>> staff = abjad.Staff("c'8 d'8 e'8 f'8") >>> markup = abjad.Markup(r'\markup \italic "Allegro assai"') >>> abjad.attach(markup, staff[0], direction=abjad.UP) >>> abjad.show(staff)
Tweaks:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> markup = abjad.Markup(r'\markup \bold "Allegro assai"') >>> bundle = abjad.bundle(markup, r"- \tweak color #blue") >>> abjad.attach(bundle, staff[0], direction=abjad.UP) >>> abjad.show(staff)
Markup can be tagged:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> markup = abjad.Markup(r"\markup \italic Allegro") >>> abjad.attach(markup, staff[0], direction=abjad.UP, tag=abjad.Tag("RED:M1")) >>> abjad.show(staff)
>>> string = abjad.lilypond(staff, tags=True) >>> print(string) \new Staff { c'4 %! M1 %! RED ^ \markup \italic Allegro d'4 e'4 f'4 }
Tagged markup can be deactivated:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> markup = abjad.Markup(r"\markup \italic Allegro") >>> abjad.attach( ... markup, ... staff[0], ... deactivate=True, ... direction=abjad.UP, ... tag=abjad.Tag("RED:M1"), ... ) >>> abjad.show(staff)
>>> string = abjad.lilypond(staff, tags=True) >>> print(string) \new Staff { c'4 %! M1 %! RED %@% ^ \markup \italic Allegro d'4 e'4 f'4 }
REGRESSION: markup 1 doesn’t disappear after markup 2 is attached:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> markup_1 = abjad.Markup(r"\markup \italic Allegro") >>> markup_2 = abjad.Markup(r'\markup \italic "non troppo"') >>> abjad.attach(markup_1, staff[0], direction=abjad.UP) >>> abjad.attach(markup_2, staff[0], direction=abjad.UP) >>> abjad.show(staff)
- class abjad.indicators.MetronomeMark(reference_duration: Duration | None = None, units_per_minute: int | Fraction | None = None, textual_indication: str | None = None, custom_markup: Markup | None = None, decimal: bool | str = False, hide: bool = False)[source]
Metronome mark.
Initializes integer-valued metronome mark:
>>> score = abjad.Score() >>> staff = abjad.Staff("c'8 d'8 e'8 f'8") >>> score.append(staff) >>> mark = abjad.MetronomeMark(abjad.Duration(1, 4), 90) >>> abjad.attach(mark, staff[0]) >>> abjad.show(score)
Initializes rational-valued metronome mark:
>>> import fractions >>> score = abjad.Score() >>> staff = abjad.Staff("c'8 d'8 e'8 f'8") >>> score.append(staff) >>> mark = abjad.MetronomeMark(abjad.Duration(1, 4), fractions.Fraction(272, 3)) >>> abjad.attach(mark, staff[0]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', score]) >>> abjad.show(lilypond_file)
Overrides rational-valued metronome mark with decimal string:
>>> score = abjad.Score() >>> staff = abjad.Staff("c'8 d'8 e'8 f'8") >>> score.append(staff) >>> mark = abjad.MetronomeMark( ... abjad.Duration(1, 4), ... fractions.Fraction(272, 3), ... decimal="90.66", ... ) >>> abjad.attach(mark, staff[0]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', score]) >>> abjad.show(lilypond_file)
Overrides rational-valued metronome mark with exact decimal:
>>> score = abjad.Score() >>> staff = abjad.Staff("c'8 d'8 e'8 f'8") >>> score.append(staff) >>> mark = abjad.MetronomeMark( ... abjad.Duration(1, 4), ... fractions.Fraction(901, 10), ... decimal=True, ... ) >>> abjad.attach(mark, staff[0]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', score]) >>> abjad.show(lilypond_file)
Initializes from text, duration and range:
>>> score = abjad.Score() >>> staff = abjad.Staff("c'8 d'8 e'8 f'8") >>> score.append(staff) >>> mark = abjad.MetronomeMark(abjad.Duration(1, 4), (120, 133), "Quick") >>> abjad.attach(mark, staff[0]) >>> abjad.show(score)
Custom markup:
>>> import fractions >>> markup = abjad.MetronomeMark.make_tempo_equation_markup( ... abjad.Duration(1, 4), ... 67.5, ... ) >>> mark = abjad.MetronomeMark( ... reference_duration=abjad.Duration(1, 4), ... units_per_minute=fractions.Fraction(135, 2), ... custom_markup=markup, ... ) >>> staff = abjad.Staff("c'4 d'4 e'4 f'4") >>> score = abjad.Score([staff]) >>> abjad.attach(mark, staff[0]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', score]) >>> abjad.show(lilypond_file)
Decimal overrides:
>>> import fractions >>> mark = abjad.MetronomeMark(abjad.Duration(1, 4), fractions.Fraction(272, 3)) >>> mark.decimal False
>>> mark = abjad.MetronomeMark( ... abjad.Duration(1, 4), ... fractions.Fraction(272, 3), ... decimal="90.66", ... ) >>> mark.decimal '90.66'
>>> mark = abjad.MetronomeMark( ... abjad.Duration(1, 4), ... fractions.Fraction(901, 10), ... decimal=True, ... ) >>> mark.decimal True
Set
hide=True
when metronome mark should not appear in output (but should still determine effective metronome mark):>>> staff = abjad.Staff("c'4 d' e' f'") >>> score = abjad.Score([staff]) >>> metronome_mark_1 = abjad.MetronomeMark(abjad.Duration(1, 4), 72) >>> abjad.attach(metronome_mark_1, staff[0]) >>> metronome_mark_2 = abjad.MetronomeMark( ... textual_indication="Allegro", ... hide=True, ... ) >>> abjad.attach(metronome_mark_2, staff[2]) >>> abjad.show(score)
>>> string = abjad.lilypond(score) >>> print(string) \new Score << \new Staff { \tempo 4=72 c'4 d'4 e'4 f'4 } >>
>>> for leaf in abjad.iterate.leaves(staff): ... prototype = abjad.MetronomeMark ... leaf, abjad.get.effective(leaf, prototype) ... (Note("c'4"), MetronomeMark(reference_duration=Duration(1, 4), units_per_minute=72, textual_indication=None, custom_markup=None, decimal=False, hide=False)) (Note("d'4"), MetronomeMark(reference_duration=Duration(1, 4), units_per_minute=72, textual_indication=None, custom_markup=None, decimal=False, hide=False)) (Note("e'4"), MetronomeMark(reference_duration=None, units_per_minute=None, textual_indication='Allegro', custom_markup=None, decimal=False, hide=True)) (Note("f'4"), MetronomeMark(reference_duration=None, units_per_minute=None, textual_indication='Allegro', custom_markup=None, decimal=False, hide=True))
Equality testing:
>>> mark_1 = abjad.MetronomeMark(abjad.Duration(3, 32), 52) >>> mark_2 = abjad.MetronomeMark(abjad.Duration(3, 32), 52)
>>> mark_1 == mark_2 True
>>> mark_2 == mark_1 True
>>> mark_1 = abjad.MetronomeMark(abjad.Duration(3, 32), 52) >>> mark_2 = abjad.MetronomeMark(abjad.Duration(6, 32), 104)
>>> mark_1 == mark_2 False
>>> mark_2 == mark_1 False
>>> mark_1 = abjad.MetronomeMark(abjad.Duration(3, 32), 52, "Langsam") >>> mark_2 = abjad.MetronomeMark(abjad.Duration(3, 32), 52, "Langsam") >>> mark_3 = abjad.MetronomeMark(abjad.Duration(3, 32), 52, "Slow")
>>> mark_1 == mark_2 True
>>> mark_1 == mark_3 False
duration_to_milliseconds
(duration)Gets millisecond value of
duration
under a given metronome mark.Is true if metronome mark is entirely textual or if metronome mark's units_per_minute is a range.
Gets metronome mark quarters per minute.
- duration_to_milliseconds(duration) Duration [source]
Gets millisecond value of
duration
under a given metronome mark.Dotted sixteenth lasts 1500 msec at quarter equals 60:
>>> mark = abjad.MetronomeMark(abjad.Duration(1, 4), 60) >>> mark.duration_to_milliseconds((3, 8)) Duration(1500, 1)
- is_imprecise
Is true if metronome mark is entirely textual or if metronome mark’s units_per_minute is a range.
Imprecise metronome marks:
>>> duration = abjad.Duration(1, 4)
>>> abjad.MetronomeMark(textual_indication="Langsam").is_imprecise True
>>> abjad.MetronomeMark(duration, (35, 50), "Langsam").is_imprecise True
>>> abjad.MetronomeMark(duration, (35, 50)).is_imprecise True
Precise metronome marks:
>>> abjad.MetronomeMark(duration, 60).is_imprecise False
>>> abjad.MetronomeMark(duration, 60, "Langsam").is_imprecise False
- quarters_per_minute
Gets metronome mark quarters per minute.
Gives tuple when metronome mark
units_per_minute
is a range.Gives none when metronome mark is imprecise.
Gives fraction otherwise.
>>> mark = abjad.MetronomeMark(abjad.Duration(1, 8), 52) >>> mark.quarters_per_minute Fraction(104, 1)
- class abjad.indicators.Mode(name: str = 'major')[source]
Mode.
>>> abjad.Mode("major") Mode(name='major')
Gets intervals in mode.
- intervals()[source]
Gets intervals in mode.
>>> for _ in abjad.Mode("major").intervals(): ... _ ... NamedInterval('+M2') NamedInterval('+M2') NamedInterval('+m2') NamedInterval('+M2') NamedInterval('+M2') NamedInterval('+M2') NamedInterval('+m2')
>>> for _ in abjad.Mode("dorian").intervals(): ... _ ... NamedInterval('+M2') NamedInterval('+m2') NamedInterval('+M2') NamedInterval('+M2') NamedInterval('+M2') NamedInterval('+m2') NamedInterval('+M2')
- class abjad.indicators.Ottava(n: int = 0, *, site: str = 'before')[source]
LilyPond
\ottava
command.>>> staff = abjad.Staff("c'4 d' e' f'") >>> ottava = abjad.Ottava(n=1) >>> abjad.attach(ottava, staff[0]) >>> ottava = abjad.Ottava(n=0, site="after") >>> abjad.attach(ottava, staff[-1]) >>> abjad.show(staff)
- class abjad.indicators.RehearsalMark(markup: Markup | str | None = None, number: int | None = None, *, site: str = 'before')[source]
LilyPond
\mark
command.>>> staff = abjad.Staff("c'4 d' e' f'") >>> score = abjad.Score([staff]) >>> mark = abjad.RehearsalMark(number=1) >>> abjad.attach(mark, staff[0]) >>> scheme = "#format-mark-box-alphabet" >>> abjad.setting(score).markFormatter = scheme >>> abjad.show(score)
Tweaks:
>>> note = abjad.Note("c'4") >>> staff = abjad.Staff([note]) >>> score = abjad.Score([staff], name="Score") >>> mark = abjad.RehearsalMark(markup="A") >>> bundle = abjad.bundle(mark, r"\tweak color #blue") >>> abjad.attach(bundle, note) >>> abjad.show(score)
- class abjad.indicators.Repeat(repeat_count: int = 2, repeat_type: str = 'volta')[source]
Repeat.
Volta repeat:
>>> container = abjad.Container("c'4 d'4 e'4 f'4") >>> staff = abjad.Staff([container]) >>> score = abjad.Score([staff]) >>> repeat = abjad.Repeat() >>> abjad.attach(repeat, container) >>> abjad.show(score)
Unfold repeat:
>>> container = abjad.Container("c'4 d'4 e'4 f'4") >>> staff = abjad.Staff([container]) >>> score = abjad.Score([staff]) >>> repeat = abjad.Repeat(repeat_type="unfold") >>> abjad.attach(repeat, container) >>> abjad.show(score)
- class abjad.indicators.RepeatTie[source]
LilyPond
\repeatTie
command.>>> voice = abjad.Voice("c'4 c' d' d'", name="Voice") >>> repeat_tie = abjad.RepeatTie() >>> bundle = abjad.bundle(repeat_tie, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[1]) >>> abjad.show(voice)
>>> abjad.get.indicators(voice[1], abjad.RepeatTie) [RepeatTie()]
>>> wrapper = abjad.get.wrapper(voice[1], abjad.RepeatTie) >>> wrapper.get_item() Bundle(indicator=RepeatTie(), tweaks=(Tweak(string='- \\tweak color #blue', i=None, tag=None),), comment=None)
>>> for leaf in voice: ... leaf, abjad.get.logical_tie(leaf) ... (Note("c'4"), LogicalTie(items=[Note("c'4"), Note("c'4")])) (Note("c'4"), LogicalTie(items=[Note("c'4"), Note("c'4")])) (Note("d'4"), LogicalTie(items=[Note("d'4")])) (Note("d'4"), LogicalTie(items=[Note("d'4")]))
With
direction
unset:>>> voice = abjad.Voice("c'4 c'4 c''4 c''4", name="Voice") >>> tie = abjad.RepeatTie() >>> bundle = abjad.bundle(tie, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[1]) >>> tie = abjad.RepeatTie() >>> bundle = abjad.bundle(tie, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[3]) >>> abjad.show(voice)
With
direction=abjad.UP
:>>> voice = abjad.Voice("c'4 c'4 c''4 c''4", name="Voice") >>> tie = abjad.RepeatTie() >>> bundle = abjad.bundle(tie, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[1], direction=abjad.UP) >>> tie = abjad.RepeatTie() >>> bundle = abjad.bundle(tie, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[3], direction=abjad.UP) >>> abjad.show(voice)
With
direction=abjad.DOWN
:>>> voice = abjad.Voice("c'4 c'4 c''4 c''4", name="Voice") >>> tie = abjad.RepeatTie() >>> bundle = abjad.bundle(tie, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[1], direction=abjad.DOWN) >>> tie = abjad.RepeatTie() >>> bundle = abjad.bundle(tie, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[3], direction=abjad.DOWN) >>> abjad.show(voice)
- class abjad.indicators.ShortInstrumentName(markup: str | Markup, *, context: str = 'Staff', site: str = 'before')[source]
LilyPond
\shortInstrumentName
command.Set
\shortInstrumentName
to markup like this:>>> staff = abjad.Staff("c'4 d'4 e'4 f'4") >>> short_instrument_name = abjad.ShortInstrumentName(r"\markup Vc.") >>> abjad.attach(short_instrument_name, staff[0]) >>> abjad.show(staff)
Set
\shortInstrumentName
to custom function like this:>>> staff = abjad.Staff("c'4 d'4 e'4 f'4") >>> short_instrument_name = abjad.ShortInstrumentName(r"\my_custom_function") >>> abjad.attach(short_instrument_name, staff[0])
- class abjad.indicators.StaffChange(staff_name: str | bool)[source]
Staff change.
>>> staff_group = abjad.StaffGroup() >>> staff_group.lilypond_type = "PianoStaff" >>> rh_staff = abjad.Staff("c'8 d'8 e'8 f'8", name="RH_Staff") >>> lh_staff = abjad.Staff("s2", name="LH_Staff") >>> staff_group.extend([rh_staff, lh_staff]) >>> staff_change = abjad.StaffChange("LH_Staff") >>> abjad.attach(staff_change, rh_staff[2]) >>> abjad.show(staff_group)
- class abjad.indicators.StartBeam[source]
LilyPond
[
command.>>> voice = abjad.Voice("c'8 d' e' f'") >>> start_beam = abjad.StartBeam() >>> bundle = abjad.bundle(start_beam, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_beam = abjad.StopBeam() >>> abjad.attach(stop_beam, voice[-1]) >>> abjad.show(voice)
With
direction=abjad.DOWN
:>>> voice = abjad.Voice("c'8 d' e' f'") >>> start_beam = abjad.StartBeam() >>> bundle = abjad.bundle(start_beam, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0], direction=abjad.DOWN) >>> stop_beam = abjad.StopBeam() >>> abjad.attach(stop_beam, voice[-1]) >>> abjad.show(voice)
- class abjad.indicators.StartGroup[source]
LilyPond
\startGroup
command.>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_group = abjad.StartGroup() >>> bundle = abjad.bundle(start_group, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_group = abjad.StopGroup() >>> abjad.attach(stop_group, voice[-1]) >>> abjad.show(voice)
- class abjad.indicators.StartHairpin(shape: str = '<')[source]
Hairpin indicator.
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("p"), voice[0]) >>> abjad.attach(abjad.StartHairpin("<"), voice[0]) >>> abjad.attach(abjad.Dynamic("f"), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> abjad.show(voice)
Crescendo:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("p"), voice[0]) >>> abjad.attach(abjad.StartHairpin("<"), voice[0]) >>> abjad.attach(abjad.Dynamic("f"), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> abjad.show(voice)
Crescendo dal niente:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.StartHairpin("o<"), voice[0]) >>> abjad.attach(abjad.Dynamic("f"), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> abjad.show(voice)
Subito crescendo:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("p"), voice[0]) >>> abjad.attach(abjad.StartHairpin("<|"), voice[0]) >>> abjad.attach(abjad.Dynamic("f"), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
Subito crescendo dal niente:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.StartHairpin("o<|"), voice[0]) >>> abjad.attach(abjad.Dynamic("f"), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
Diminuendo:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("f"), voice[0]) >>> abjad.attach(abjad.StartHairpin(">"), voice[0]) >>> abjad.attach(abjad.Dynamic("p"), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> abjad.show(voice)
Diminuendo al niente:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("f"), voice[0]) >>> abjad.attach(abjad.StartHairpin(">o"), voice[0]) >>> abjad.attach(abjad.StopHairpin(), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> abjad.show(voice)
Subito diminuendo:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("f"), voice[0]) >>> abjad.attach(abjad.StartHairpin("|>"), voice[0]) >>> abjad.attach(abjad.Dynamic("p"), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
Subito diminuendo al niente:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("f"), voice[0]) >>> abjad.attach(abjad.StartHairpin("|>o"), voice[0]) >>> abjad.attach(abjad.StopHairpin(), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
Constante:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("p"), voice[0]) >>> abjad.attach(abjad.StartHairpin("--"), voice[0]) >>> abjad.attach(abjad.Dynamic("f"), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> abjad.show(voice)
Tweaks:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> abjad.attach(abjad.Dynamic("p"), voice[0]) >>> start_hairpin = abjad.StartHairpin("<") >>> bundle = abjad.bundle(start_hairpin, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> abjad.attach(abjad.Dynamic("f"), voice[-1]) >>> abjad.override(voice).DynamicLineSpanner.staff_padding = 4.5 >>> abjad.show(voice)
- class abjad.indicators.StartPhrasingSlur[source]
LilyPond
(
command.>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_phrasing_slur = abjad.StartPhrasingSlur() >>> bundle = abjad.bundle(start_phrasing_slur, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_phrasing_slur = abjad.StopPhrasingSlur() >>> abjad.attach(stop_phrasing_slur, voice[-1]) >>> abjad.show(voice)
- class abjad.indicators.StartPianoPedal(kind: str = 'sustain')[source]
LilyPond
\sustainOn
,\sostenutoOn
,\unaCorda
commands.>>> staff = abjad.Staff("c'4 d' e' r") >>> start_piano_pedal = abjad.StartPianoPedal() >>> bundle = abjad.bundle( ... start_piano_pedal, ... r"- \tweak color #blue", ... r"- \tweak parent-alignment-X #center", ... ) >>> abjad.attach(bundle, staff[0], context="Staff") >>> stop_piano_pedal = abjad.StopPianoPedal() >>> abjad.attach(stop_piano_pedal, staff[1], context="Staff")
>>> start_piano_pedal = abjad.StartPianoPedal() >>> bundle = abjad.bundle(start_piano_pedal, r"- \tweak color #red") >>> abjad.attach(bundle, staff[1], context="Staff") >>> stop_piano_pedal = abjad.StopPianoPedal() >>> abjad.attach(stop_piano_pedal, staff[2], context="Staff")
>>> start_piano_pedal = abjad.StartPianoPedal() >>> bundle = abjad.bundle(start_piano_pedal, r"- \tweak color #green") >>> abjad.attach(bundle, staff[2], context="Staff") >>> stop_piano_pedal = abjad.StopPianoPedal() >>> abjad.attach(stop_piano_pedal, staff[3], context="Staff")
>>> abjad.override(staff).SustainPedalLineSpanner.staff_padding = 5 >>> abjad.setting(staff).pedalSustainStyle = "#'mixed" >>> abjad.show(staff)
- class abjad.indicators.StartSlur[source]
LilyPond
(
command.>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_slur = abjad.StartSlur() >>> bundle = abjad.bundle(start_slur, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_slur = abjad.StopSlur() >>> abjad.attach(stop_slur, voice[-1]) >>> abjad.show(voice)
With
direction
unset:>>> voice = abjad.Voice("c'8 d' e' f' c'' d'' e'' f''") >>> abjad.attach(abjad.StartSlur(), voice[0]) >>> abjad.attach(abjad.StopSlur(), voice[3]) >>> abjad.attach(abjad.StartSlur(), voice[4]) >>> abjad.attach(abjad.StopSlur(), voice[7]) >>> abjad.show(voice)
With
direction=abjad.UP
:>>> voice = abjad.Voice("c'8 d' e' f' c'' d'' e'' f''") >>> abjad.attach(abjad.StartSlur(), voice[0], direction=abjad.UP) >>> abjad.attach(abjad.StopSlur(), voice[3]) >>> abjad.attach(abjad.StartSlur(), voice[4], direction=abjad.UP) >>> abjad.attach(abjad.StopSlur(), voice[7]) >>> abjad.show(voice)
With
direction=abjad.DOWN
:>>> voice = abjad.Voice("c'8 d' e' f' c'' d'' e'' f''") >>> abjad.attach(abjad.StartSlur(), voice[0], direction=abjad.DOWN) >>> abjad.attach(abjad.StopSlur(), voice[3]) >>> abjad.attach(abjad.StartSlur(), voice[4], direction=abjad.DOWN) >>> abjad.attach(abjad.StopSlur(), voice[7]) >>> abjad.show(voice)
- class abjad.indicators.StartTextSpan(command: str = '\\startTextSpan', concat_hspace_left: int | float = 0.5, concat_hspace_right: int | float | None = None, left_broken_text: bool | str | Markup | None = None, left_text: str | Markup | None = None, right_padding: int | float | None = None, right_text: str | Markup | None = None, style: str | None = None)[source]
LilyPond
\startTextSpan
command.>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... right_text=abjad.Markup(r"\markup \upright tasto"), ... style=r"\abjad-solid-line-with-arrow", ... ) >>> bundle = abjad.bundle(start_text_span, r"- \tweak staff-padding 2.5") >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-1]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
>>> abjad.StartTextSpan() StartTextSpan(command='\\startTextSpan', concat_hspace_left=0.5, concat_hspace_right=None, left_broken_text=None, left_text=None, right_padding=None, right_text=None, style=None)
Spacer text included below to prevent docs from clipping output:
>>> voice = abjad.Voice("c'4 d' e' f'")
>>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... right_text=abjad.Markup(r"\markup \upright tasto"), ... style=r"\abjad-dashed-line-with-arrow", ... ) >>> bundle = abjad.bundle( ... start_text_span, ... r"- \tweak color #blue", ... r"- \tweak staff-padding 2.5", ... ) >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-1])
>>> start_text_span = abjad.StartTextSpan( ... command=r"\startTextSpanOne", ... left_text=abjad.Markup(r"\upright A"), ... right_text=abjad.Markup(r"\markup \upright B"), ... style=r"\abjad-dashed-line-with-arrow", ... ) >>> bundle = abjad.bundle( ... start_text_span, ... r"- \tweak color #red", ... r"- \tweak staff-padding 6", ... ) >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan(command=r"\stopTextSpanOne") >>> abjad.attach(stop_text_span, voice[-1])
>>> markup = abjad.Markup(r"\markup SPACER") >>> bundle = abjad.bundle(markup, r"- \tweak transparent ##t") >>> abjad.attach(bundle, voice[0], direction=abjad.UP) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
String literals are allowed in place of markup:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> left_text = r"- \tweak bound-details.left.text \markup" >>> left_text += r" \concat { \upright pont. \hspace #0.5 }" >>> right_text = r"- \tweak bound-details.right.text \markup" >>> right_text += r" \upright tasto" >>> start_text_span = abjad.StartTextSpan( ... left_text=left_text, ... right_text=right_text, ... style=r"\abjad-solid-line-with-arrow", ... ) >>> bundle = abjad.bundle(start_text_span, r"- \tweak staff-padding 2.5") >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-1]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
Styles:
>>> voice = abjad.Voice("c'4 d' e' fs'") >>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... right_text=abjad.Markup(r"\markup \upright tasto"), ... style=r"\abjad-dashed-line-with-arrow", ... ) >>> bundle = abjad.bundle(start_text_span, r"- \tweak staff-padding 2.5") >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-1]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... style=r"\abjad-dashed-line-with-hook", ... ) >>> bundle = abjad.bundle(start_text_span, r"- \tweak staff-padding 2.5") >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-1]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... right_text=abjad.Markup(r"\markup \upright tasto"), ... style=r"\abjad-invisible-line", ... ) >>> bundle = abjad.bundle(start_text_span, r"- \tweak staff-padding 2.5") >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-1]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... right_text=abjad.Markup(r"\markup \upright tasto"), ... style=r"\abjad-solid-line-with-arrow", ... ) >>> bundle = abjad.bundle(start_text_span, r"- \tweak staff-padding 2.5") >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-1]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
Styles constrained to
r'\abjad-dashed-line-with-arrow'
,r'\abjad-dashed-line-with-hook'
,r'\abjad-invisible-line'
,r'\abjad-solid-line-with-arrow'
,r'\abjad-solid-line-with-hook'
, none:>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... style=r"\abjad-solid-line-with-hook", ... ) >>> bundle = abjad.bundle(start_text_span, r"- \tweak staff-padding 2.5") >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-1]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
REGRESSION. Tweaking the dash-fraction of the start text span works correctly:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... right_text=abjad.Markup(r"\markup \upright tasto"), ... style=r"\abjad-dashed-line-with-arrow", ... ) >>> bundle = abjad.bundle( ... start_text_span, ... r"- \tweak dash-fraction 0.85", ... r"- \tweak staff-padding 2.5", ... ) >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-1]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
- class abjad.indicators.StartTrillSpan(interval: str | NamedInterval | None = None, pitch: str | NamedPitch | None = None, *, force_trill_pitch_head_accidental: bool = False)[source]
LilyPond
\startTrillSpan
command.>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_trill_span = abjad.StartTrillSpan() >>> bundle = abjad.bundle(start_trill_span, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_trill_span = abjad.StopTrillSpan() >>> abjad.attach(stop_trill_span, voice[-1]) >>> abjad.show(voice)
With interval:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_trill_span = abjad.StartTrillSpan(interval=abjad.NamedInterval("M2")) >>> bundle = abjad.bundle(start_trill_span, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_trill_span = abjad.StopTrillSpan() >>> abjad.attach(stop_trill_span, voice[-1]) >>> abjad.show(voice)
With pitch:
>>> voice = abjad.Voice("c'4 d' e' f'") >>> start_trill_span = abjad.StartTrillSpan(pitch=abjad.NamedPitch("C#4")) >>> bundle = abjad.bundle(start_trill_span, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_trill_span = abjad.StopTrillSpan() >>> abjad.attach(stop_trill_span, voice[-1]) >>> abjad.show(voice)
- class abjad.indicators.StemTremolo(tremolo_flags: int = 16)[source]
Stem tremolo.
Sixteenth-note tremolo:
>>> note = abjad.Note("c'4") >>> stem_tremolo = abjad.StemTremolo(16) >>> abjad.attach(stem_tremolo, note) >>> abjad.show(note)
Thirty-second-note tremolo:
>>> note = abjad.Note("c'4") >>> stem_tremolo = abjad.StemTremolo(32) >>> abjad.attach(stem_tremolo, note) >>> abjad.show(note)
REGRESSION. Consider a note, rest, chord to which a stem tremolo is attached. When such a note, rest, chord splits into two notes, rests, chords then a stem tremolo attaches to each of the resultant notes, rests, chords:
>>> staff = abjad.Staff("c'4 c'2.") >>> abjad.attach(abjad.StemTremolo(), staff[1]) >>> abjad.show(staff)
>>> rtc = abjad.meter.make_best_guess_rtc((3, 4)) >>> meter = abjad.Meter(rtc) >>> meter.rewrite(staff[:]) >>> abjad.show(staff)
- class abjad.indicators.StopBeam(leak: bool = False)[source]
LilyPond
]
command.Without leak:
>>> voice = abjad.Voice("c'8 d' e' r") >>> start_beam = abjad.StartBeam() >>> bundle = abjad.bundle(start_beam, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_beam = abjad.StopBeam() >>> abjad.attach(stop_beam, voice[-2]) >>> abjad.show(voice)
With leak:
>>> voice = abjad.Voice("c'8 d' e' r") >>> start_beam = abjad.StartBeam() >>> bundle = abjad.bundle(start_beam, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_beam = abjad.StopBeam(leak=True) >>> abjad.attach(stop_beam, voice[-2]) >>> abjad.show(voice)
- class abjad.indicators.StopGroup(leak: bool = False)[source]
LilyPond
\stopGroup
command.Without leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_group = abjad.StartGroup() >>> bundle = abjad.bundle(start_group, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_group = abjad.StopGroup() >>> abjad.attach(stop_group, voice[-2]) >>> abjad.show(voice)
With leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_group = abjad.StartGroup() >>> bundle = abjad.bundle(start_group, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_group = abjad.StopGroup(leak=True) >>> abjad.attach(stop_group, voice[-2]) >>> abjad.show(voice)
REGRESSION. Leaked contributions appear last in postevent format site. The leaked text spanner does not inadvertantly leak the beam:
>>> voice = abjad.Voice("c'8 d' e' f' r2") >>> abjad.beam(voice[:4]) >>> start_group = abjad.StartGroup() >>> bundle = abjad.bundle(start_group, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_group = abjad.StopGroup(leak=True) >>> abjad.attach(stop_group, voice[3]) >>> abjad.show(voice)
- class abjad.indicators.StopHairpin(leak: bool = False)[source]
LilyPond
\!
command.Without leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_hairpin = abjad.StartHairpin("<") >>> bundle = abjad.bundle(start_hairpin, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_hairpin = abjad.StopHairpin() >>> abjad.attach(stop_hairpin, voice[-2]) >>> abjad.show(voice)
With leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_hairpin = abjad.StartHairpin("<") >>> bundle = abjad.bundle(start_hairpin, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_hairpin = abjad.StopHairpin(leak=True) >>> abjad.attach(stop_hairpin, voice[-2]) >>> abjad.show(voice)
- class abjad.indicators.StopPhrasingSlur(leak: bool = False)[source]
LilyPond
\)
command.Without leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_phrasing_slur = abjad.StartPhrasingSlur() >>> bundle = abjad.bundle(start_phrasing_slur, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_phrasing_slur = abjad.StopPhrasingSlur() >>> abjad.attach(stop_phrasing_slur, voice[-2]) >>> abjad.show(voice)
With leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_phrasing_slur = abjad.StartPhrasingSlur() >>> bundle = abjad.bundle(start_phrasing_slur, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_phrasing_slur = abjad.StopPhrasingSlur(leak=True) >>> abjad.attach(stop_phrasing_slur, voice[-2]) >>> abjad.show(voice)
REGRESSION. Leaked contributions appear last in postevent format site. The leaked text spanner does not inadvertantly leak the beam:
>>> voice = abjad.Voice("c'8 d' e' f' r2") >>> abjad.beam(voice[:4]) >>> start_phrasing_slur = abjad.StartPhrasingSlur() >>> bundle = abjad.bundle(start_phrasing_slur, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_phrasing_slur = abjad.StopPhrasingSlur(leak=True) >>> abjad.attach(stop_phrasing_slur, voice[3]) >>> abjad.show(voice)
- class abjad.indicators.StopPianoPedal(kind: str = 'sustain', leak: bool = False)[source]
LilyPond
\sostenutoOff
,\sustainOff
,\treCorde
commands.Without leak:
>>> staff = abjad.Staff("c'4 d' e' r") >>> start_piano_pedal = abjad.StartPianoPedal() >>> bundle = abjad.bundle( ... start_piano_pedal, ... r"- \tweak color #blue", ... r"- \tweak parent-alignment-X #center", ... ) >>> abjad.attach(bundle, staff[0], context="Staff") >>> stop_piano_pedal = abjad.StopPianoPedal() >>> bundle = abjad.bundle( ... stop_piano_pedal, ... r"- \tweak color #red", ... r"- \tweak parent-alignment-X #center", ... ) >>> abjad.attach(bundle, staff[-2], context="Staff") >>> abjad.override(staff).SustainPedalLineSpanner.staff_padding = 5 >>> abjad.show(staff)
With leak:
>>> staff = abjad.Staff("c'4 d' e' r") >>> start_piano_pedal = abjad.StartPianoPedal() >>> bundle = abjad.bundle( ... start_piano_pedal, ... r"- \tweak color #blue", ... r"- \tweak parent-alignment-X #center", ... ) >>> abjad.attach(bundle, staff[0], context="Staff") >>> stop_piano_pedal = abjad.StopPianoPedal(leak=True) >>> bundle = abjad.bundle( ... stop_piano_pedal, ... r"- \tweak color #red", ... r"- \tweak parent-alignment-X #center", ... ) >>> abjad.attach(bundle, staff[-2], context="Staff") >>> abjad.override(staff).SustainPedalLineSpanner.staff_padding = 5 >>> abjad.show(staff)
- class abjad.indicators.StopSlur(leak: bool = False)[source]
LilyPond
)
command.Without leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_slur = abjad.StartSlur() >>> bundle = abjad.bundle(start_slur, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_slur = abjad.StopSlur() >>> abjad.attach(stop_slur, voice[-2]) >>> abjad.show(voice)
With leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_slur = abjad.StartSlur() >>> bundle = abjad.bundle(start_slur, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_slur = abjad.StopSlur(leak=True) >>> abjad.attach(stop_slur, voice[-2]) >>> abjad.show(voice)
REGRESSION. Leaked contributions appear last in postevent format site. The leaked text spanner above does not inadvertantly leak the beam:
>>> voice = abjad.Voice("c'8 d' e' f' r2") >>> abjad.beam(voice[:4]) >>> start_slur = abjad.StartSlur() >>> bundle = abjad.bundle(start_slur, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_slur = abjad.StopSlur(leak=True) >>> abjad.attach(stop_slur, voice[3]) >>> abjad.show(voice)
- class abjad.indicators.StopTextSpan(command: str = '\\stopTextSpan', leak: bool = False)[source]
LilyPond
\stopTextSpan
command.Without leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... right_text=abjad.Markup(r"\markup \upright tasto"), ... style=r"\abjad-dashed-line-with-arrow", ... ) >>> bundle = abjad.bundle(start_text_span, r"- \tweak staff-padding 2.5") >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan() >>> abjad.attach(stop_text_span, voice[-2]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
With leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_text_span = abjad.StartTextSpan( ... left_text=abjad.Markup(r"\upright pont."), ... right_text=abjad.Markup(r"\markup \upright tasto"), ... style=r"\abjad-dashed-line-with-arrow", ... ) >>> bundle = abjad.bundle(start_text_span, r"- \tweak staff-padding 2.5") >>> abjad.attach(bundle, voice[0]) >>> stop_text_span = abjad.StopTextSpan(leak=True) >>> abjad.attach(stop_text_span, voice[-2]) >>> lilypond_file = abjad.LilyPondFile([r'\include "abjad.ily"', voice]) >>> abjad.show(lilypond_file)
- class abjad.indicators.StopTrillSpan(leak: bool = False)[source]
LilyPond
\stopTrillSpan
command.Without leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_trill_span = abjad.StartTrillSpan() >>> bundle = abjad.bundle(start_trill_span, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_trill_span = abjad.StopTrillSpan() >>> abjad.attach(stop_trill_span, voice[-2]) >>> abjad.show(voice)
With leak:
>>> voice = abjad.Voice("c'4 d' e' r") >>> start_trill_span = abjad.StartTrillSpan() >>> bundle = abjad.bundle(start_trill_span, r"- \tweak color #blue") >>> abjad.attach(bundle, voice[0]) >>> stop_trill_span = abjad.StopTrillSpan(leak=True) >>> abjad.attach(stop_trill_span, voice[-2]) >>> abjad.show(voice)
- class abjad.indicators.TextMark(string: str, *, site: str = 'before')[source]
LilyPond
\textMark
,\textEndMark
commands.Text mark:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> score = abjad.Score([staff]) >>> mark = abjad.TextMark(r'\textMark \markup \italic "V.S."') >>> abjad.attach(mark, staff[-1]) >>> abjad.show(score)
Tweaks:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> score = abjad.Score([staff]) >>> mark = abjad.TextMark(r'\textMark \markup \italic "V.S."') >>> bundle = abjad.bundle(mark, r"\tweak color #blue") >>> abjad.attach(bundle, staff[-1]) >>> abjad.show(score)
Text end mark:
>>> staff = abjad.Staff("c'4 d' e' f'") >>> score = abjad.Score([staff]) >>> mark = abjad.TextMark(r'\textEndMark \markup \italic "V.S."', site="after") >>> abjad.attach(mark, staff[-1]) >>> abjad.show(score)
- class abjad.indicators.Tie[source]
LilyPond
~
command.>>> staff = abjad.Staff("c'4 c' d' d'") >>> tie = abjad.Tie() >>> bundle = abjad.bundle(tie, r"- \tweak color #blue") >>> abjad.attach(bundle, staff[0]) >>> abjad.show(staff)
>>> for leaf in staff: ... leaf, abjad.get.logical_tie(leaf) ... (Note("c'4"), LogicalTie(items=[Note("c'4"), Note("c'4")])) (Note("c'4"), LogicalTie(items=[Note("c'4"), Note("c'4")])) (Note("d'4"), LogicalTie(items=[Note("d'4")])) (Note("d'4"), LogicalTie(items=[Note("d'4")]))
With
direction
unset:>>> staff = abjad.Staff("c'4 c' c'' c''") >>> abjad.attach(abjad.Tie(), staff[0]) >>> abjad.attach(abjad.Tie(), staff[2]) >>> abjad.show(staff)
With
direction=abjad.UP
:>>> staff = abjad.Staff("c'4 c' c'' c''") >>> abjad.attach(abjad.Tie(), staff[0], direction=abjad.UP) >>> abjad.attach(abjad.Tie(), staff[2], direction=abjad.UP) >>> abjad.show(staff)
With
direction=abjad.DOWN
:>>> staff = abjad.Staff("c'4 c' c'' c''") >>> abjad.attach(abjad.Tie(), staff[0], direction=abjad.DOWN) >>> abjad.attach(abjad.Tie(), staff[2], direction=abjad.DOWN) >>> abjad.show(staff)
- class abjad.indicators.TimeSignature(pair: tuple[int, int], hide: bool = False, partial: Duration | None = None)[source]
Time signature.
>>> staff = abjad.Staff("c'8 d'8 e'8") >>> score = abjad.Score([staff], name="Score") >>> time_signature = abjad.TimeSignature((3, 8)) >>> abjad.attach(time_signature, staff[0]) >>> abjad.show(staff)
Create score-contexted time signatures like this:
>>> staff = abjad.Staff("c'8 d'8 e'8 c'8 d'8 e'8") >>> score = abjad.Score([staff], name="Score") >>> time_signature = abjad.TimeSignature((3, 8)) >>> abjad.attach(time_signature, staff[0], context="Score") >>> score[:] = []
Score-contexted time signatures format behind comments when no Abjad score container is found:
>>> string = abjad.lilypond(staff) >>> print(string) \new Staff { %%% \time 3/8 %%% c'8 d'8 e'8 c'8 d'8 e'8 }
>>> abjad.show(staff)
Score-contexted time signatures format normally when an Abjad score container is found:
>>> score = abjad.Score([staff]) >>> string = abjad.lilypond(score) >>> print(string) \new Score << \new Staff { \time 3/8 c'8 d'8 e'8 c'8 d'8 e'8 } >>
>>> abjad.show(score)
Time signatures can be tagged:
>>> staff = abjad.Staff("c'8 d'8 e'8 c'8 d'8 e'8") >>> score = abjad.Score([staff], name="Score") >>> time_signature = abjad.TimeSignature((3, 8)) >>> abjad.attach( ... time_signature, ... staff[0], ... context="Score", ... tag=abjad.Tag("+PARTS"), ... ) >>> abjad.show(staff)
>>> string = abjad.lilypond(score, tags=True) >>> print(string) \context Score = "Score" << \new Staff { %! +PARTS \time 3/8 c'8 d'8 e'8 c'8 d'8 e'8 } >>
Set
hide=True
time signature should not appear in output (but should still determine effective time signature):>>> staff = abjad.Staff("c'4 d' e' f'") >>> score = abjad.Score([staff], name="Score") >>> time_signature = abjad.TimeSignature((4, 4)) >>> abjad.attach(time_signature, staff[0]) >>> time_signature = abjad.TimeSignature((2, 4), hide=True) >>> abjad.attach(time_signature, staff[2]) >>> abjad.show(staff)
>>> string = abjad.lilypond(staff) >>> print(string) \new Staff { \time 4/4 c'4 d'4 e'4 f'4 }
>>> for leaf in abjad.iterate.leaves(staff): ... prototype = abjad.TimeSignature ... leaf, abjad.get.effective(leaf, prototype) ... (Note("c'4"), TimeSignature(pair=(4, 4), hide=False, partial=None)) (Note("d'4"), TimeSignature(pair=(4, 4), hide=False, partial=None)) (Note("e'4"), TimeSignature(pair=(2, 4), hide=True, partial=None)) (Note("f'4"), TimeSignature(pair=(2, 4), hide=True, partial=None))
Gets denominator of time signature:
Gets duration of time signature.
Is true when denominator of time signature is integer power of two.
Gets numerator of time signature.
Gets prolation of time signature.
- denominator
Gets denominator of time signature:
>>> abjad.TimeSignature((3, 8)).denominator 8
- duration
Gets duration of time signature.
>>> abjad.TimeSignature((3, 8)).duration Duration(3, 8)
- is_dyadic() bool [source]
Is true when denominator of time signature is integer power of two.
>>> abjad.TimeSignature((3, 8)).is_dyadic() True
>>> abjad.TimeSignature((7, 12)).is_dyadic() False
Nondyadic time signatures suppress LilyPond “strange time signature” warning:
>>> tuplet = abjad.Tuplet("3:2", "c'4 d' e' f'") >>> abjad.makers.tweak_tuplet_bracket_edge_height(tuplet) >>> staff = abjad.Staff([tuplet]) >>> score = abjad.Score([staff], name="Score") >>> time_signature = abjad.TimeSignature((4, 3)) >>> abjad.attach(time_signature, tuplet[0]) >>> abjad.show(staff)
>>> string = abjad.lilypond(staff) >>> print(string) \new Staff { \tweak edge-height #'(0.7 . 0) \tuplet 3/2 { #(ly:expect-warning "strange time signature found") \time 4/3 c'4 d'4 e'4 f'4 } }
- numerator
Gets numerator of time signature.
>>> abjad.TimeSignature((3, 8)).numerator 3
- class abjad.indicators.VoiceNumber(n: int | None = None, leak: bool = False)[source]
LilyPond
\voiceOne
,\voiceTwo
,\voiceThree
,\voiceFour
,\oneVoice
commands.>>> staff = abjad.Staff() >>> voice_1 = abjad.Voice("g'8 a' b' c''") >>> command = abjad.VoiceNumber(n=1) >>> abjad.attach(command, voice_1[0]) >>> voice_2 = abjad.Voice("e'8 f' g' a'") >>> command = abjad.VoiceNumber(n=2) >>> abjad.attach(command, voice_2[0]) >>> container = abjad.Container([voice_1, voice_2], simultaneous=True) >>> staff.append(container) >>> voice = abjad.Voice("c''4 a'") >>> command = abjad.VoiceNumber() >>> abjad.attach(command, voice[0]) >>> staff.append(voice) >>> abjad.show(staff)
>>> for leaf in abjad.select.leaves(staff): ... command = abjad.get.effective(leaf, abjad.VoiceNumber) ... print(f"{leaf}, {command}") ... Note("g'8"), VoiceNumber(n=1, leak=False) Note("a'8"), VoiceNumber(n=1, leak=False) Note("b'8"), VoiceNumber(n=1, leak=False) Note("c''8"), VoiceNumber(n=1, leak=False) Note("e'8"), VoiceNumber(n=2, leak=False) Note("f'8"), VoiceNumber(n=2, leak=False) Note("g'8"), VoiceNumber(n=2, leak=False) Note("a'8"), VoiceNumber(n=2, leak=False) Note("c''4"), VoiceNumber(n=None, leak=False) Note("a'4"), VoiceNumber(n=None, leak=False)