Tie

class spannertools.Tie(direction=None, overrides=None, use_messiaen_style_ties=None)

Tie.

Example 1. Ties four notes:

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

Example 2. Fails attachment test when pitches differ:

>>> staff = Staff("c'4 d' e' f'")
>>> attach(Tie(), staff[:])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/joberholtzer/Development/abjad/abjad/tools/topleveltools/attach.py", line 29, in attach
    raise Exception(message)
Exception: Tie() attachment test fails for Selection([Note("c'4"), Note("d'4"), Note("e'4"), Note("f'4")]).
>>> 

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

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

Formats LilyPond ~ command on nonlast leaves in spanner.

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_abctools { graph [label=abctools]; "abjad.tools.abctools.AbjadObject.AbjadObject" [color=1, group=0, label=AbjadObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" [color=1, group=0, label=AbstractBase, shape=box]; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_spannertools { graph [label=spannertools]; "abjad.tools.spannertools.Spanner.Spanner" [color=3, group=2, label=Spanner, shape=box]; "abjad.tools.spannertools.Tie.Tie" [color=black, fontcolor=white, group=2, label=<<B>Tie</B>>, shape=box, style="filled, rounded"]; "abjad.tools.spannertools.Spanner.Spanner" -> "abjad.tools.spannertools.Tie.Tie"; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.spannertools.Spanner.Spanner"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

components Gets components in spanner.
direction Gets direction.
name Gets spanner name.
overrides Gets overrides.
use_messiaen_style_ties Is true when tie should use Messiaen-style ties with the LilyPond \repeatTie command.
__contains__(expr) Is true when spanner contains expr.
__copy__(\*args) Copies spanner.
__eq__(expr) Is true when ID of expr equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__getitem__(expr) Gets item from spanner.
__hash__() Hashes Abjad object.
__len__() Gets number of components in spanner.
__lt__(expr) Is true when spanner is less than expr.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

(Spanner).components

Gets components in spanner.

Returns selection.

Tie.direction

Gets direction.

Forces ties up:

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

Forces ties down:

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

Positions ties according to LilyPond defaults:

>>> staff = Staff("c'8 c'8 c'8 c'8")
>>> tie = Tie(direction=None)
>>> attach(tie, staff[:])
>>> show(staff) 
>>> tie.direction is None
True

Defaults to none.

Set to up, down or none.

Returns up, down or none.

(Spanner).name

Gets spanner name.

Returns string.

(Spanner).overrides

Gets overrides.

Returns dict.

Tie.use_messiaen_style_ties

Is true when tie should use Messiaen-style ties with the LilyPond \repeatTie command.

Example 1. Default values for Messiaen-style ties:

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

LilyPond’s repeat ties are shorter Messiaen-style ties.

Returns true, false or none.

Special methods

(Spanner).__contains__(expr)

Is true when spanner contains expr. Otherwise false.

Returns true or false.

(Spanner).__copy__(*args)

Copies spanner.

Does not copy spanner components.

Returns new spanner.

(AbjadObject).__eq__(expr)

Is true when ID of expr equals ID of Abjad object. Otherwise false.

Returns true or false.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(Spanner).__getitem__(expr)

Gets item from spanner.

Returns component.

(AbjadObject).__hash__()

Hashes Abjad object.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

(Spanner).__len__()

Gets number of components in spanner.

Returns nonnegative integer.

(Spanner).__lt__(expr)

Is true when spanner is less than expr. Otherwise false.

Trivial comparison to allow doctests to work.

Returns true or false.

(AbjadObject).__ne__(expr)

Is true when Abjad object does not equal expr. Otherwise false.

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.