Score

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.core" { graph [label="abjad.core"]; node [color=1]; "abjad.core.Component.Component" [URL="../api/abjad/core/Component.html#abjad.core.Component.Component", label=Component, shape=oval, style=bold, target=_top]; "abjad.core.Container.Container" [URL="../api/abjad/core/Container.html#abjad.core.Container.Container", label=Container, target=_top]; "abjad.core.Context.Context" [URL="../api/abjad/core/Context.html#abjad.core.Context.Context", label=Context, target=_top]; "abjad.core.Score.Score" [URL="../api/abjad/core/Score.html#abjad.core.Score.Score", color=black, fontcolor=white, label=Score, target=_top]; "abjad.core.Component.Component" -> "abjad.core.Container.Container"; "abjad.core.Container.Container" -> "abjad.core.Context.Context"; "abjad.core.Context.Context" -> "abjad.core.Score.Score"; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/core/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadObject.AbjadObject" -> "abjad.core.Component.Component"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.core.Score.Score(components=None, lilypond_type='Score', is_simultaneous=True, name=None)

Score.

>>> staff_1 = abjad.Staff("c'8 d'8 e'8 f'8")
>>> staff_2 = abjad.Staff("c'8 d'8 e'8 f'8")
>>> score = abjad.Score([staff_1, staff_2])
>>> abjad.show(score) 

Attributes Summary

add_final_bar_line Add final bar line to end of score.
add_final_markup Adds markup to end of score.
make_piano_score Makes piano score from leaves.

Special methods

(Container).__contains__(argument)

Is true when argument appears in container.

Return type:bool
(Context).__copy__(*arguments)

Shallow copies context.

Copies indicators.

Does not copy spanners.

Does not copy children.

Returns new component.

(Container).__delitem__(i)

Deletes components(s) at index i in container.

Deletes first tuplet in voice:

>>> voice = abjad.Voice()
>>> voice.append(abjad.Tuplet((2, 3), "c'4 d'4 e'4"))
>>> voice.append(abjad.Tuplet((2, 3), "e'4 d'4 c'4"))
>>> leaves = abjad.select(voice).leaves()
>>> abjad.attach(abjad.Slur(), leaves)
>>> abjad.show(voice) 
>>> tuplet_1 = voice[0]
>>> del(voice[0])

First tuplet no longer appears in voice:

>>> abjad.show(voice) 
>>> abjad.inspect(voice).is_well_formed()
True

First tuplet is no longer slurred but is still well-formed:

>>> abjad.show(tuplet_1) 
>>> abjad.inspect(tuplet_1).is_well_formed()
True

Withdraws component(s) from crossing spanners.

Preserves spanners that component(s) cover(s).

Returns none.

(Component).__format__(format_specification='')

Formats component.

Returns string.

(Container).__getitem__(argument)

Gets item or slice identified by argument.

Traverses top-level items only.

Return type:Union[Component, Selection]
(Container).__graph__(spanner=None, **keywords)

Graphviz graph representation of container.

Returns Graphviz graph.

(Component).__illustrate__()

Illustrates component.

Returns LilyPond file.

(Container).__iter__()

Iterates container.

Abjad containers are iterables:

>>> import collections
>>> container = abjad.Container()
>>> isinstance(container, collections.Iterable)
True

Abjad containers are not sequences:

>>> import collections
>>> container = abjad.Container()
>>> isinstance(container, collections.Sequence)
False

Yields container elements.

Returns generator.

(Container).__len__()

Gets number of components in container.

Return type:int
(Component).__mul__(n)

Copies component n times and detaches spanners.

Returns list of new components.

(Context).__repr__()

Gets interpreter representation of context.

>>> context = abjad.Context(
...     name='MeterVoice',
...     lilypond_type='GlobalContext',
...     )
>>> repr(context)
"Context(lilypond_type='GlobalContext', name='MeterVoice')"

Returns string.

(Component).__rmul__(n)

Copies component n times and detach spanners.

Returns list of new components.

(Container).__setitem__(i, argument)

Sets container i equal to argument. Finds spanners that dominate self[i] and children of self[i]. Replaces contents at self[i] with ‘argument’. Reattaches spanners to new contents. Always leaves score tree in tact.

