MetronomeMarkSpanner

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

MetronomeMark spanner.

>>> import abjad

With metronome marks only:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 72)
>>> spanner.attach(mark, staff[3])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[5])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> show(score) 

With an accelerando:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 72)
>>> spanner.attach(mark, staff[3])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[5])
>>> accelerando = abjad.Accelerando()
>>> spanner.attach(accelerando, staff[0])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

With a ritardando:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 72)
>>> spanner.attach(mark, staff[3])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[5])
>>> ritardando = abjad.Ritardando()
>>> spanner.attach(ritardando, staff[3])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

With both an accelerando and a ritardando:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 72)
>>> spanner.attach(mark, staff[3])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[5])
>>> accelerando = abjad.Accelerando()
>>> spanner.attach(accelerando, staff[0])
>>> ritardando = abjad.Ritardando()
>>> spanner.attach(ritardando, staff[3])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

Implicit start to (music-initial) accelerando:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 72)
>>> spanner.attach(mark, staff[3])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[5])
>>> accelerando = abjad.Accelerando()
>>> spanner.attach(accelerando, staff[0])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

Implicit start to (music-initial) ritardando:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 72)
>>> spanner.attach(mark, staff[3])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[5])
>>> ritardando = abjad.Ritardando()
>>> spanner.attach(ritardando, staff[0])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

Implicit start to (midmusic) accelerando:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner(
...     start_with_parenthesized_tempo=True,
...     )
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 120)
>>> spanner.attach(mark, staff[5])
>>> accelerando = abjad.Accelerando()
>>> spanner.attach(accelerando, staff[3])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

Implicit start to (midmusic) ritardando:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner(
...     start_with_parenthesized_tempo=True,
...     )
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[5])
>>> ritardando = abjad.Ritardando()
>>> spanner.attach(ritardando, staff[3])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

With an accelerando over a line break:

>>> staff = abjad.Staff("c'4. d' e' f' g' a' b' c''")
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> score = abjad.Score([staff])
>>> command = abjad.LilyPondCommand('break', 'after')
>>> abjad.attach(command, staff[3])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[6])
>>> accelerando = abjad.Accelerando()
>>> spanner.attach(accelerando, staff[2])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

With a ritardando over a line break:

>>> staff = abjad.Staff("c'4. d' e' f' g' a' b' c''")
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> score = abjad.Score([staff])
>>> command = abjad.LilyPondCommand('break', 'after')
>>> abjad.attach(command, staff[3])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[6])
>>> ritardando = abjad.Ritardando()
>>> spanner.attach(ritardando, staff[2])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

With a metric modulation:

>>> staff = abjad.Staff("c'8. d'8. e'4. g'8. f'8. ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((3, 4), 90)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((3, 4), 60)
>>> spanner.attach(mark, staff[3])
>>> metric_modulation = abjad.MetricModulation(
...     left_rhythm=abjad.Note('c4.'),
...     right_rhythm=abjad.Note('c4'),
...     )
>>> spanner.attach(metric_modulation, staff[3])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

With a metric modulation and an accelerando:

>>> staff = abjad.Staff("c'8. d'8. e'4. g'8. f'8. ef'4.")
>>> score = abjad.Score([staff])
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((3, 4), 90)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((3, 4), 60)
>>> spanner.attach(mark, staff[3])
>>> metric_modulation = abjad.MetricModulation(
...     left_rhythm=abjad.Note('c4.'),
...     right_rhythm=abjad.Note('c4'),
...     )
>>> spanner.attach(metric_modulation, staff[3])
>>> spanner.attach(abjad.Accelerando(), staff[3])
>>> mark = abjad.MetronomeMark((3, 4), 90)
>>> spanner.attach(mark, staff[-1])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.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.MetronomeMarkSpanner.MetronomeMarkSpanner" [color=black, fontcolor=white, group=2, label=<<B>MetronomeMarkSpanner</B>>, shape=box, style="filled, rounded"]; "abjad.tools.spannertools.Spanner.Spanner" [color=3, group=2, label=Spanner, shape=box]; "abjad.tools.spannertools.Spanner.Spanner" -> "abjad.tools.spannertools.MetronomeMarkSpanner.MetronomeMarkSpanner"; } 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

attach(indicator, leaf) Attaches indicator to leaf in spanner.
components Gets leaves in spanner.
left_broken_padding Gets left broken padding of metronome mark spanner.
left_broken_text Gets left broken text of metronome mark spanner.
name Gets spanner name.
overrides Gets overrides.
start_with_parenthesized_tempo Is true when spanner should start with parenthesized tempo.
__contains__(argument) Is true when spanner contains argument.
__copy__(*arguments) Copies spanner.
__eq__(argument) Is true when ID of argument equals ID of Abjad object.
__format__([format_specification]) Formats Abjad object.
__getitem__(argument) Gets item or slice identified by argument.
__hash__() Hashes Abjad object.
__len__() Gets number of components in spanner.
__lt__(argument) Is true when spanner is less than argument.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

(Spanner).components

Gets leaves in spanner.

Returns selection of leaves.

MetronomeMarkSpanner.left_broken_padding

Gets left broken padding of metronome mark spanner.

With left broken padding set to none:

>>> staff = abjad.Staff("c'4. d' e' f' g' a' b' c''")
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> score = abjad.Score([staff])
>>> command = abjad.LilyPondCommand('break', 'after')
>>> abjad.attach(command, staff[3])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[6])
>>> ritardando = abjad.Ritardando()
>>> spanner.attach(ritardando, staff[2])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

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

