Dynamic

class indicatortools.Dynamic(name='f')

A dynamic.

Example 1. Initializes from dynamic name:

>>> staff = Staff("c'8 d'8 e'8 f'8")
>>> dynamic = Dynamic('f')
>>> attach(dynamic, staff[0])
>>> show(staff) 

Example 2. Initializes from other dynamic:

>>> dynamic_1 = Dynamic('f')
>>> dynamic_2 = Dynamic(dynamic_1)
>>> dynamic_1
Dynamic(name='f')
>>> dynamic_2
Dynamic(name='f')

Example 3. Niente is possible, but provides no formatting.

>>> dynamic = Dynamic('niente')
>>> format(dynamic, 'lilypond')
''

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.AbjadValueObject.AbjadValueObject" [color=1, group=0, label=AbjadValueObject, shape=box]; "abjad.tools.abctools.AbjadObject.AbjadObject" -> "abjad.tools.abctools.AbjadValueObject.AbjadValueObject"; "abjad.tools.abctools.AbjadObject.AbstractBase" -> "abjad.tools.abctools.AbjadObject.AbjadObject"; } subgraph cluster_indicatortools { graph [label=indicatortools]; "abjad.tools.indicatortools.Dynamic.Dynamic" [color=black, fontcolor=white, group=2, label=<<B>Dynamic</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=2, group=1, label=object, shape=box]; } "abjad.tools.abctools.AbjadValueObject.AbjadValueObject" -> "abjad.tools.indicatortools.Dynamic.Dynamic"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

composite_dynamic_name_to_steady_state_dynamic_name(name) Changes composite name to steady state dynamic name.
default_scope Gets default scope of dynamic.
dynamic_name_to_dynamic_ordinal(name) Changes name to dynamic ordinal.
dynamic_ordinal_to_dynamic_name(dynamic_ordinal) Changes dynamic_ordinal to dynamic name.
is_dynamic_name(arg) Is true when arg is dynamic name.
name Gets name of dynamic.
ordinal Gets ordinal value of dynamic.
__copy__(\*args) Copies Abjad value object.
__eq__(expr) Is true when all initialization values of Abjad value object equal the initialization values of expr.
__format__([format_specification]) Formats dynamic.
__hash__() Hashes Abjad value object.
__ne__(expr) Is true when Abjad object does not equal expr.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

Dynamic.default_scope

Gets default scope of dynamic.

Example 1. Forte:

>>> dynamic = Dynamic('f')
>>> dynamic.default_scope
<class 'abjad.tools.scoretools.Staff.Staff'>

Example 2. Piano:

>>> dynamic = Dynamic('p')
>>> dynamic.default_scope
<class 'abjad.tools.scoretools.Staff.Staff'>

Dynamics are staff-scoped by default.

Returns staff.

Dynamic.name

Gets name of dynamic.

Example 1. Forte:

>>> Dynamic('f').name
'f'

Example 2. Piano:

>>> Dynamic('p').name
'p'

Example 3. Double sforzando:

>>> Dynamic('sffz').name
'sffz'

Example 4. Double sforzando-piano:

>>> Dynamic('sffp').name
'sffp'

Returns string.

Dynamic.ordinal

Gets ordinal value of dynamic.

Example 1. Forte:

>>> Dynamic('f').ordinal
2

Example 2. Piano:

>>> Dynamic('p').ordinal
-2

Returns integer.

Class & static methods

static Dynamic.composite_dynamic_name_to_steady_state_dynamic_name(name)

Changes composite name to steady state dynamic name.

Example 1. Steady state of sfp is piano:

>>> Dynamic.composite_dynamic_name_to_steady_state_dynamic_name('sfp')
'p'

Example 2. Steady state of rfz is forte:

>>> Dynamic.composite_dynamic_name_to_steady_state_dynamic_name('rfz')
'f'

Returns string.

static Dynamic.dynamic_name_to_dynamic_ordinal(name)

Changes name to dynamic ordinal.

Example 1. Louder dynamics change to positive integers:

>>> Dynamic.dynamic_name_to_dynamic_ordinal('fff')
4

Example 2. Niente changes to negative infinity:

>>> Dynamic.dynamic_name_to_dynamic_ordinal('niente')
NegativeInfinity

Returns integer or negative infinity.

static Dynamic.dynamic_ordinal_to_dynamic_name(dynamic_ordinal)

Changes dynamic_ordinal to dynamic name.

Example 1. Negative values change to quiet dynamics:

>>> Dynamic.dynamic_ordinal_to_dynamic_name(-5)
'pppp'

Example 2. Negative infinity changes to niente:

>>> negative_infinity = mathtools.NegativeInfinity()
>>> Dynamic.dynamic_ordinal_to_dynamic_name(negative_infinity)
'niente'

Returns string.

static Dynamic.is_dynamic_name(arg)

Is true when arg is dynamic name. Otherwise false.

Example 1. Some usual dynamic names:

>>> Dynamic.is_dynamic_name('f')
True
>>> Dynamic.is_dynamic_name('sfz')
True

Example 2. Niente is also a dynamic name:

>>> Dynamic.is_dynamic_name('niente')
True

Returns true or false.

Special methods

(AbjadValueObject).__copy__(*args)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(expr)

Is true when all initialization values of Abjad value object equal the initialization values of expr.

Returns true or false.

Dynamic.__format__(format_specification='')

Formats dynamic.

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

Example 1. Gets storage format of forte:

>>> dynamic = Dynamic('f')
>>> print(format(dynamic))
indicatortools.Dynamic(
    name='f',
    )

Example 2. Gets LilyPond format of forte:

>>> dynamic = Dynamic('f')
>>> print(format(dynamic, 'lilypond'))
\f

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

(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.