classes

The rmakers classes.

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_abjadext.rmakers.classes" { graph [label="abjadext.rmakers.classes"]; node [color=1]; "abjadext.rmakers.classes.Incise" [URL="../api/abjadext/rmakers/classes.html#abjadext.rmakers.classes.Incise", color=black, fontcolor=white, label=Incise, target=_top]; "abjadext.rmakers.classes.Interpolation" [URL="../api/abjadext/rmakers/classes.html#abjadext.rmakers.classes.Interpolation", color=black, fontcolor=white, label=Interpolation, target=_top]; "abjadext.rmakers.classes.Spelling" [URL="../api/abjadext/rmakers/classes.html#abjadext.rmakers.classes.Spelling", color=black, fontcolor=white, label=Spelling, target=_top]; "abjadext.rmakers.classes.Talea" [URL="../api/abjadext/rmakers/classes.html#abjadext.rmakers.classes.Talea", color=black, fontcolor=white, label=Talea, target=_top]; } subgraph cluster_builtins { graph [label=builtins]; node [color=2]; "builtins.object" [URL="https://docs.python.org/3.10/library/functions.html#object", label=object, target=_top]; } "builtins.object" -> "abjadext.rmakers.classes.Incise" [minlen=1]; "builtins.object" -> "abjadext.rmakers.classes.Interpolation" [minlen=2]; "builtins.object" -> "abjadext.rmakers.classes.Spelling" [minlen=1]; "builtins.object" -> "abjadext.rmakers.classes.Talea" [minlen=2]; }


Specifiers

Incise

Incise specifier.

Interpolation

Interpolation specifier.

Spelling

Duration spelling specifier.

Talea

Talea specifier.

class abjadext.rmakers.classes.Incise(body_ratio=(1,), fill_with_rests=False, outer_tuplets_only=False, prefix_counts=(), prefix_talea=(), suffix_counts=(), suffix_talea=(), talea_denominator=None)[source]

Incise specifier.


Attributes Summary

__delattr__

Implement delattr(self, name).

__eq__

Return self==value.

__ge__

Return self>=value.

__gt__

Return self>value.

__hash__

Return hash(self).

__le__

Return self<=value.

__lt__

Return self<value.

__post_init__

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).


Special methods

overridden __delattr__(name)

Implement delattr(self, name).

overridden __eq__(other)

Return self==value.

overridden __ge__(other)

Return self>=value.

overridden __gt__(other)

Return self>value.

overridden __hash__()

Return hash(self).

overridden __le__(other)

Return self<=value.

overridden __lt__(other)

Return self<value.

__post_init__()[source]
overridden __repr__()

Return repr(self).

overridden __setattr__(name, value)

Implement setattr(self, name, value).

class abjadext.rmakers.classes.Interpolation(start_duration=Duration(1, 8), stop_duration=Duration(1, 16), written_duration=Duration(1, 16))[source]

Interpolation specifier.


Attributes Summary

__delattr__

Implement delattr(self, name).

__eq__

Return self==value.

__ge__

Return self>=value.

__gt__

Return self>value.

__hash__

Return hash(self).

__le__

Return self<=value.

__lt__

Return self<value.

__post_init__

rtype:

None

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

reverse

Swaps start duration and stop duration of interpolation specifier.


Special methods

overridden __delattr__(name)

Implement delattr(self, name).

overridden __eq__(other)

Return self==value.

overridden __ge__(other)

Return self>=value.

overridden __gt__(other)

Return self>value.

overridden __hash__()

Return hash(self).

overridden __le__(other)

Return self<=value.

overridden __lt__(other)

Return self<value.

__post_init__()[source]
Return type:

None

overridden __repr__()

Return repr(self).

overridden __setattr__(name, value)

Implement setattr(self, name, value).


Methods

reverse()[source]

Swaps start duration and stop duration of interpolation specifier.

Changes accelerando specifier to ritardando specifier:

