TimeSignature

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph "cluster_abjad.indicators" { graph [label="abjad.indicators"]; node [color=1]; "abjad.indicators.TimeSignature.TimeSignature" [URL="../api/abjad/indicators/TimeSignature.html#abjad.indicators.TimeSignature.TimeSignature", color=black, fontcolor=white, label="Time\nSignature", target=_top]; } subgraph "cluster_abjad.system" { graph [label="abjad.system"]; node [color=2]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjad/indicators/../system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjad/indicators/../system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; } subgraph cluster_builtins { graph [label=builtins]; node [color=3]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } "abjad.system.AbjadValueObject.AbjadValueObject" -> "abjad.indicators.TimeSignature.TimeSignature"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjad.indicators.TimeSignature.TimeSignature(pair=(4, 4), *, partial=None, hide=None)

Time signature.

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

Create score-contexted time signatures like this:

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

Score-contexted time signatures format behind comments when no Abjad score container is found:

>>> abjad.f(staff)
\new Staff
{
    %%% \time 3/8 %%%
    c'8
    d'8
    e'8
    c'8
    d'8
    e'8
}
>>> abjad.show(staff) 

Score-contexted time signatures format normally when an Abjad score container is found:

>>> score = abjad.Score([staff])
>>> abjad.f(score)
\new Score
<<
    \new Staff
    {
        \time 3/8
        c'8
        d'8
        e'8
        c'8
        d'8
        e'8
    }
>>
>>> abjad.show(score) 

Time signatures can be tagged:

>>> staff = abjad.Staff("c'8 d'8 e'8 c'8 d'8 e'8")
>>> time_signature = abjad.TimeSignature((3, 8))
>>> abjad.attach(time_signature, staff[0], context='Score', tag='RED')
>>> score = abjad.Score([staff])
>>> abjad.show(staff) 
>>> abjad.f(score)
\new Score
<<
    \new Staff
    {
        \time 3/8 %! RED
        c'8
        d'8
        e'8
        c'8
        d'8
        e'8
    }
>>

Attributes Summary

__add__ Adds time signature to argument.
__copy__ Copies time signature.
__eq__ Is true when argument is a time signature with numerator and denominator equal to this time signature.
__format__ Formats time signature.
__ge__ Is true when duration of time signature is greater than or equal to duration of argument.
__gt__ Is true when duration of time signature is greater than duration of argument.
__hash__ Hashes time signature.
__le__ Is true when duration of time signature is less than duration of argument.
__lt__ Is true when duration of time signature is less than duration of argument.
__radd__ Adds argument to time signature.
__str__ Gets string representation of time signature.
context Gets (historically conventional) context.
denominator Gets denominator of time signature:
duration Gets duration of time signature.
from_string Makes new time signature from fraction string.
has_non_power_of_two_denominator Is true when time signature has non-power-of-two denominator.
hide Is true when time signature should not appear in output (but should still determine effective time signature).
implied_prolation Gets implied prolation of time signature.
numerator Gets numerator of time signature.
pair Gets numerator / denominator pair corresponding to time siganture.
parameter Is true.
partial Gets duration of pick-up to time signature.
tweaks Are not implemented on time signature.
with_power_of_two_denominator Makes new time signature equivalent to current time signature with power-of-two denominator.

Special methods

__add__(argument)

Adds time signature to argument.

Adds two time signatures with the same denominator:

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

Adds two time signatures with different denominators:

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

Returns new time signature in terms of greatest denominator.

Return type:TimeSignature
__copy__(*arguments)

Copies time signature.

Return type:TimeSignature
__eq__(argument)

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

Return type:bool
__format__(format_specification='')

Formats time signature.

>>> print(format(abjad.TimeSignature((3, 8))))
abjad.TimeSignature((3, 8))
Return type:str
__ge__(argument)

Is true when duration of time signature is greater than or equal to duration of argument.

