AfterGraceContainer

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.AfterGraceContainer.AfterGraceContainer" [URL="../api/abjad/core/AfterGraceContainer.html#abjad.core.AfterGraceContainer.AfterGraceContainer", color=black, fontcolor=white, label="After\nGrace\nContainer", target=_top]; "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.Component.Component" -> "abjad.core.Container.Container"; "abjad.core.Container.Container" -> "abjad.core.AfterGraceContainer.AfterGraceContainer"; } 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.AfterGraceContainer.AfterGraceContainer(components=None)

After grace container.

After grace notes:

>>> voice = abjad.Voice("c'4 d'4 e'4 f'4")
>>> string = '#(define afterGraceFraction (cons 15 16))'
>>> literal = abjad.LilyPondLiteral(string)
>>> abjad.attach(literal, voice[0])
>>> notes = [abjad.Note("c'16"), abjad.Note("d'16")]
>>> after_grace_container = abjad.AfterGraceContainer(notes)
>>> abjad.attach(after_grace_container, voice[1])
>>> abjad.show(voice) 

LilyPond positions after grace notes at a point 3/4 of the way after the note they follow. The resulting spacing is usually too loose.

Customize aftterGraceFraction as shown above.

After grace notes are played at the very end of the note they follow.

Use after grace notes when you need to end a piece of music with grace notes.

After grace notes do not subclass grace notes; but acciacatura containers and appoggiatura containers do subclass grace notes.

Fill grace containers with notes, rests or chords.

Attach after grace containers to notes, rests or chords.


Special methods

(Container).__contains__(argument)

Is true when argument appears in container.

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

Shallow copies component.

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.

(Component).__repr__()

Gets interpreter representation of leaf.

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

(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

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]
(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