Talea

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.system" { graph [label="abjad.system"]; node [color=1]; "abjad.system.AbjadObject.AbjadObject" [URL="../api/abjadext/rmakers/../../abjad/system/AbjadObject.html#abjad.system.AbjadObject.AbjadObject", label="Abjad\nObject", target=_top]; "abjad.system.AbjadValueObject.AbjadValueObject" [URL="../api/abjadext/rmakers/../../abjad/system/AbjadValueObject.html#abjad.system.AbjadValueObject.AbjadValueObject", label="Abjad\nValue\nObject", target=_top]; "abjad.system.AbjadObject.AbjadObject" -> "abjad.system.AbjadValueObject.AbjadValueObject"; } subgraph "cluster_abjadext.rmakers" { graph [label="abjadext.rmakers"]; node [color=2]; "abjadext.rmakers.Talea.Talea" [URL="../api/abjadext/rmakers/Talea.html#abjadext.rmakers.Talea.Talea", color=black, fontcolor=white, label=Talea, target=_top]; } 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" -> "abjadext.rmakers.Talea.Talea"; "builtins.object" -> "abjad.system.AbjadObject.AbjadObject"; }

class abjadext.rmakers.Talea.Talea(*, counts=(1, ), denominator=16, preamble=None)

Talea.

>>> talea = abjadext.rmakers.Talea(
...     counts=[2, 1, 3, 2, 4, 1, 1],
...     denominator=16,
...     preamble=[1, 1, 1, 1],
...     )
>>> abjad.f(talea)
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    preamble=[1, 1, 1, 1],
    )

Attributes Summary

__contains__ Is true when talea contains argument.
__getitem__ Gets item or slice identified by argument.
__iter__ Iterates talea.
__len__ Gets length.
advance Advances talea by weight.
counts Gets counts.
denominator Gets denominator.
period Gets period of talea.
preamble Gets preamble.

Special methods

__contains__(argument)

Is true when talea contains argument.

With preamble:

>>> talea = abjadext.rmakers.Talea(
...     counts=[10],
...     denominator=16,
...     preamble=[1, -1, 1],
...     )
>>> for i in range(1, 23 + 1):
...     i, i in talea
...
(1, True)
(2, True)
(3, True)
(4, False)
(5, False)
(6, False)
(7, False)
(8, False)
(9, False)
(10, False)
(11, False)
(12, False)
(13, True)
(14, False)
(15, False)
(16, False)
(17, False)
(18, False)
(19, False)
(20, False)
(21, False)
(22, False)
(23, True)
Return type:bool
(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.

(AbjadObject).__format__(format_specification='')

Formats Abjad object.

Set format_specification to '' or 'storage'. Interprets '' equal to 'storage'.

Returns string.

__getitem__(argument)

Gets item or slice identified by argument.

Gets item at index:

>>> talea = abjadext.rmakers.Talea(
...     counts=[2, 1, 3, 2, 4, 1, 1],
...     denominator=16,
...     preamble=[1, 1, 1, 1],
...     )
>>> talea[0]
NonreducedFraction(1, 16)
>>> talea[1]
NonreducedFraction(1, 16)

Gets items in slice:

>>> for duration in talea[:6]:
...     duration
...
NonreducedFraction(1, 16)
NonreducedFraction(1, 16)
NonreducedFraction(1, 16)
NonreducedFraction(1, 16)
NonreducedFraction(2, 16)
NonreducedFraction(1, 16)
>>> for duration in talea[2:8]:
...     duration
...
NonreducedFraction(1, 16)
NonreducedFraction(1, 16)
NonreducedFraction(2, 16)
NonreducedFraction(1, 16)
NonreducedFraction(3, 16)
NonreducedFraction(2, 16)
Return type:Union[NonreducedFraction, List[NonreducedFraction]]
(AbjadValueObject).__hash__()

Hashes Abjad value object.

Returns integer.

__iter__()

Iterates talea.

>>> talea = abjadext.rmakers.Talea(
...     counts=[2, 1, 3, 2, 4, 1, 1],
...     denominator=16,
...     preamble=[1, 1, 1, 1],
...     )
>>> for duration in talea:
...     duration
...
Duration(1, 16)
Duration(1, 16)
Duration(1, 16)
Duration(1, 16)
Duration(1, 8)
Duration(1, 16)
Duration(3, 16)
Duration(1, 8)
Duration(1, 4)
Duration(1, 16)
Duration(1, 16)
Return type:Generator[+T_co, -T_contra, +V_co]
__len__()

Gets length.

>>> talea = abjadext.rmakers.Talea(
...     counts=[2, 1, 3, 2, 4, 1, 1],
...     denominator=16,
...     )
>>> len(talea)
7

Defined equal to length of counts.

Return type:int
(AbjadObject).__repr__()

Gets interpreter representation of Abjad object.

Returns string.


Methods

advance(weight)

Advances talea by weight.

>>> talea = abjadext.rmakers.Talea(
...     counts=[2, 1, 3, 2, 4, 1, 1],
...     denominator=16,
...     preamble=[1, 1, 1, 1],
...     )
>>> abjad.f(talea.advance(0))
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    preamble=[1, 1, 1, 1],
    )
