LabelAgent

class agenttools.LabelAgent(client=None)

Label agent.

Labels pitch names:

>>> staff = Staff("c'4 e'4 d'4 f'4")
>>> label(staff).with_pitches()
>>> show(staff) 
>>> staff = Staff("c'4 e'4 d'4 f'4")
>>> expression = label().with_pitches()
>>> f(expression)
expressiontools.Expression(
    callbacks=[
        expressiontools.Expression(
            evaluation_template='abjad.agenttools.LabelAgent',
            is_initializer=True,
            ),
        expressiontools.Expression(
            evaluation_template='{}.with_pitches()',
            ),
        ],
    proxy_class=agenttools.LabelAgent,
    )
>>> expression(staff)
>>> show(staff) 

Labels durations:

>>> staff = Staff("c'4 e'4 d'4 f'4")
>>> label(staff).with_durations()
>>> show(staff) 
>>> staff = Staff("c'4 e'4 d'4 f'4")
>>> expression = label().with_durations()
>>> f(expression)
expressiontools.Expression(
    callbacks=[
        expressiontools.Expression(
            evaluation_template='abjad.agenttools.LabelAgent',
            is_initializer=True,
            ),
        expressiontools.Expression(
            evaluation_template='{}.with_durations()',
            ),
        ],
    proxy_class=agenttools.LabelAgent,
    )
