Dynamic

class indicatortools.Dynamic(name='f')

Dynamic.

>>> import abjad

Initializes from dynamic name:

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

Initializes from other dynamic:

>>> dynamic_1 = abjad.Dynamic('f')
>>> dynamic_2 = abjad.Dynamic(dynamic_1)
>>> dynamic_1
Dynamic('f')
>>> dynamic_2
Dynamic('f')

Niente is possible, but provides no formatting.

>>> dynamic = abjad.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(argument) Is true when argument is dynamic name.
name Gets name of dynamic.
ordinal Gets ordinal value of dynamic.
__copy__(*arguments) Copies Abjad value object.
__eq__(argument) Is true when all initialization values of Abjad value object equal the initialization values of argument.
__format__([format_specification]) Formats dynamic.
__hash__() Hashes Abjad value object.
__ne__(argument) Is true when Abjad object does not equal argument.
__repr__() Gets interpreter representation of Abjad object.

Read-only properties

Dynamic.default_scope

Gets default scope of dynamic.

Forte:

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

Piano:

>>> dynamic = abjad.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.

Forte:

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

Piano:

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

Double sforzando:

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

Double sforzando-piano:

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

Returns string.

Dynamic.ordinal

Gets ordinal value of dynamic.

Forte:

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

Piano:

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

Steady state of sfp is piano:

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

Steady state of rfz is forte:

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

Louder dynamics change to positive integers:

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

Niente changes to negative infinity:

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

Negative values change to quiet dynamics:

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

Negative infinity changes to niente:

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

Returns string.

static Dynamic.is_dynamic_name(argument)

Is true when argument is dynamic name. Otherwise false.

Some usual dynamic names:

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

Niente is also a dynamic name:

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

Returns true or false.

Special methods

(AbjadValueObject).__copy__(*arguments)

Copies Abjad value object.

Returns new Abjad value object.

(AbjadValueObject).__eq__(argument)

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

Returns true or false.

Dynamic.__format__(format_specification='')

Formats dynamic.

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

Gets storage format of forte:

>>> dynamic = abjad.Dynamic('f')
>>> print(format(dynamic))
abjad.Dynamic('f')

Gets LilyPond format of forte:

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

Returns string.

(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

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