>>> abjad.f(talea.advance(1))
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    preamble=[1, 1, 1],
    )
>>> abjad.f(talea.advance(2))
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    preamble=[1, 1],
    )
>>> abjad.f(talea.advance(3))
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    preamble=[1],
    )
>>> abjad.f(talea.advance(4))
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    )
>>> abjad.f(talea.advance(5))
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    preamble=[1, 1, 3, 2, 4, 1, 1],
    )
>>> abjad.f(talea.advance(6))
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    preamble=[1, 3, 2, 4, 1, 1],
    )
>>> abjad.f(talea.advance(7))
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    preamble=[3, 2, 4, 1, 1],
    )
>>> abjad.f(talea.advance(8))
abjadext.rmakers.Talea(
    counts=[2, 1, 3, 2, 4, 1, 1],
    denominator=16,
    preamble=[2, 2, 4, 1, 1],
    )

REGRESSION. Works when talea advances by period of talea:

>>> talea = abjadext.rmakers.Talea(
...     counts=[1, 2, 3, 4],
...     denominator=16,
...     )
>>> abjad.f(talea.advance(10))
abjadext.rmakers.Talea(
    counts=[1, 2, 3, 4],
    denominator=16,
    )
>>> abjad.f(talea.advance(20))
abjadext.rmakers.Talea(
    counts=[1, 2, 3, 4],
    denominator=16,
    )
Return type:Talea

Read-only properties

counts

Gets counts.

>>> talea = abjadext.rmakers.Talea(
...     counts=[2, 1, 3, 2, 4, 1, 1],
...     denominator=16,
...     )
>>> talea.counts
[2, 1, 3, 2, 4, 1, 1]
Return type:Optional[List[int]]
denominator

Gets denominator.

>>> talea = abjadext.rmakers.Talea(
...     counts=[2, 1, 3, 2, 4, 1, 1],
...     denominator=16,
...     )
>>> talea.denominator
16

Set to nonnegative integer power of two.

Defaults to 16.

Return type:int
period

Gets period of talea.

Equal to weight of counts:

>>> talea = abjadext.rmakers.Talea(
...     counts=[1, 2, 3, 4],
...     denominator=16,
...     )
>>> talea.period
10

Rests make no difference:

>>> talea = abjadext.rmakers.Talea(
...     counts=[1, 2, -3, 4],
...     denominator=16,
...     )
>>> talea.period
10

Denominator makes no difference:

>>> talea = abjadext.rmakers.Talea(
...     counts=[1, 2, -3, 4],
...     denominator=32,
...     )
>>> talea.period
10

Preamble makes no difference:

>>> talea = abjadext.rmakers.Talea(
...     counts=[1, 2, -3, 4],
...     denominator=32,
...     preamble=[1, 1, 1],
...     )
>>> talea.period
10
Return type:int
preamble

Gets preamble.

>>> talea = abjadext.rmakers.Talea(
...     counts=[2, 1, 3, 2, 4, 1, 1],
...     denominator=16,
...     preamble=[1, 1, 1, 1],
...     )
>>> talea.preamble
[1, 1, 1, 1]
>>> talea = abjadext.rmakers.Talea(
...     counts=[16, -4, 16],
...     denominator=16,
...     preamble=[1],
...     )
>>> for i, duration in enumerate(talea):
...     duration
...
Duration(1, 16)
Duration(1, 1)
Duration(-1, 4)
Duration(1, 1)
Return type:Optional[List[int]]