Beam

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.spanners" { graph [label="abjad.spanners"]; node [color=1]; "abjad.spanners.Beam.Beam" [URL="../api/abjad/spanners/Beam.html#abjad.spanners.Beam.Beam", color=black, fontcolor=white, label=Beam, target=_top]; "abjad.spanners.Spanner.Spanner" [URL="../api/abjad/spanners/Spanner.html#abjad.spanners.Spanner.Spanner", label=Spanner, target=_top]; "abjad.spanners.Spanner.Spanner" -> "abjad.spanners.Beam.Beam"; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/spanners/../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.spanners.Spanner.Spanner"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.spanners.Beam.Beam(*, beam_lone_notes=None, beam_rests=None, direction=None, durations=None, span_beam_count=1, stemlet_length=None)

Beam.

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8 g'2")
>>> abjad.setting(staff).auto_beaming = False
>>> abjad.show(staff) 
>>> beam = abjad.Beam()
>>> abjad.attach(beam, staff[:2])
>>> beam = abjad.Beam()
>>> abjad.attach(beam, staff[2:4])
>>> abjad.show(staff) 

Tweaks beam positions:

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8 g'2")
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam()
>>> abjad.tweak(beam).positions = (3, 3)
>>> abjad.attach(beam, staff[:2])
>>> beam = abjad.Beam()
>>> abjad.tweak(beam).positions = (3, 3)
>>> abjad.attach(beam, staff[2:4])
>>> abjad.show(staff) 

Spanners can be tagged:

>>> staff = abjad.Staff("c'8 d'8 e'8 f'8 g'2")
>>> abjad.setting(staff).auto_beaming = False
>>> abjad.show(staff) 
>>> beam = abjad.Beam()
>>> abjad.attach(beam, staff[:2], tag='BEAM')
>>> beam = abjad.Beam()
>>> abjad.attach(beam, staff[2:4])
>>> abjad.show(staff) 
>>> abjad.f(staff)
\new Staff
\with
{
    autoBeaming = ##f
}
{
    c'8
    [ %! BEAM
    d'8
    ] %! BEAM
    e'8
    [
    f'8
    ]
    g'2
}

Attributes Summary

beam_lone_notes Is true when beam should include lone notes.
beam_rests Is true when beam should include rests.
direction Gets direction.
durations Gets durations.
span_beam_count Gets span beam count.
stemlet_length Gets stemlet length.

Special methods

(Spanner).__contains__(argument)

Is true when spanner contains argument.

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

Copies spanner.

Does not copy spanner leaves.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

(Spanner).__getitem__(argument)

Gets leaf or selection identified by argument.

Return type:Union[Leaf, Selection]
(Spanner).__iter__()

Iterates leaves in spanner.

Return type:Iterator[+T_co]
(Spanner).__len__()

Gets number of leaves in spanner.

Return type:int
(Spanner).__lt__(argument)

Is true when spanner is less than argument.

Trivial comparison to allow doctests to work.

