Beam¶
-
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
-
(
AbjadObject
).__format__
(format_specification='')¶ Formats Abjad object.
Set
format_specification
to''
or'storage'
. Interprets''
equal to'storage'
.Returns string.
-
(
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
]
-
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
, …]
-
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
]
-