Return type:None

Methods

add_final_bar_line(abbreviation='|.', to_each_voice=False)

Add final bar line to end of score.

>>> staff = abjad.Staff("c'4 d'4 e'4 f'4")
>>> score = abjad.Score([staff])
>>> abjad.show(score) 
>>> bar_line = score.add_final_bar_line()
>>> abjad.show(score) 

Set to_each_voice to true to make part extraction easier.

Returns bar line.

add_final_markup(markup, extra_offset=None)

Adds markup to end of score.

Adds markup to last leaf:

>>> staff = abjad.Staff("c'4 d'4 e'4 f'4")
>>> score = abjad.Score([staff])
>>> place = abjad.Markup('Bremen - Boston - LA.', direction=abjad.Down)
>>> date = abjad.Markup('July 2010 - May 2011.')
>>> markup = abjad.Markup.right_column([place, date], direction=abjad.Down)
>>> markup = markup.italic()
>>> markup = score.add_final_markup(
...     markup,
...     extra_offset=(0.5, -2),
...     )
>>> abjad.show(staff) 

Adds markup to last multimeasure rest:

>>> staff = abjad.Staff("c'4 d'4 e'4 f'4")
>>> staff.append(abjad.MultimeasureRest((4, 4)))
>>> score = abjad.Score([staff])
>>> place = abjad.Markup(
...     'Bremen - Boston - LA.',
...     direction=abjad.Down,
...     )
>>> date = abjad.Markup('July 2010 - May 2011.')
>>> markup = abjad.Markup.right_column(
...     [place, date],
...     direction=abjad.Down,
...     )
>>> markup = markup.italic()
>>> markup = score.add_final_markup(
...     markup,
...     extra_offset=(14.5, -2),
...     )
>>> abjad.show(staff) 

Returns none.

(Container).append(component)

Appends component to container.

Appends note to container:

>>> container = abjad.Container("c'4 ( d'4 f'4 )")
>>> abjad.show(container) 
>>> container.append(abjad.Note("e'4"))
>>> abjad.show(container) 
Return type:None
(Container).extend(argument)

Extends container with argument.

Extends container with three notes:

>>> container = abjad.Container("c'4 ( d'4 f'4 )")
>>> abjad.show(container) 
>>> notes = [abjad.Note("e'32"), abjad.Note("d'32"), abjad.Note("e'16")]
>>> container.extend(notes)
>>> abjad.show(container) 
Return type:None
(Container).index(component)

Returns index of component in container.

Gets index of last element in container:

>>> container = abjad.Container("c'4 d'4 f'4 e'4")
>>> abjad.show(container) 
>>> note = container[-1]
>>> note
Note("e'4")
>>> container.index(note)
3
Return type:int
(Container).insert(i, component, fracture_spanners=False)

Inserts component at index i in container.

Inserts note. Does not fracture spanners:

>>> container = abjad.Container([])
>>> container.extend("fs16 cs' e' a'")
>>> container.extend("cs''16 e'' cs'' a'")
>>> container.extend("fs'16 e' cs' fs")
>>> slur = abjad.Slur(direction=abjad.Down)
>>> abjad.attach(slur, container[:])
>>> abjad.show(container) 
>>> container.insert(-4, abjad.Note("e'4"), fracture_spanners=False)
>>> abjad.show(container) 

Inserts note. Fractures spanners:

>>> container = abjad.Container([])
>>> container.extend("fs16 cs' e' a'")
>>> container.extend("cs''16 e'' cs'' a'")
>>> container.extend("fs'16 e' cs' fs")
>>> slur = abjad.Slur(direction=abjad.Down)
>>> abjad.attach(slur, container[:])
>>> abjad.show(container) 
>>> container.insert(-4, abjad.Note("e'4"), fracture_spanners=True)
>>> abjad.show(container) 
Return type:None
(Container).pop(i=-1)

Pops component from container at index i.

Pops last element from container:

>>> container = abjad.Container("c'4 ( d'4 f'4 ) e'4")
>>> abjad.show(container) 
>>> container.pop()
Note("e'4")
>>> abjad.show(container) 

Returns component.

