Tie

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.Spanner.Spanner" [URL="../api/abjad/spanners/Spanner.html#abjad.spanners.Spanner.Spanner", label=Spanner, target=_top]; "abjad.spanners.Tie.Tie" [URL="../api/abjad/spanners/Tie.html#abjad.spanners.Tie.Tie", color=black, fontcolor=white, label=Tie, target=_top]; "abjad.spanners.Spanner.Spanner" -> "abjad.spanners.Tie.Tie"; } 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.Tie.Tie(*, direction=None, left_broken=None, repeat=None, right_broken=None)

Tie.

Ties four notes:

>>> staff = abjad.Staff("c'4 c' c' c'")
>>> abjad.attach(abjad.Tie(), staff[:])
>>> abjad.show(staff) 

Removes any existing ties before attaching new tie:

>>> staff = abjad.Staff("c'4 ~ c' ~ c' ~ c'")
>>> abjad.attach(abjad.Tie(), staff[:])
>>> abjad.show(staff) 

Ties consecutive chords if all adjacent pairs have at least one pitch in common:

>>> staff = abjad.Staff("<c'>4 <c' d'>4 <d'>4")
>>> abjad.attach(abjad.Tie(), staff[:])
>>> abjad.show(staff) 

Enharmonics are allowed:

>>> staff = abjad.Staff("c'4 bs c' dff'")
>>> abjad.attach(abjad.Tie(), staff[:])
>>> abjad.show(staff) 

Raises exception when pitches do not equal each other:

>>> staff = abjad.Staff("c'4 d' e'8 ~ e'8 r4")
>>> abjad.attach(abjad.Tie(), staff[:2])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/top/attach.py", line 243, in attach
    raise Exception(message)
Exception: Tie()._attachment_test_all():
  Pitch {0} does not equal pitch {2}.

Raises exception on nonnote, nonchord leaves:

>>> staff = abjad.Staff("c'4 d' e'8 ~ e'8 r4")
>>> abjad.attach(abjad.Tie(), staff[-2:])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/josiah/Source/github.com/Abjad/abjad/abjad/top/attach.py", line 243, in attach
    raise Exception(message)
Exception: Tie()._attachment_test_all():
  Can only tie notes and chords.
  Not Rest('r4').

Detaches existing ties before attach:

>>> staff = abjad.Staff("c'4 d' e'8 ~ e'8 r4")
>>> abjad.attach(abjad.Tie(), staff[2:4])
>>> abjad.show(staff) 

Attributes Summary

cross_segment_examples Cross-segment examples.
direction Gets direction.
left_broken Is true when spanner is left-broken.
repeat Gets repeat-tie threshold.
right_broken Is true when spanner is right-broken.

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

cross_segment_examples

Cross-segment examples.

[Tie] cross-segment example #1 (one-to-one):

>>> segment_1 = abjad.Voice("c'4 d' f' f'", name='MainVoice')
>>> tie = abjad.Tie(right_broken=True)
>>> abjad.attach(tie, segment_1[-1:])
>>> abjad.show(segment_1, strict=50) 
>>> segment_2 = abjad.Voice("f'4 f' d' c'", name='MainVoice')
>>> abjad.show(segment_2, strict=50) 
>>> container = abjad.Container([segment_1, segment_2])
>>> text = format(container, 'lilypond')
>>> text = abjad.LilyPondFormatManager.left_shift_tags(text, 50)
>>> job = abjad.Job.join_broken_spanners(text)
>>> text = job()
>>> lines = text.split('\n')
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

[Tie] cross-segment example #2 (one-to-many):

>>> segment_1 = abjad.Voice("c'4 d' f' f'", name='MainVoice')
>>> tie = abjad.Tie(right_broken=True)
>>> abjad.attach(tie, segment_1[-1:])
>>> abjad.show(segment_1, strict=50) 
>>> segment_2 = abjad.Voice("f'4 f' d' c'", name='MainVoice')
>>> abjad.attach(abjad.Tie(), segment_2[:2])
>>> abjad.show(segment_2, strict=50) 
>>> container = abjad.Container([segment_1, segment_2])
>>> text = format(container, 'lilypond')
>>> text = abjad.LilyPondFormatManager.left_shift_tags(text, 50)
>>> job = abjad.Job.join_broken_spanners(text)
>>> text = job()
>>> lines = text.split('\n')
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