Return type:bool
(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.


Read-only properties

beam_lone_notes

Is true when beam should include lone notes.

Todo

Teach durated beams to respect beam_lone_notes.

Does not beam lone notes:

>>> staff = abjad.Staff("c'8 d' e' f'")
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam()
>>> abjad.attach(beam, staff[:1])
>>> abjad.show(staff) 
>>> staff = abjad.Staff("c'8 d'4 e'8 f'4 g'8")
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam()
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 

Does beam lone notes:

>>> staff = abjad.Staff("c'8 d' e' f'")
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam(beam_lone_notes=True)
>>> abjad.attach(beam, staff[:1])
>>> abjad.show(staff) 
>>> staff = abjad.Staff("c'8 d'4 e'8 f'4 g'8")
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam(beam_lone_notes=True)
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 
Return type:Optional[bool]
beam_rests

Is true when beam should include rests.

Without beamed rests:

>>> staff = abjad.Staff("c'8 d'8 r8 f'8 g'8 r4.")
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam()
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 
>>> abjad.f(staff)
\new Staff
\with
{
    autoBeaming = ##f
}
{
    c'8
    [
    d'8
    ]
    r8
    f'8
    [
    g'8
    ]
    r4.
}

Abjad beams no rests.

LilyPond beams no rests.

With beamed rests:

>>> staff = abjad.Staff("c'8 d'8 r8 f'8 g'8 r4.")
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam(beam_rests=True)
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 
>>> abjad.f(staff)
\new Staff
\with
{
    autoBeaming = ##f
}
{
    c'8
    [
    d'8
    r8
    f'8
    g'8
    r4.
    ]
}

Abjad beams all rests.

LilyPond beams only small-duration rests.

With beamed rests:

>>> staff = abjad.Staff("c'8 d'8 r4. f'8 g'8 r8")
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam(beam_rests=True)
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 
>>> abjad.f(staff)
\new Staff
\with
{
    autoBeaming = ##f
}
{
    c'8
    [
    d'8
    r4.
    f'8
    g'8
    r8
    ]
}

Abjad beams all rests.

LilyPond beams only small-duration rests.

With beamed skips:

>>> staff = abjad.Staff("c'8 d'8 s4. f'8 g'8 s8")
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam(beam_rests=True)
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 
>>> abjad.f(staff)
\new Staff
\with
{
    autoBeaming = ##f
}
{
    c'8
    [
    d'8
    s4.
    f'8
    g'8
    s8
    ]
}

Abjad beams all skips.

LilyPond beams all (internal) skips.

Return type:Optional[bool]
direction

Gets direction.

Return type:Optional[String]
durations

Gets durations.

Two groups:

>>> staff = abjad.Staff("c'16 d'16 e'16 f'16")
>>> durations = [(1, 8), (1, 8)]
>>> beam = abjad.Beam(durations=durations)
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 
>>> beam.durations
(Duration(1, 8), Duration(1, 8))

Three groups:

>>> staff = abjad.Staff("c'16 d'16 e'8 f'16 c'16")
>>> abjad.setting(staff).auto_beaming = False
>>> durations = [(1, 8), (1, 8), (1, 8)]
>>> beam = abjad.Beam(
...     durations=durations,
...     span_beam_count=1,
...     )
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 

Test ensures that leaf groups format correctly when they contain only one leaf.

Return type:Tuple[Duration, …]
(Spanner).leaves

Gets leaves in spanner.

Return type:Selection
span_beam_count

Gets span beam count.

Creates a single span beam between adjacent groups in spanner:

>>> staff = abjad.Staff("c'32 d'32 e'32 f'32")
>>> durations = [(1, 16), (1, 16)]
>>> beam = abjad.Beam(
...     durations=durations,
...     span_beam_count=1,
...     )
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 
>>> beam.span_beam_count
1

Creates a double span beam between adjacent groups in spanner:

>>> staff = abjad.Staff("c'32 d'32 e'32 f'32")
>>> durations = [(1, 16), (1, 16)]
>>> beam = abjad.Beam(
...     durations=durations,
...     span_beam_count=2,
...     )
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 
>>> beam.span_beam_count
2

Creates no span beam between adjacent groups in spanner:

>>> staff = abjad.Staff("c'32 d'32 e'32 f'32")
>>> durations = [(1, 16), (1, 16)]
>>> beam = abjad.Beam(
...     durations=durations,
...     span_beam_count=0,
...     )
>>> abjad.attach(beam, staff[:])
>>> abjad.show(staff) 
>>> beam.span_beam_count
0
Return type:int
stemlet_length

Gets stemlet length.

>>> staff = abjad.Staff(
...     "r8 c' r c' g'2",
...     lilypond_type='RhythmicStaff',
...     )
>>> abjad.setting(staff).auto_beaming = False
>>> beam = abjad.Beam(beam_rests=True, stemlet_length=2)
>>> abjad.attach(beam, staff[:-1])
>>> abjad.show(staff) 
Return type:Union[int, float, None]
(Spanner).tweaks

Gets tweaks.

Return type:Optional[LilyPondTweakManager]