Hairpin

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.Hairpin.Hairpin" [URL="../api/abjad/spanners/Hairpin.html#abjad.spanners.Hairpin.Hairpin", color=black, fontcolor=white, label=Hairpin, 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.Hairpin.Hairpin"; } 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"; }


Classes

Hairpin Hairpin.
class abjad.spanners.Hairpin.Hairpin(descriptor=None, *, direction=None)

Hairpin.

Note

abjad.Hairpin is deprecated. Use the abjad.hairpin() factory function instead.

Crescendo:

>>> voice = abjad.Voice("r8 d' e' f' g' a' b' r")
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, voice[1:-1])
>>> abjad.show(voice) 
>>> for leaf in abjad.select(voice).leaves():
...     leaf, abjad.inspect(leaf).effective(abjad.Dynamic)
... 
(Rest('r8'), None)
(Note("d'8"), None)
(Note("e'8"), None)
(Note("f'8"), None)
(Note("g'8"), None)
(Note("a'8"), None)
(Note("b'8"), None)
(Rest('r8'), None)

Decrescendo:

>>> voice = abjad.Voice("r8 d' e' f' g' a' b' r")
>>> hairpin = abjad.Hairpin('f > p')
>>> abjad.attach(hairpin, voice[1:-1])
>>> abjad.show(voice) 
>>> for leaf in abjad.select(voice).leaves():
...     leaf, abjad.inspect(leaf).effective(abjad.Dynamic)
... 
(Rest('r8'), None)
(Note("d'8"), None)
(Note("e'8"), None)
(Note("f'8"), None)
(Note("g'8"), None)
(Note("a'8"), None)
(Note("b'8"), None)
(Rest('r8'), None)

Decrescendo al niente:

>>> voice = abjad.Voice("c'2. r4")
>>> hairpin = abjad.Hairpin('f > niente')
>>> abjad.attach(hairpin, voice[:])
>>> abjad.show(voice) 
>>> for leaf in abjad.select(voice).leaves():
...     leaf, abjad.inspect(leaf).effective(abjad.Dynamic)
... 
(Note("c'2."), None)
(Rest('r4'), None)

Multiple hairpins enchained with dynamics:

>>> voice = abjad.Voice("c'8 d' e' f' c' d' e' f' c'")
>>> abjad.attach(abjad.Dynamic('p'), voice[0])
>>> abjad.attach(abjad.Hairpin('<'), voice[:3])
>>> abjad.attach(abjad.Dynamic('f'), voice[2])
>>> abjad.attach(abjad.Hairpin('>'), voice[2:5])
>>> abjad.attach(abjad.Dynamic('p'), voice[4])
>>> abjad.attach(abjad.Hairpin('<'), voice[4:7])
>>> abjad.attach(abjad.Dynamic('f'), voice[6])
>>> abjad.attach(abjad.Hairpin('>'), voice[6:])
>>> abjad.attach(abjad.Dynamic('p'), voice[8])
>>> abjad.show(voice) 
>>> for leaf in abjad.select(voice).leaves():
...     leaf, abjad.inspect(leaf).effective(abjad.Dynamic)
... 
(Note("c'8"), Dynamic('p'))
(Note("d'8"), Dynamic('p'))
(Note("e'8"), Dynamic('f'))
(Note("f'8"), Dynamic('f'))
(Note("c'8"), Dynamic('p'))
(Note("d'8"), Dynamic('p'))
(Note("e'8"), Dynamic('f'))
(Note("f'8"), Dynamic('f'))
(Note("c'8"), Dynamic('p'))

Attributes Summary

__eq__ Is true when hairpin equals argument.
__hash__ Hashes hairpin.
descriptor Gets descriptor.
direction Gets direction.
shape_string Gets shape string.
start_dynamic Gets start dynamic.
stop_dynamic Gets stop dynamic.
tweaks Gets tweaks.

Special methods

(Spanner).__contains__(argument)

Is true when spanner contains argument.

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

Copies spanner.

Does not copy spanner leaves.

__eq__(argument)

Is true when hairpin equals argument.

>>> hairpin_1 = abjad.Hairpin('p < f')
>>> hairpin_2 = abjad.Hairpin('p < f')
>>> hairpin_3 = abjad.Hairpin('f > p')
>>> hairpin_1 == hairpin_1
True
>>> hairpin_1 == hairpin_2
True
>>> hairpin_1 == hairpin_3
False
>>> hairpin_2 == hairpin_1
True
>>> hairpin_2 == hairpin_2
True
>>> hairpin_2 == hairpin_3
False
>>> hairpin_3 == hairpin_1
False
>>> hairpin_3 == hairpin_2
False
>>> hairpin_3 == hairpin_3
True
Return type:bool
(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]
__hash__()

Hashes hairpin.

Redefined in tandem with __eq__.

Return type:int
(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

descriptor

Gets descriptor.

>>> voice = abjad.Voice("r8 d' e' f' g' a' b' r")
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, voice[1:-1])
>>> abjad.show(voice) 
>>> hairpin.descriptor
'p < f'
Return type:Optional[str]
direction

Gets direction.

>>> voice = abjad.Voice("r8 d' e' f' g' a' b' r")
>>> hairpin = abjad.Hairpin('p < f', direction=abjad.Up)
>>> abjad.attach(hairpin, voice[1:-1])
>>> abjad.show(voice) 
>>> hairpin.direction
'^'
Return type:Optional[String]
(Spanner).leaves

Gets leaves in spanner.

Return type:Selection
shape_string

Gets shape string.

>>> voice = abjad.Voice("r8 d' e' f' g' a' b' r")
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, voice[1:-1])
>>> abjad.show(voice) 
>>> hairpin.shape_string
'<'
Return type:str
start_dynamic

Gets start dynamic.

>>> voice = abjad.Voice("r8 d' e' f' g' a' b' r")
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, voice[1:-1])
>>> abjad.show(voice) 
>>> hairpin.start_dynamic
Dynamic('p')
Return type:Optional[Dynamic]
stop_dynamic

Gets stop dynamic.

>>> voice = abjad.Voice("r8 d' e' f' g' a' b' r")
>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.attach(hairpin, voice[1:-1])
>>> abjad.show(voice) 
>>> hairpin.stop_dynamic
Dynamic('f')
Return type:Optional[Dynamic]
tweaks

Gets tweaks.

>>> hairpin = abjad.Hairpin('p < f')
>>> abjad.tweak(hairpin).color = 'blue'
>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.attach(hairpin, staff[:])
>>> abjad.show(staff) 
Return type:Optional[LilyPondTweakManager]

Functions

hairpin Attaches hairpin indicators.
abjad.spanners.Hairpin.hairpin(descriptor, argument, *, selector='abjad.select().leaves()')

Attaches hairpin indicators.

With three-part string descriptor:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> abjad.hairpin('p < f', staff[:])
>>> abjad.override(staff[0]).dynamic_line_spanner.staff_padding = 4
>>> abjad.show(staff) 

With dynamic objects:

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> start = abjad.Dynamic('niente', command=r'\!')
>>> trend = abjad.DynamicTrend('o<|')
>>> abjad.tweak(trend).color = 'blue'
>>> stop = abjad.Dynamic('"f"')
>>> abjad.hairpin([start, trend, stop], staff[:])
>>> abjad.override(staff[0]).dynamic_line_spanner.staff_padding = 4
>>> abjad.show(staff) 
Return type:None