[Tie] cross-segment example #3 (many-to-one):

>>> segment_1 = abjad.Voice("c'4 d' f' f'", name='MainVoice')
>>> tie = abjad.Tie(right_broken=True)
>>> abjad.attach(tie, segment_1[-2:])
>>> abjad.show(segment_1, strict=50) 
>>> segment_2 = abjad.Voice("f'4 f' d' c'", name='MainVoice')
>>> abjad.show(segment_2, strict=50) 
>>> container = abjad.Container([segment_1, segment_2])
>>> text = format(container, 'lilypond')
>>> text = abjad.LilyPondFormatManager.left_shift_tags(text, 50)
>>> job = abjad.Job.join_broken_spanners(text)
>>> text = job()
>>> lines = text.split('\n')
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

[Tie] cross-segment example #4 (many-to-many):

>>> segment_1 = abjad.Voice("c'4 d' f' f'", name='MainVoice')
>>> tie = abjad.Tie(right_broken=True)
>>> abjad.attach(tie, segment_1[-2:])
>>> abjad.show(segment_1, strict=50) 
>>> segment_2 = abjad.Voice("f'4 f' d' c'", name='MainVoice')
>>> abjad.attach(abjad.Tie(), segment_2[:2])
>>> container = abjad.Container([segment_1, segment_2])
>>> text = format(container, 'lilypond')
>>> text = abjad.LilyPondFormatManager.left_shift_tags(text, 50)
>>> job = abjad.Job.join_broken_spanners(text)
>>> text = job()
>>> lines = text.split('\n')
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

[Repeat tie] cross-segment example #1 (one-to-one):

>>> segment_1 = abjad.Voice("c'4 d' f' f'", name='MainVoice')
>>> abjad.show(segment_1, strict=50) 
>>> segment_2 = abjad.Voice("f'4 f' d' c'", name='MainVoice')
>>> repeat_tie = abjad.Tie(repeat=True, left_broken=True)
>>> abjad.attach(repeat_tie, segment_2[:1])
>>> abjad.show(segment_2, strict=50) 
>>> container = abjad.Container([segment_1, segment_2])
>>> text = format(container, 'lilypond')
>>> text = abjad.LilyPondFormatManager.left_shift_tags(text, 50)
>>> job = abjad.Job.join_broken_spanners(text)
>>> text = job()
>>> lines = text.split('\n')
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

[Repeat tie] cross-segment example #2 (one-to-many):

>>> segment_1 = abjad.Voice("c'4 d' f' f'", name='MainVoice')
>>> abjad.show(segment_1, strict=50) 
>>> segment_2 = abjad.Voice("f'4 f' d' c'", name='MainVoice')
>>> repeat_tie = abjad.Tie(left_broken=True, repeat=True)
>>> abjad.attach(repeat_tie, segment_2[:2])
>>> abjad.show(segment_2, strict=50) 
>>> container = abjad.Container([segment_1, segment_2])
>>> text = format(container, 'lilypond')
>>> text = abjad.LilyPondFormatManager.left_shift_tags(text, 50)
>>> job = abjad.Job.join_broken_spanners(text)
>>> text = job()
>>> lines = text.split('\n')
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

[Repeat tie] cross-segment example #3 (many-to-one):

>>> segment_1 = abjad.Voice("c'4 d' f' f'", name='MainVoice')
>>> repeat_tie = abjad.Tie(repeat=True)
>>> abjad.attach(repeat_tie, segment_1[-2:])
>>> abjad.show(segment_1, strict=50) 
>>> segment_2 = abjad.Voice("f'4 f' d' c'", name='MainVoice')
>>> repeat_tie = abjad.Tie(left_broken=True, repeat=True)
>>> abjad.attach(repeat_tie, segment_2[:1])
>>> abjad.show(segment_2, strict=50) 
>>> container = abjad.Container([segment_1, segment_2])
>>> text = format(container, 'lilypond')
>>> text = abjad.LilyPondFormatManager.left_shift_tags(text, 50)
>>> job = abjad.Job.join_broken_spanners(text)
>>> text = job()
>>> lines = text.split('\n')
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 