With left broken padding set explicitly:

>>> staff = abjad.Staff("c'4. d' e' f' g' a' b' c''")
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> score = abjad.Score([staff])
>>> command = abjad.LilyPondCommand('break', 'after')
>>> abjad.attach(command, staff[3])
>>> spanner = abjad.MetronomeMarkSpanner(
...     left_broken_padding=4,
...     )
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[6])
>>> ritardando = abjad.Ritardando()
>>> spanner.attach(ritardando, staff[2])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

Returns number or none.

MetronomeMarkSpanner.left_broken_text

Gets left broken text of metronome mark spanner.

With left broken text set to none:

>>> staff = abjad.Staff("c'4. d' e' f' g' a' b' c''")
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> score = abjad.Score([staff])
>>> command = abjad.LilyPondCommand('break', 'after')
>>> abjad.attach(command, staff[3])
>>> spanner = abjad.MetronomeMarkSpanner()
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[6])
>>> ritardando = abjad.Ritardando()
>>> spanner.attach(ritardando, staff[2])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

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

With left broken text set explicitly:

>>> staff = abjad.Staff("c'4. d' e' f' g' a' b' c''")
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> score = abjad.Score([staff])
>>> command = abjad.LilyPondCommand('break', 'after')
>>> abjad.attach(command, staff[3])
>>> null_markup = abjad.Markup.null(direction=None)
>>> spanner = abjad.MetronomeMarkSpanner(
...     left_broken_text=null_markup,
...     )
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[6])
>>> ritardando = abjad.Ritardando()
>>> spanner.attach(ritardando, staff[2])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.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 dictionary.

MetronomeMarkSpanner.start_with_parenthesized_tempo

Is true when spanner should start with parenthesized tempo.

Does not start with parenthesized tempo:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> score = abjad.Score([staff])
>>> spanner = abjad.MetronomeMarkSpanner(
...     start_with_parenthesized_tempo=False,
...     )
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 120)
>>> spanner.attach(mark, staff[5])
>>> accelerando = abjad.Accelerando()
>>> spanner.attach(accelerando, staff[3])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

Starts with parenthesized tempo:

>>> staff = abjad.Staff("c'8. d' e'4. g'8. f' ef'4.")
>>> abjad.attach(abjad.TimeSignature((3, 8)), staff[0])
>>> score = abjad.Score([staff])
>>> spanner = abjad.MetronomeMarkSpanner(
...     start_with_parenthesized_tempo=True,
...     )
>>> abjad.attach(spanner, staff[:])
>>> mark = abjad.MetronomeMark((1, 4), 60)
>>> spanner.attach(mark, staff[0])
>>> mark = abjad.MetronomeMark((1, 4), 90)
>>> spanner.attach(mark, staff[2])
>>> mark = abjad.MetronomeMark((1, 4), 120)
>>> spanner.attach(mark, staff[5])
>>> accelerando = abjad.Accelerando()
>>> spanner.attach(accelerando, staff[3])
>>> abjad.override(score).text_script.staff_padding = 2.25
>>> abjad.override(score).text_spanner.staff_padding = 3
>>> show(score) 

Defaults to false.

Set to true, false or none.

Methods

MetronomeMarkSpanner.attach(indicator, leaf)

Attaches indicator to leaf in spanner.

Returns none.

Special methods

(Spanner).__contains__(argument)

Is true when spanner contains argument. Otherwise false.

Returns true or false.

(Spanner).__copy__(*arguments)

Copies spanner.

Does not copy spanner components.

Returns new spanner.

(AbjadObject).__eq__(argument)

Is true when ID of argument 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__(argument)

Gets item or slice identified by argument.

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__(argument)

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

Trivial comparison to allow doctests to work.

Returns true or false.

(AbjadObject).__ne__(argument)

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

Returns true or false.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.