(Container).remove(component)

Removes component from container.

Removes note from container:

>>> container = abjad.Container("c'4 ( d'4 f'4 ) e'4")
>>> abjad.show(container) 
>>> note = container[2]
>>> note
Note("f'4")
>>> container.remove(note)
>>> abjad.show(container) 
Return type:None

Class & static methods

static make_piano_score(leaves=None, lowest_treble_pitch='B3', sketch=False)

Makes piano score from leaves.

Makes empty piano score:

>>> result = abjad.Score.make_piano_score()
>>> abjad.f(result[0])
\new Score
<<
    \new PianoStaff
    <<
        \context Staff = "Treble Staff"
        {
        }
        \context Staff = "Bass Staff"
        {
        }
    >>
>>

Makes piano score from leaves:

>>> notes = [abjad.Note(x, (1, 4)) for x in [-12, 37, -10, 2, 4, 17]]
>>> result = abjad.Score.make_piano_score(leaves=notes)
>>> abjad.show(result[0]) 

Makes piano sketch score from leaves:

>>> maker = abjad.NoteMaker()
>>> notes = maker(
...     [-12, -10, -8, -7, -5, 0, 2, 4, 5, 7],
...     [(1, 16)],
...     )
>>> result = abjad.Score.make_piano_score(
...     leaves=notes,
...     sketch=True,
...     )
>>> abjad.show(result[0]) 

Returns score, treble staff, bass staff triple.


Read/write properties

(Container).identifier

Gets and sets bracket comment.

>>> container = abjad.Container(
...     "c'4 d'4 e'4 f'4",
...     identifier='%*% AB',
...     )
>>> abjad.show(container) 
>>> abjad.f(container)
{   %*% AB
    c'4
    d'4
    e'4
    f'4
}   %*% AB
Return type:Optional[str]
(Container).is_simultaneous

Is true when container is simultaneous.

Gets simultaneity status of container:

>>> container = abjad.Container()
>>> container.append(abjad.Voice("c'8 d'8 e'8"))
>>> container.append(abjad.Voice('g4.'))
>>> abjad.show(container) 
>>> container.is_simultaneous is None
True

Sets simultaneity status of container:

>>> container = abjad.Container()
>>> container.append(abjad.Voice("c'8 d'8 e'8"))
>>> container.append(abjad.Voice('g4.'))
>>> abjad.show(container) 
>>> container.is_simultaneous = True
>>> abjad.show(container) 
Return type:Optional[bool]
(Context).lilypond_type

Gets lilypond type.

>>> context = abjad.Context(
...     lilypond_type='ViolinStaff',
...     name='MyViolinStaff',
...     )
>>> context.lilypond_type
'ViolinStaff'

Gets and sets lilypond type of context.

Returns string.

(Container).name

Gets and sets name of container.

Gets container name:

>>> container = abjad.Container("c'4 d'4 e'4 f'4")
>>> abjad.show(container) 
>>> container.name is None
True

Sets container name:

>>> container = abjad.Container(
...     "c'4 d'4 e'4 f'4",
...     name='Special',
...     )
>>> abjad.show(container) 
>>> container.name
'Special'

Container name does not appear in LilyPond output:

>>> abjad.f(container)
{
    c'4
    d'4
    e'4
    f'4
}
Return type:Optional[str]

Read-only properties

(Container).components

Gets components in container.

Return type:tuple
(Context).consists_commands

Unordered set of LilyPond engravers to include in context definition.

Manage with add, update, other standard set commands:

>>> staff = abjad.Staff([])
>>> staff.consists_commands.append('Horizontal_bracket_engraver')
>>> abjad.f(staff)
\new Staff
\with
{
    \consists Horizontal_bracket_engraver
}
{
}
(Context).lilypond_context

Gets LilyPondContext associated with context.

Returns LilyPond context instance.

(Context).remove_commands

Unordered set of LilyPond engravers to remove from context.

Manage with add, update, other standard set commands:

>>> staff = abjad.Staff([])
>>> staff.remove_commands.append('Time_signature_engraver')
>>> abjad.f(staff)
\new Staff
\with
{
    \remove Time_signature_engraver
}
{
}