[Repeat tie] cross-segment example #4 (many-to-many):

>>> segment_1 = abjad.Voice("c'4 d' f' f'", name='MainVoice')
>>> repeat_tie = abjad.Tie(repeat=True)
>>> abjad.attach(repeat_tie, segment_1[-2:])
>>> abjad.show(segment_1, strict=50) 
>>> segment_2 = abjad.Voice("f'4 f' d' c'", name='MainVoice')
>>> repeat_tie = abjad.Tie(left_broken=True, repeat=True)
>>> abjad.attach(repeat_tie, segment_2[:2])
>>> container = abjad.Container([segment_1, segment_2])
>>> text = format(container, 'lilypond')
>>> text = abjad.LilyPondFormatManager.left_shift_tags(text, 50)
>>> job = abjad.Job.join_broken_spanners(text)
>>> text = job()
>>> lines = text.split('\n')
>>> lilypond_file = abjad.LilyPondFile.new(lines)
>>> abjad.show(lilypond_file) 
direction

Gets direction.

Forces ties up:

>>> staff = abjad.Staff("c'8 c'8 c'8 c'8")
>>> tie = abjad.Tie(direction=abjad.Up)
>>> abjad.attach(tie, staff[:])
>>> abjad.show(staff) 
>>> tie.direction
'^'

Forces ties down:

>>> staff = abjad.Staff("c'8 c'8 c'8 c'8")
>>> tie = abjad.Tie(direction=abjad.Down)
>>> abjad.attach(tie, staff[:])
>>> abjad.show(staff) 
>>> tie.direction
'_'

Positions ties according to LilyPond defaults:

>>> staff = abjad.Staff("c'8 c'8 c'8 c'8")
>>> tie = abjad.Tie(direction=None)
>>> abjad.attach(tie, staff[:])
>>> abjad.show(staff) 
>>> tie.direction is None
True
Return type:Optional[String]
(Spanner).leaves

Gets leaves in spanner.

Return type:Selection
left_broken

Is true when spanner is left-broken.

Return type:Optional[bool]
repeat

Gets repeat-tie threshold.

Formats all ties as repeat-ties when repeat is true:

>>> staff = abjad.Staff("c'2 c'8 c'4.")
>>> tie = abjad.Tie(repeat=True)
>>> abjad.attach(tie, staff[:])
>>> abjad.show(staff) 

Formats only ties that satisfy duration inequality when repeat is a duration inequality:

>>> staff = abjad.Staff("c'2 c'8 c'4.")
>>> repeat = abjad.DurationInequality(
...     operator_string='>=',
...     duration=abjad.Duration(1, 4),
...     )
>>> tie = abjad.Tie(repeat=repeat)
>>> abjad.attach(tie, staff[:])
>>> abjad.show(staff) 

Coerces integer pair to >= inequality:

>>> staff = abjad.Staff("c'2 c'8 c'4.")
>>> tie = abjad.Tie(repeat=(1, 4))
>>> abjad.attach(tie, staff[:])
>>> abjad.show(staff) 

Durations that satisfy inequality can be said to “meet repeat-tie threshold.” Durations that do not meet repeat-tie threshold format conventional tie on current note; durations that do meet repeat-tie threshold format repeat-tie on following note.

LILYPOND FIX. Automatically tweaks repeat tie direction up when repeat tie connects to long-duration note at staff position zero:

>>> tie = abjad.Tie(repeat=True)
>>> staff = abjad.Staff(r"b'4 b'4 b'2 b'1 b'\breve")
>>> abjad.attach(abjad.TimeSignature((8, 4)), staff[-1])
>>> abjad.attach(tie, staff[:])
>>> abjad.show(staff) 

Without this fix, LilyPond incorrectly down-renders the last two repeat-ties in the example above.

Return type:Union[bool, DurationInequality, Tuple[int, int], None]
right_broken

Is true when spanner is right-broken.

Return type:Optional[bool]
(Spanner).tweaks

Gets tweaks.

Return type:Optional[LilyPondTweakManager]