>>> expression(staff)
>>> show(staff) 

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_agenttools { graph [label=agenttools]; "abjad.tools.agenttools.LabelAgent.LabelAgent" [color=black, fontcolor=white, group=1, label=<<B>LabelAgent</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=3, group=2, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.agenttools.LabelAgent.LabelAgent"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

client Gets client of label agent.
color_alternating([colors]) Colors client items in alternating colors.
color_container([color]) Colors contents of container.
color_leaves([color]) Colors leaves.
color_note_heads([color_map]) Colors note note-heads.
remove_markup() Removes markup from leaves.
vertical_moments([direction, prototype]) Labels vertical moments.
with_durations([direction, ...]) Labels logical ties with durations.
with_indices([direction, prototype]) Labels logical ties with indices.
with_intervals([direction, prototype]) Labels consecutive notes with intervals.
with_pitches([direction, prototype]) Labels logical ties with pitches.
with_set_classes([direction, prototype]) Labels items in client with set-classes.
with_start_offsets([clock_time, direction, ...]) Labels logical ties with start offsets.
__eq__(argument) Is true when ID of argument equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__hash__() Hashes Abjad object.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

LabelAgent.client

Gets client of label agent.

Returns component, selection, spanner or none.

Methods

LabelAgent.color_alternating(colors=['red', 'blue'])

Colors client items in alternating colors.

Returns none.

LabelAgent.color_container(color='red')

Colors contents of container.

Colors measure:

>>> measure = Measure((2, 8), "c'8 d'8")
>>> label(measure).color_container('red')
>>> show(measure) 
>>> measure = Measure((2, 8), "c'8 d'8")
>>> expression = label().color_container('red')
>>> expression(measure)
>>> show(measure) 

Returns none.

LabelAgent.color_leaves(color='red')

Colors leaves.

Colors leaves red:

>>> staff = Staff("cs'8. [ r8. s8. <c' cs' a'>8. ]")
>>> label(staff).color_leaves('red')
>>> show(staff) 
>>> staff = Staff("cs'8. [ r8. s8. <c' cs' a'>8. ]")
>>> expression = label().color_leaves('red')
>>> expression(staff)
>>> show(staff) 

Returns none.

LabelAgent.color_note_heads(color_map=None)

Colors note note-heads.

Colors chord note-heads:

>>> chord = Chord([12, 14, 18, 21, 23], (1, 4))
>>> pitches = [[-12, -10, 4], [-2, 8, 11, 17], [19, 27, 30, 33, 37]]
>>> colors = ['red', 'blue', 'green']
>>> color_map = pitchtools.NumberedPitchClassColorMap(pitches, colors)
>>> label(chord).color_note_heads(color_map)
>>> show(chord) 
>>> chord = Chord([12, 14, 18, 21, 23], (1, 4))
>>> pitches = [[-12, -10, 4], [-2, 8, 11, 17], [19, 27, 30, 33, 37]]
>>> colors = ['red', 'blue', 'green']
>>> color_map = pitchtools.NumberedPitchClassColorMap(pitches, colors)
>>> expression = label().color_note_heads(color_map)
>>> expression(chord)
>>> show(chord) 

Colors note note-head:

>>> note = Note("c'4")
>>> label(note).color_note_heads(color_map)
>>> show(note) 
>>> note = Note("c'4")
>>> expression = label().color_note_heads(color_map)
>>> expression(note)
>>> show(note) 

Colors nothing:

>>> staff = Staff()
>>> label(staff).color_note_heads(color_map)
>>> staff = Staff()
>>> expression = label().color_note_heads(color_map)
>>> expression(staff)

Colors note-heads:

>>> staff = Staff("c'8 cs'8 d'8 ds'8 e'8 f'8 fs'8 g'8 gs'8 a'8 as'8 b'8 c''8")
>>> label(staff).color_note_heads()
>>> show(staff) 
>>> staff = Staff("c'8 cs'8 d'8 ds'8 e'8 f'8 fs'8 g'8 gs'8 a'8 as'8 b'8 c''8")
>>> expression = label().color_note_heads()
>>> expression(staff)
>>> show(staff) 

Returns none.

LabelAgent.remove_markup()

Removes markup from leaves.

Removes markup:

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> label(staff).with_pitches()
>>> show(staff) 
>>> label(staff).remove_markup()
>>> show(staff) 
>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> expression = label().with_pitches()
>>> expression(staff)
>>> show(staff) 
>>> expression = label().remove_markup()
>>> expression(staff)
>>> show(staff) 

Returns none.

LabelAgent.vertical_moments(direction=Up, prototype=None)

Labels vertical moments.

Labels indices:

>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> label(staff_group).vertical_moments()
>>> show(staff_group) 
>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> expression = label().vertical_moments()
>>> expression(staff_group)
>>> show(staff_group) 

Labels pitch numbers:

>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.NumberedPitch
>>> label(staff_group).vertical_moments(prototype=prototype)
>>> show(staff_group) 
>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.NumberedPitch
>>> expression = label().vertical_moments(prototype=prototype)
>>> expression(staff_group)
>>> show(staff_group) 

Labels pitch-class numbers:

>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.NumberedPitchClass
>>> label(staff_group).vertical_moments(prototype=prototype)
>>> show(staff_group) 
>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.NumberedPitchClass
>>> expression = label().vertical_moments(prototype=prototype)
>>> expression(staff_group)
>>> show(staff_group) 

Labels interval numbers:

>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.NumberedInterval
>>> label(staff_group).vertical_moments(prototype=prototype)
>>> show(staff_group) 
>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.NumberedInterval
>>> expression = label().vertical_moments(prototype=prototype)
>>> expression(staff_group)
>>> show(staff_group) 

Labels interval-class numbers:

>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.NumberedIntervalClass
>>> label(staff_group).vertical_moments(prototype=prototype)
>>> show(staff_group) 
>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.NumberedIntervalClass
>>> expression = label().vertical_moments(prototype=prototype)
>>> expression(staff_group)
>>> show(staff_group) 

Labels interval-class vectors:

>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.IntervalClassVector
>>> label(staff_group).vertical_moments(prototype=prototype)
>>> show(staff_group) 
>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.IntervalClassVector
>>> expression = label().vertical_moments(prototype=prototype)
>>> expression(staff_group)
>>> show(staff_group) 

Labels set-classes:

>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.SetClass()
>>> label(staff_group).vertical_moments(prototype=prototype)
>>> show(staff_group) 
>>> staff_group = StaffGroup([])
>>> staff = Staff("c'8 d'4 e'16 f'16")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "alto" g4 f4""")
>>> staff_group.append(staff)
>>> staff = Staff(r"""\clef "bass" c,2""")
>>> staff_group.append(staff)
>>> prototype = pitchtools.SetClass()
>>> expression = label().vertical_moments(prototype=prototype)
>>> expression(staff_group)
>>> show(staff_group) 

Set prototype to one of the classes shown above.

Returns none.

LabelAgent.with_durations(direction=Up, preferred_denominator=None)

Labels logical ties with durations.

Labels logical tie durations:

>>> staff = Staff(r"c'4. d'8 ~ d'4. e'16 [ ef'16 ]")
>>> label(staff).with_durations()
>>> show(staff) 
>>> staff = Staff(r"c'4. d'8 ~ d'4. e'16 [ ef'16 ]")
>>> expression = label().with_durations()
>>> expression(staff)
>>> show(staff) 

Labels logical ties with preferred denominator:

>>> staff = Staff(r"c'4. d'8 ~ d'4. e'16 [ ef'16 ]")
>>> label(staff).with_durations(preferred_denominator=16)
>>> show(staff) 
>>> staff = Staff(r"c'4. d'8 ~ d'4. e'16 [ ef'16 ]")
>>> expression = label().with_durations(preferred_denominator=16)
>>> expression(staff)
>>> show(staff) 

Returns none.

LabelAgent.with_indices(direction=Up, prototype=None)

Labels logical ties with indices.

Labels logical tie indices:

>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> label(staff).with_indices()
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression = label().with_indices()
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 

Labels note indices:

>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> label(staff).with_indices(prototype=Note)
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression = label().with_indices(prototype=Note)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 

Labels chord indices:

>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> label(staff).with_indices(prototype=Chord)
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression = label().with_indices(prototype=Chord)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 

Labels leaf indices:

>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> label(staff).with_indices(prototype=scoretools.Leaf)
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 
>>> staff = Staff("<c' bf'>8 <g' a'>4 af'8 ~ af'8 gf'8 ~ gf'4")
>>> expression = label().with_indices(prototype=scoretools.Leaf)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 

Labels tuplet indices:

>>> staff = Staff(4 * Tuplet((2, 3), "c'8 [ d'8 e'8 ]"))
>>> label(staff).with_indices(prototype=Tuplet)
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 
>>> staff = Staff(4 * Tuplet((2, 3), "c'8 [ d'8 e'8 ]"))
>>> expression = label().with_indices(prototype=Tuplet)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 2
>>> show(staff) 

Returns none.

LabelAgent.with_intervals(direction=Up, prototype=None)

Labels consecutive notes with intervals.

Labels consecutive notes with interval names:

>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> label(staff).with_intervals(prototype=None)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 
>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> expression = label().with_intervals(prototype=None)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 

Labels consecutive notes with interval-class names:

>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> prototype = pitchtools.NamedIntervalClass
>>> label(staff).with_intervals(prototype=prototype)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 
>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> prototype = pitchtools.NamedIntervalClass
>>> expression = label().with_intervals(prototype=prototype)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 

Labels consecutive notes with interval numbers:

>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> prototype = pitchtools.NumberedInterval
>>> label(staff).with_intervals(prototype=prototype)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 
>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> prototype = pitchtools.NumberedInterval
>>> expression = label().with_intervals(prototype=prototype)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 

Labels consecutive notes with interval-class numbers:

>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> prototype = pitchtools.NumberedIntervalClass
>>> label(staff).with_intervals(prototype=prototype)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 
>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> prototype = pitchtools.NumberedIntervalClass
>>> expression = label().with_intervals(prototype=prototype)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 

Labels consecutive notes with inversion-equivalent interval-class numbers:

>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> prototype = pitchtools.NumberedInversionEquivalentIntervalClass
>>> label(staff).with_intervals(prototype=prototype)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 
>>> pitch_numbers = [0, 25, 11, -4, -14, -13, 9, 10]
>>> notes = scoretools.make_notes(pitch_numbers, [(1, 4)])
>>> staff = Staff(notes)
>>> prototype = pitchtools.NumberedInversionEquivalentIntervalClass
>>> expression = label().with_intervals(prototype=prototype)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 

Returns none.

LabelAgent.with_pitches(direction=Up, prototype=None)

Labels logical ties with pitches.

Labels logical ties with pitch names:

>>> staff = Staff("<a d' fs'>4 g'4 ~ g'8 r8 fs''4")
>>> label(staff).with_pitches(prototype=None)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 
>>> staff = Staff("<a d' fs'>4 g'4 ~ g'8 r8 fs''4")
>>> expression = label().with_pitches(prototype=None)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 

Labels logical ties with pitch numbers:

>>> staff = Staff("<a d' fs'>4 g'4 ~ g'8 r8 fs''4")
>>> prototype = pitchtools.NumberedPitch
>>> label(staff).with_pitches(prototype=prototype)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 
>>> staff = Staff("<a d' fs'>4 g'4 ~ g'8 r8 fs''4")
>>> prototype = pitchtools.NumberedPitch
>>> expression = label().with_pitches(prototype=prototype)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 

Labels logical ties with pitch-class numbers:

>>> staff = Staff("<a d' fs'>4 g'4 ~ g'8 r8 fs''4")
>>> prototype = pitchtools.NumberedPitchClass
>>> label(staff).with_pitches(prototype=prototype)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 
>>> staff = Staff("<a d' fs'>4 g'4 ~ g'8 r8 fs''4")
>>> prototype = pitchtools.NumberedPitchClass
>>> expression = label().with_pitches(prototype=prototype)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> show(staff) 

Labels logical ties with pitch names (filtered by selection):

>>> voice = Voice("df''4 c''4 f'4 fs'4 d''4 ds''4")
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:2], voice[-2:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> label(selections).with_pitches()
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 
>>> voice = Voice("df''4 c''4 f'4 fs'4 d''4 ds''4")
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:2], voice[-2:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> expression = label().with_pitches()
>>> expression(selections)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 

Labels logical ties with pitch numbers (filtered by selection):

>>> voice = Voice("df''4 c''4 f'4 fs'4 d''4 ds''4")
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:2], voice[-2:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> prototype = pitchtools.NumberedPitch
>>> label(selections).with_pitches(prototype=prototype)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 
>>> voice = Voice("df''4 c''4 f'4 fs'4 d''4 ds''4")
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:2], voice[-2:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> prototype = pitchtools.NumberedPitch
>>> expression = label().with_pitches(prototype=prototype)
>>> expression(selections)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 

Labels logical ties with pitch-class numbers (filtered by selection):

>>> voice = Voice("df''4 c''4 f'4 fs'4 d''4 ds''4")
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:2], voice[-2:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> prototype = pitchtools.NumberedPitchClass
>>> label(selections).with_pitches(prototype=prototype)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 
>>> voice = Voice("df''4 c''4 f'4 fs'4 d''4 ds''4")
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:2], voice[-2:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> prototype = pitchtools.NumberedPitchClass
>>> expression = label().with_pitches(prototype=prototype)
>>> expression(selections)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 

Returns none.

LabelAgent.with_set_classes(direction=Up, prototype=None)

Labels items in client with set-classes.

Labels selections with Forte-ranked transposition-inversion set-classes:

>>> string = "df''8 c''8 bf'8 a'8 f'4. fs'8 g'8 b'8 d''2."
>>> voice = Voice(string)
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:4], voice[-4:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> label(selections).with_set_classes()
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 
>>> string = "df''8 c''8 bf'8 a'8 f'4. fs'8 g'8 b'8 d''2."
>>> voice = Voice(string)
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:4], voice[-4:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> expression = label().with_set_classes()
>>> expression(selections)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 

Labels selections with lex-ranked transposition-inversion set-classes:

>>> string = "df''8 c''8 bf'8 a'8 f'4. fs'8 g'8 b'8 d''2."
>>> voice = Voice(string)
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:4], voice[-4:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> prototype = pitchtools.SetClass(lex_rank=True)
>>> label(selections).with_set_classes(prototype=prototype)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 
>>> string = "df''8 c''8 bf'8 a'8 f'4. fs'8 g'8 b'8 d''2."
>>> voice = Voice(string)
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:4], voice[-4:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> prototype = pitchtools.SetClass(lex_rank=True)
>>> expression = label().with_set_classes(prototype=prototype)
>>> expression(selections)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 

Labels selections with transposition-only set-classes:

>>> string = "df''8 c''8 bf'8 a'8 f'4. fs'8 g'8 b'8 d''2."
>>> voice = Voice(string)
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:4], voice[-4:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> prototype = pitchtools.SetClass(transposition_only=True)
>>> label(selections).with_set_classes(prototype=prototype)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 
>>> string = "df''8 c''8 bf'8 a'8 f'4. fs'8 g'8 b'8 d''2."
>>> voice = Voice(string)
>>> voice.consists_commands.append('Horizontal_bracket_engraver')
>>> selections = [voice[:4], voice[-4:]]
>>> for selection in selections:
...     spanner = spannertools.HorizontalBracketSpanner()
...     attach(spanner, selection)
... 
>>> prototype = pitchtools.SetClass(transposition_only=True)
>>> expression = label().with_set_classes(prototype=prototype)
>>> expression(selections)
>>> override(voice).horizontal_bracket.staff_padding = 3
>>> override(voice).text_script.staff_padding = 2
>>> show(voice) 

Returns none.

LabelAgent.with_start_offsets(clock_time=False, direction=Up, font_size=None)

Labels logical ties with start offsets.

Labels logical tie start offsets:

>>> staff = Staff(r"\times 2/3 { c'4 d'4 e'4 ~ } e'4 ef'4")
>>> label(staff).with_start_offsets(direction=Up)
>>> override(staff).text_script.staff_padding = 4
>>> override(staff).tuplet_bracket.staff_padding = 0
>>> show(staff) 
>>> staff = Staff(r"\times 2/3 { c'4 d'4 e'4 ~ } e'4 ef'4")
>>> expression = label().with_start_offsets(direction=Up)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> override(staff).tuplet_bracket.staff_padding = 0
>>> show(staff) 

Labels logical tie start offsets with clock time:

>>> staff = Staff(r"c'2 d' e' f'")
>>> score = Score([staff])
>>> attach(Tempo(Duration(1, 4), 60), staff[0])
>>> label(staff).with_start_offsets(clock_time=True)
>>> override(staff).text_script.staff_padding = 4
>>> override(staff).tuplet_bracket.staff_padding = 0
>>> show(score) 
>>> staff = Staff(r"c'2 d' e' f'")
>>> score = Score([staff])
>>> attach(Tempo(Duration(1, 4), 60), staff[0])
>>> expression = label().with_start_offsets(clock_time=True)
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> override(staff).tuplet_bracket.staff_padding = 0
>>> show(score) 

Labels logical tie start offsets with clock time and custom font size:

>>> staff = Staff(r"c'2 d' e' f'")
>>> score = Score([staff])
>>> attach(Tempo(Duration(1, 4), 60), staff[0])
>>> label(staff).with_start_offsets(
...     clock_time=True,
...     font_size=-3,
...     )
>>> override(staff).text_script.staff_padding = 4
>>> override(staff).tuplet_bracket.staff_padding = 0
>>> show(score) 
>>> staff = Staff(r"c'2 d' e' f'")
>>> score = Score([staff])
>>> attach(Tempo(Duration(1, 4), 60), staff[0])
>>> expression = label().with_start_offsets(
...     clock_time=True,
...     font_size=-3,
...     )
>>> expression(staff)
>>> override(staff).text_script.staff_padding = 4
>>> override(staff).tuplet_bracket.staff_padding = 0
>>> show(score) 

Returns none.

Special methods

(AbjadObject).__eq__(argument)

Is true when ID of argument equals ID of Abjad object. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(AbjadObject).__ne__(argument)

Is true when Abjad object does not equal argument. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.