Return type:bool
__gt__(argument)

Is true when duration of time signature is greater than duration of argument.

Return type:bool
__hash__()

Hashes time signature.

Redefined in tandem with __eq__.

Return type:int
__le__(argument)

Is true when duration of time signature is less than duration of argument.

Return type:bool
__lt__(argument)

Is true when duration of time signature is less than duration of argument.

Return type:bool
__radd__(argument)

Adds argument to time signature.

>>> abjad.TimeSignature((3, 8)) + abjad.TimeSignature((4, 4))
TimeSignature((11, 8))
Return type:TimeSignature
(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.

__str__()

Gets string representation of time signature.

>>> str(abjad.TimeSignature((3, 8)))
'3/8'
Return type:str

Methods

with_power_of_two_denominator(contents_multiplier=1)

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

Non-power-of-two denominator with power-of-two denominator:

>>> time_signature = abjad.TimeSignature((3, 12))
>>> time_signature.with_power_of_two_denominator()
TimeSignature((2, 8))
Return type:TimeSignature

Class & static methods

static from_string(string)

Makes new time signature from fraction string.

>>> abjad.TimeSignature.from_string('6/8')
TimeSignature((6, 8))
Return type:TimeSignature

Read-only properties

context

Gets (historically conventional) context.

>>> abjad.TimeSignature((3, 8)).context
'Staff'

Todo

Should return 'Score'.

Override with abjad.attach(..., context='...').

Return type:str
denominator

Gets denominator of time signature:

>>> abjad.TimeSignature((3, 8)).denominator
8
Return type:int
duration

Gets duration of time signature.

>>> abjad.TimeSignature((3, 8)).duration
Duration(3, 8)
Return type:Duration
has_non_power_of_two_denominator

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

With non-power-of-two denominator:

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

With power-of-two denominator:

>>> time_signature = abjad.TimeSignature((3, 8))
>>> time_signature.has_non_power_of_two_denominator
False
Return type:bool
hide

Is true when time signature should not appear in output (but should still determine effective time signature).

>>> staff = abjad.Staff("c'4 d' e' f'")
>>> time_signature = abjad.TimeSignature((4, 4))
>>> abjad.attach(time_signature, staff[0])
>>> time_signature = abjad.TimeSignature((2, 4), hide=True)
>>> abjad.attach(time_signature, staff[2])
>>> abjad.show(staff) 
>>> abjad.f(staff)
\new Staff
{
    \time 4/4
    c'4
    d'4
    e'4
    f'4
}
>>> for leaf in abjad.iterate(staff).leaves():
...     prototype = abjad.TimeSignature
...     leaf, abjad.inspect(leaf).effective(prototype)
... 
(Note("c'4"), TimeSignature((4, 4)))
(Note("d'4"), TimeSignature((4, 4)))
(Note("e'4"), TimeSignature((2, 4), hide=True))
(Note("f'4"), TimeSignature((2, 4), hide=True))
Return type:Optional[bool]
implied_prolation

Gets implied prolation of time signature.

Implied prolation of time signature with power-of-two denominator:

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

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

>>> abjad.TimeSignature((7, 12)).implied_prolation
Multiplier(2, 3)
Return type:Multiplier
numerator

Gets numerator of time signature.

>>> abjad.TimeSignature((3, 8)).numerator
3
Return type:int
pair

Gets numerator / denominator pair corresponding to time siganture.

>>> abjad.TimeSignature((3, 8)).pair
(3, 8)
Return type:Tuple[int, int]
parameter

Is true.

>>> abjad.TimeSignature((3, 8)).parameter
True
Return type:bool
partial

Gets duration of pick-up to time signature.

>>> abjad.TimeSignature((3, 8)).partial is None
True
Return type:Optional[Duration]
tweaks

Are not implemented on time signature.

The LilyPond \time command refuses tweaks.

Override the LilyPond TimeSignature grob instead.

Return type:None