>>> specifier = rmakers.Interpolation(
...     start_duration=abjad.Duration(1, 4),
...     stop_duration=abjad.Duration(1, 16),
...     written_duration=abjad.Duration(1, 16),
... )
>>> specifier.reverse()
Interpolation(start_duration=Duration(1, 16), stop_duration=Duration(1, 4), written_duration=Duration(1, 16))

Changes ritardando specifier to accelerando specifier:

>>> specifier = rmakers.Interpolation(
...     start_duration=abjad.Duration(1, 16),
...     stop_duration=abjad.Duration(1, 4),
...     written_duration=abjad.Duration(1, 16),
... )
>>> specifier.reverse()
Interpolation(start_duration=Duration(1, 4), stop_duration=Duration(1, 16), written_duration=Duration(1, 16))
Return type:

Interpolation

class abjadext.rmakers.classes.Spelling(forbidden_note_duration=None, forbidden_rest_duration=None, increase_monotonic=False)[source]

Duration spelling specifier.

Decreases monotically:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in pairs]
...     tuplets = rmakers.talea(
...         durations,
...         [5],
...         16,
...         spelling=rmakers.Spelling(increase_monotonic=False),
...     )
...     lilypond_file_ = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file_["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file_
... 
>>> lilypond_file = make_lilypond_file([(3, 4), (3, 4)])
>>> abjad.show(lilypond_file)  

Increases monotically:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(
...         durations,
...         [5],
...         16,
...         spelling=rmakers.Spelling(increase_monotonic=True),
...     )
...     lilypond_file_ = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file_["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file_
... 
>>> pairs = [(3, 4), (3, 4)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Forbids note durations equal to 1/4 or greater:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(
...         durations,
...         [1, 1, 1, 1, 4, -4],
...         16,
...         spelling=rmakers.Spelling(forbidden_note_duration=abjad.Duration(1, 4)),
...     )
...     lilypond_file_ = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file_["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file_
... 
>>> pairs = [(3, 4), (3, 4)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Forbids rest durations equal to 1/4 or greater:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(
...         durations,
...         [1, 1, 1, 1, 4, -4],
...         16,
...         spelling=rmakers.Spelling(forbidden_rest_duration=abjad.Duration(1, 4)),
...     )
...     lilypond_file_ = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file_["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file_
... 
>>> pairs = [(3, 4), (3, 4)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Spells nonassignable durations with monontonically decreasing durations:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(
...         durations,
...         [5],
...         16,
...         spelling=rmakers.Spelling(increase_monotonic=False),
...     )
...     container = abjad.Container(tuplets)
...     rmakers.beam(container)
...     rmakers.extract_trivial(container)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(5, 8), (5, 8), (5, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Spells nonassignable durations with monontonically increasing durations:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(
...         durations,
...         [5],
...         16,
...         spelling=rmakers.Spelling(increase_monotonic=True),
...     )
...     container = abjad.Container(tuplets)
...     rmakers.beam(container)
...     rmakers.extract_trivial(container)
...     components = abjad.mutate.eject_contents(container)
...     lilypond_file = rmakers.example(components, time_signatures)
...     return lilypond_file
... 
>>> pairs = [(5, 8), (5, 8), (5, 8)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Forbids durations equal to 1/4 or greater:

>>> def make_lilypond_file(pairs):
...     time_signatures = rmakers.time_signatures(pairs)
...     durations = [abjad.Duration(_) for _ in time_signatures]
...     tuplets = rmakers.talea(
...         durations,
...         [1, 1, 1, 1, 4, 4],
...         16,
...         spelling=rmakers.Spelling(forbidden_note_duration=abjad.Duration(1, 4)),
...     )
...     lilypond_file = rmakers.example(tuplets, time_signatures)
...     voice = lilypond_file["Voice"]
...     rmakers.beam(voice)
...     rmakers.extract_trivial(voice)
...     return lilypond_file
... 
>>> pairs = [(3, 4), (3, 4)]
>>> lilypond_file = make_lilypond_file(pairs)
>>> abjad.show(lilypond_file)  

Rewrites forbidden durations with smaller durations tied together.


Attributes Summary

__delattr__

Implement delattr(self, name).

__eq__

Return self==value.

__ge__

Return self>=value.

__gt__

Return self>value.

__hash__

Return hash(self).

__le__

Return self<=value.

__lt__

Return self<value.

__post_init__

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).


Special methods

overridden __delattr__(name)

Implement delattr(self, name).

overridden __eq__(other)

Return self==value.

overridden __ge__(other)

Return self>=value.

overridden __gt__(other)

Return self>value.

overridden __hash__()

Return hash(self).

overridden __le__(other)

Return self<=value.

overridden __lt__(other)

Return self<value.

__post_init__()[source]
overridden __repr__()

Return repr(self).

overridden __setattr__(name, value)

Implement setattr(self, name, value).

class abjadext.rmakers.classes.Talea(counts, denominator, end_counts=(), preamble=())[source]

Talea specifier.

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

Equal to weight of counts:

>>> rmakers.Talea([1, 2, 3, 4], 16).period
10

Rests make no difference:

>>> rmakers.Talea([1, 2, -3, 4], 16).period
10

Denominator makes no difference:

>>> rmakers.Talea([1, 2, -3, 4], 32).period
10

Preamble makes no difference:

>>> talea = rmakers.Talea(
...     [1, 2, -3, 4],
...     32,
...     preamble=[1, 1, 1],
... )
>>> talea.period
10
>>> talea = rmakers.Talea(
...     [2, 1, 3, 2, 4, 1, 1],
...     16,
...     preamble=[1, 1, 1, 1],
... )
>>> talea.preamble
[1, 1, 1, 1]
>>> talea = rmakers.Talea(
...     [16, -4, 16],
...     16,
...     preamble=[1],
... )
>>> for i, duration in enumerate(talea):
...     duration
... 
Duration(1, 16)
Duration(1, 1)
Duration(-1, 4)
Duration(1, 1)

Attributes Summary

__contains__

Is true when talea contains argument.

__delattr__

Implement delattr(self, name).

__eq__

Return self==value.

__ge__

Return self>=value.

__getitem__

Gets item or slice identified by argument.

__gt__

Return self>value.

__hash__

Return hash(self).

__iter__

Iterates talea.

__le__

Return self<=value.

__len__

Gets length.

__lt__

Return self<value.

__post_init__

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

advance

Advances talea by weight.

period

Gets period of talea.


Special methods

__contains__(argument)[source]

Is true when talea contains argument.

With preamble:

>>> talea = rmakers.Talea(
...     [10],
...     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

overridden __delattr__(name)

Implement delattr(self, name).

overridden __eq__(other)

Return self==value.

overridden __ge__(other)

Return self>=value.

__getitem__(argument)[source]

Gets item or slice identified by argument.

Gets item at index:

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

Gets items in slice:

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

tuple[int, int] | list[tuple[int, int]]

overridden __gt__(other)

Return self>value.

overridden __hash__()

Return hash(self).

__iter__()[source]

Iterates talea.

>>> talea = rmakers.Talea(
...     [2, 1, 3, 2, 4, 1, 1],
...     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:

Iterator[Duration]

overridden __le__(other)

Return self<=value.

__len__()[source]

Gets length.

>>> len(rmakers.Talea([2, 1, 3, 2, 4, 1, 1], 16))
7

Defined equal to length of counts.

Return type:

int

overridden __lt__(other)

Return self<value.

__post_init__()[source]
overridden __repr__()

Return repr(self).

overridden __setattr__(name, value)

Implement setattr(self, name, value).


Methods

advance(weight)[source]

Advances talea by weight.

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

REGRESSION. Works when talea advances by period of talea:

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

Talea


Read-only properties

period

Gets period of talea.

Equal to weight of counts:

>>> rmakers.Talea([1, 2, 3, 4], 16).period
10

Rests make no difference:

>>> rmakers.Talea([1, 2, -3, 4], 16).period
10

Denominator makes no difference:

>>> rmakers.Talea([1, 2, -3, 4], 32).period
10

Preamble makes no difference:

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