TempoSpanner

class spannertools.TempoSpanner(left_broken_padding=None, left_broken_text=None, start_with_parenthesized_tempo=False, overrides=None)

Tempo spanner.

Example 1. With tempo indicators only:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 72)
>>> attach(tempo, staff[3], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[5], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> show(score) 

Example 2. With an accelerando:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 72)
>>> attach(tempo, staff[3], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[5], is_annotation=True)
>>> accelerando = indicatortools.Accelerando()
>>> attach(accelerando, staff[0], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 3. With a ritardando:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 72)
>>> attach(tempo, staff[3], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[5], is_annotation=True)
>>> ritardando = indicatortools.Ritardando()
>>> attach(ritardando, staff[3], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 4. With both an accelerando and a ritardando:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 72)
>>> attach(tempo, staff[3], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[5], is_annotation=True)
>>> accelerando = indicatortools.Accelerando()
>>> attach(accelerando, staff[0], is_annotation=True)
>>> ritardando = indicatortools.Ritardando()
>>> attach(ritardando, staff[3], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 5. Implicit start to (music-initial) accelerando:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 72)
>>> attach(tempo, staff[3], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[5], is_annotation=True)
>>> accelerando = indicatortools.Accelerando()
>>> attach(accelerando, staff[0], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 6. Implicit start to (music-initial) ritardando:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 72)
>>> attach(tempo, staff[3], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[5], is_annotation=True)
>>> ritardando = indicatortools.Ritardando()
>>> attach(ritardando, staff[0], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 7. Implicit start to (midmusic) accelerando:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 120)
>>> attach(tempo, staff[5], is_annotation=True)
>>> accelerando = indicatortools.Accelerando()
>>> attach(accelerando, staff[3], is_annotation=True)
>>> tempo_spanner = spannertools.TempoSpanner(
...     start_with_parenthesized_tempo=True,
...     )
>>> attach(tempo_spanner, staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 8. Implicit start to (midmusic) ritardando:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[5], is_annotation=True)
>>> ritardando = indicatortools.Ritardando()
>>> attach(ritardando, staff[3], is_annotation=True)
>>> tempo_spanner = spannertools.TempoSpanner(
...     start_with_parenthesized_tempo=True,
...     )
>>> attach(tempo_spanner, staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 9. With an accelerando over a line break:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[6], is_annotation=True)
>>> accelerando = indicatortools.Accelerando()
>>> attach(accelerando, staff[2], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 10. With a ritardando over a line break:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[6], is_annotation=True)
>>> ritardando = indicatortools.Ritardando()
>>> attach(ritardando, staff[2], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 11. With a metric modulation:

>>> staff = Staff("c'8. d'8. e'4. g'8. f'8. ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(3, 4), 90)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(3, 4), 60)
>>> attach(tempo, staff[3], is_annotation=True)
>>> metric_modulation = indicatortools.MetricModulation(
...     left_rhythm=Note('c4.'),
...     right_rhythm=Note('c4'),
...     )
>>> attach(metric_modulation, staff[3], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 12. With a metric modulation and an accelerando:

>>> staff = Staff("c'8. d'8. e'4. g'8. f'8. ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(3, 4), 90)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(3, 4), 60)
>>> attach(tempo, staff[3], is_annotation=True)
>>> metric_modulation = indicatortools.MetricModulation(
...     left_rhythm=Note('c4.'),
...     right_rhythm=Note('c4'),
...     )
>>> attach(metric_modulation, staff[3], is_annotation=True)
>>> attach(Accelerando(), staff[3], is_annotation=True)
>>> tempo = Tempo(Duration(3, 4), 90)
>>> attach(tempo, staff[-1], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

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.TempoSpanner.TempoSpanner" [color=black, fontcolor=white, group=2, label=<<B>TempoSpanner</B>>, shape=box, style="filled, rounded"]; "abjad.tools.spannertools.Spanner.Spanner" -> "abjad.tools.spannertools.TempoSpanner.TempoSpanner"; } 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.
left_broken_padding Gets left broken padding of tempo spanner.
left_broken_text Gets left broken text of tempo spanner.
name Gets spanner name.
overrides Gets overrides.
start_with_parenthesized_tempo Is true when spanner should start with parenthesized tempo.
__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.

TempoSpanner.left_broken_padding

Gets left broken padding of tempo spanner.

Example 1. With left broken padding set to none:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[6], is_annotation=True)
>>> ritardando = indicatortools.Ritardando()
>>> attach(ritardando, staff[2], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Results in padding of -2. (This is default behavior.)

Example 2. With left broken padding set explicitly:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[6], is_annotation=True)
>>> ritardando = indicatortools.Ritardando()
>>> attach(ritardando, staff[2], is_annotation=True)
>>> tempo_spanner = spannertools.TempoSpanner(
...     left_broken_padding=4,
...     )
>>> attach(tempo_spanner, staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Returns number or none.

TempoSpanner.left_broken_text

Gets left broken text of tempo spanner.

Example 1. With left broken text set to none:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[6], is_annotation=True)
>>> ritardando = indicatortools.Ritardando()
>>> attach(ritardando, staff[2], is_annotation=True)
>>> attach(spannertools.TempoSpanner(), staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Results in parenthesized abbreviation after line break. (This is default behavior.)

Example 2. With left broken text set explicitly:

>>> staff = Staff("c'4. d' e' f' g' a' b' c''")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> command = indicatortools.LilyPondCommand('break', 'after')
>>> attach(command, staff[3])
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[6], is_annotation=True)
>>> ritardando = indicatortools.Ritardando()
>>> attach(ritardando, staff[2], is_annotation=True)
>>> null_markup = Markup.null(direction=None)
>>> tempo_spanner = spannertools.TempoSpanner(
...     left_broken_text=null_markup,
...     )
>>> attach(tempo_spanner, staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Results in null left broken text.

Returns markup or none.

(Spanner).name

Gets spanner name.

Returns string.

(Spanner).overrides

Gets overrides.

Returns dict.

TempoSpanner.start_with_parenthesized_tempo

Is true when spanner should start with parenthesized tempo.

Example 1. Does not start with parenthesized tempo:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 120)
>>> attach(tempo, staff[5], is_annotation=True)
>>> accelerando = indicatortools.Accelerando()
>>> attach(accelerando, staff[3], is_annotation=True)
>>> tempo_spanner = spannertools.TempoSpanner(
...     start_with_parenthesized_tempo=False,
...     )
>>> attach(tempo_spanner, staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Example 2. Starts with parenthesized tempo:

>>> staff = Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> attach(TimeSignature((3, 8)), staff)
>>> score = Score([staff])
>>> tempo = Tempo(Duration(1, 4), 60)
>>> attach(tempo, staff[0], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 90)
>>> attach(tempo, staff[2], is_annotation=True)
>>> tempo = Tempo(Duration(1, 4), 120)
>>> attach(tempo, staff[5], is_annotation=True)
>>> accelerando = indicatortools.Accelerando()
>>> attach(accelerando, staff[3], is_annotation=True)
>>> tempo_spanner = spannertools.TempoSpanner(
...     start_with_parenthesized_tempo=True,
...     )
>>> attach(tempo_spanner, staff[:])
>>> override(score).text_script.staff_padding = 2.25
>>> override(score).text_spanner.staff_padding = 3
>>> show(score) 

Defaults to false.

Set to 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.