TimeSignature

class indicatortools.TimeSignature(pair=(4, 4), partial=None, suppress=None)

Time signature.

Example 1. First time signature:

>>> staff = Staff("c'8 d'8 e'8")
>>> time_signature = TimeSignature((3, 8))
>>> attach(time_signature, staff[0])
>>> show(staff) 

Example 2. Second time signature:

>>> staff = Staff("c'4 d'4 e'4 f'4")
>>> time_signature = TimeSignature((4, 4))
>>> attach(time_signature, staff[0])
>>> show(staff) 

Example 3. Scoped to the score context:

>>> staff = Staff("c'8 d'8 e'8 c'8 d'8 e'8")
>>> time_signature = TimeSignature((3, 8))
>>> attach(time_signature, staff[0], scope=Score)

Formats behind comments when no score is present:

>>> print(format(staff))
\new Staff {
    %%% \time 3/8 %%%
    c'8
    d'8
    e'8
    c'8
    d'8
    e'8
}
>>> show(staff) 

Formats normally when score is present:

>>> score = Score([staff])
>>> print(format(score))
\new Score <<
    \new Staff {
        \time 3/8
        c'8
        d'8
        e'8
        c'8
        d'8
        e'8
    }
>>
>>> 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.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.TimeSignature.TimeSignature" [color=black, fontcolor=white, group=2, label=<<B>TimeSignature</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.TimeSignature.TimeSignature"; "builtins.object" -> "abjad.tools.abctools.AbjadObject.AbstractBase"; }

Bases

Attribute summary

default_scope Gets default scope of time signature.
denominator Gets denominator of time signature:
duration Gets duration of time signature.
has_non_power_of_two_denominator Is true when time signature has non-power-of-two denominator.
implied_prolation Gets implied prolation of time signature.
numerator Gets numerator of time signature.
pair Gets numerator / denominator pair corresponding to time siganture.
partial Gets duration of pick-up to time signature.
suppress Is true when time signature should be suppressed in output.
with_power_of_two_denominator([...]) Makes new time signature equivalent to current time signature with power-of-two denominator.
__add__(arg) Adds time signature to arg.
__copy__(\*args) Copies time signature.
__eq__(arg) Is true when arg is a time signature with numerator and denominator equal to this time signature.
__format__([format_specification]) Formats time signature.
__ge__(arg) Is true when duration of time signature is greater than or equal to duration of arg.
__gt__(arg) Is true when duration of time signature is greater than duration of arg.
__hash__() Hashes time signature.
__le__(arg) Is true when duration of time signature is less than duration of arg.
__lt__(arg) Is true when duration of time signature is less than duration of arg.
__ne__(expr) Is true when Abjad object does not equal expr.
__radd__(arg) Adds arg to time signature.
__repr__() Gets interpreter representation of Abjad object.
__str__() Gets string representation of time signature.

Read-only properties

TimeSignature.default_scope

Gets default scope of time signature.

Example 1. First time signature:

>>> TimeSignature((3, 8)).default_scope
<class 'abjad.tools.scoretools.Staff.Staff'>

Example 2. Second time signature:

>>> TimeSignature((4, 4)).default_scope
<class 'abjad.tools.scoretools.Staff.Staff'>

Returns staff.

TimeSignature.denominator

Gets denominator of time signature:

Example 1. First time signature:

>>> TimeSignature((3, 8)).denominator
8

Example 2. Second time signature:

>>> TimeSignature((4, 4)).denominator
4

Set to positive integer.

Returns positive integer.

TimeSignature.duration

Gets duration of time signature.

Example 1. First time signature:

>>> TimeSignature((3, 8)).duration
Duration(3, 8)

Example 2. Second time signature:

>>> TimeSignature((4, 4)).duration
Duration(1, 1)

Returns duration.

TimeSignature.has_non_power_of_two_denominator

Is true when time signature has non-power-of-two denominator. Otherwise false.

Example 1. With non-power-of-two denominator:

>>> time_signature = TimeSignature((7, 12))
>>> time_signature.has_non_power_of_two_denominator
True

Example 2. With power-of-two denominator:

>>> time_signature = TimeSignature((3, 8))
>>> time_signature.has_non_power_of_two_denominator
False

Returns true or false.

TimeSignature.implied_prolation

Gets implied prolation of time signature.

Example 1. Implied prolation of time signature with power-of-two denominator:

>>> TimeSignature((3, 8)).implied_prolation
Multiplier(1, 1)

Example 2. Implied prolation of time signature with non-power-of-two denominator:

>>> TimeSignature((7, 12)).implied_prolation
Multiplier(2, 3)

Returns multiplier.

TimeSignature.numerator

Gets numerator of time signature.

Example 1. First time signature:

>>> TimeSignature((3, 8)).numerator
3

Example 2. Second time signature:

>>> TimeSignature((4, 4)).numerator
4

Set to positive integer.

Returns positive integer.

TimeSignature.pair

Gets numerator / denominator pair corresponding to time siganture.

Example 1. First time signature:

>>> TimeSignature((3, 8)).pair
(3, 8)

Example 2. Second time signature:

>>> TimeSignature((4, 4)).pair
(4, 4)

Returns pair.

TimeSignature.partial

Gets duration of pick-up to time signature.

Example 1. First time signature:

>>> TimeSignature((3, 8)).partial is None
True

Example 2. Second time signature:

>>> TimeSignature((4, 4)).partial is None
True

Set to duration or none.

Defaults to none.

Returns duration or none.

Read/write properties

TimeSignature.suppress

Is true when time signature should be suppressed in output. Otherwise false.

Example 1. First time signature:

>>> TimeSignature((3, 8)).suppress is None
True

Example 2. Second time signature:

>>> TimeSignature((4, 4)).suppress is None
True

Set to boolean or none.

Defaults to none.

Returns boolean or none.

Methods

TimeSignature.with_power_of_two_denominator(contents_multiplier=Multiplier(1, 1))

Makes new time signature equivalent to current time signature with power-of-two denominator.

Example 1. Non-power-of-two denominator with power-of-two denominator:

>>> time_signature = TimeSignature((3, 12))
>>> time_signature.with_power_of_two_denominator()
TimeSignature((2, 8))

Returns new time signature.

Special methods

TimeSignature.__add__(arg)

Adds time signature to arg.

Example 1. Adds two time signatures with the same denominator:

>>> TimeSignature((3, 4)) + TimeSignature((3, 4))
TimeSignature((6, 4))

Example 2. Adds two time signatures with different denominators:

>>> TimeSignature((3, 4)) + TimeSignature((6, 8))
TimeSignature((12, 8))

Returns new time signature in terms of greatest denominator.

Returns new time signature.

TimeSignature.__copy__(*args)

Copies time signature.

Returns new time signature.

TimeSignature.__eq__(arg)

Is true when arg is a time signature with numerator and denominator equal to this time signature. Also true when arg is a tuple with first and second elements equal to numerator and denominator of this time signature. Otherwise false.

Returns true or false.

TimeSignature.__format__(format_specification='')

Formats time signature.

Example 1. First time signature:

>>> print(format(TimeSignature((3, 8))))
indicatortools.TimeSignature((3, 8))

Example 2. Second time signature:

>>> print(format(TimeSignature((4, 4))))
indicatortools.TimeSignature((4, 4))

Returns string.

TimeSignature.__ge__(arg)

Is true when duration of time signature is greater than or equal to duration of arg. Otherwise false.

Returns true or false.

TimeSignature.__gt__(arg)

Is true when duration of time signature is greater than duration of arg. Otherwise false.

Returns true or false.

TimeSignature.__hash__()

Hashes time signature.

Required to be explicitly redefined on Python 3 if __eq__ changes.

Returns integer.

TimeSignature.__le__(arg)

Is true when duration of time signature is less than duration of arg. Otherwise false.

Returns true or false.

TimeSignature.__lt__(arg)

Is true when duration of time signature is less than duration of arg. Otherwise false.

Returns booelan.

(AbjadObject).__ne__(expr)

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

Returns true or false.

TimeSignature.__radd__(arg)

Adds arg to time signature.

Example 1. Adds integer to first time signature:

>>> TimeSignature((3, 8)) + TimeSignature((4, 4))
TimeSignature((11, 8))

Example 2. Adds integer to second time signature:

>>> TimeSignature((4, 4)) + TimeSignature((3, 8))
TimeSignature((11, 8))

Returns new time signature.

(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

TimeSignature.__str__()

Gets string representation of time signature.

Example 1. First time signature:

>>> str(TimeSignature((3, 8)))
'3/8'

Example 2. Second time signature:

>>> str(TimeSignature((4, 4)))
'4/4'

Returns string.