Pbind

class supriya.tools.patterntools.Pbind(synthdef=None, **patterns)[source]

A pattern binding.

>>> pattern = patterntools.Pbind(
...     pitch=patterntools.Pseq([0, 3, 7]),
...     duration=patterntools.Pseq([0.5, 0.25, 0.25, 0.125]),
...     foo=[1, 2],
...     bar=3,
...     )
>>> print(format(pattern))
supriya.tools.patterntools.Pbind(
    bar=3,
    duration=supriya.tools.patterntools.Pseq(
        (0.5, 0.25, 0.25, 0.125),
        repetitions=1,
        ),
    foo=[1, 2],
    pitch=supriya.tools.patterntools.Pseq(
        (0, 3, 7),
        repetitions=1,
        ),
    )
>>> for event in pattern:
...     event
...
NoteEvent(duration=0.5, is_stop=True, uuid=UUID('...'), bar=3, foo=(1, 2), pitch=0)
NoteEvent(duration=0.25, is_stop=True, uuid=UUID('...'), bar=3, foo=(1, 2), pitch=3)
NoteEvent(duration=0.25, is_stop=True, uuid=UUID('...'), bar=3, foo=(1, 2), pitch=7)
>>> pattern = patterntools.Pseq([
...     patterntools.Pbind(
...         pitch=patterntools.Pseq([1, 2, 3], 1),
...         ),
...     patterntools.Pbind(
...         pitch=patterntools.Pseq([4, 5, 6], 1),
...         ),
...     ], 1)
>>> for event in pattern:
...     event
...
NoteEvent(is_stop=True, uuid=UUID('...'), pitch=1)
NoteEvent(is_stop=True, uuid=UUID('...'), pitch=2)
NoteEvent(is_stop=True, uuid=UUID('...'), pitch=3)
NoteEvent(is_stop=True, uuid=UUID('...'), pitch=4)
NoteEvent(is_stop=True, uuid=UUID('...'), pitch=5)
NoteEvent(is_stop=True, uuid=UUID('...'), pitch=6)

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_builtins { graph [label=builtins]; "builtins.object" [color=1, group=0, label=object, shape=box]; } subgraph cluster_patterntools { graph [label=patterntools]; "supriya.tools.patterntools.EventPattern.EventPattern" [color=2, group=1, label=EventPattern, shape=oval, style=bold]; "supriya.tools.patterntools.Pattern.Pattern" [color=2, group=1, label=Pattern, shape=oval, style=bold]; "supriya.tools.patterntools.Pbind.Pbind" [color=black, fontcolor=white, group=1, label=<<B>Pbind</B>>, shape=box, style="filled, rounded"]; "supriya.tools.patterntools.Pmono.Pmono" [color=2, group=1, label=Pmono, shape=box]; "supriya.tools.patterntools.EventPattern.EventPattern" -> "supriya.tools.patterntools.Pbind.Pbind"; "supriya.tools.patterntools.Pattern.Pattern" -> "supriya.tools.patterntools.EventPattern.EventPattern"; "supriya.tools.patterntools.Pbind.Pbind" -> "supriya.tools.patterntools.Pmono.Pmono"; } subgraph cluster_systemtools { graph [label=systemtools]; "supriya.tools.systemtools.SupriyaObject.AbstractBase" [color=3, group=2, label=AbstractBase, shape=box]; "supriya.tools.systemtools.SupriyaObject.SupriyaObject" [color=3, group=2, label=SupriyaObject, shape=box]; "supriya.tools.systemtools.SupriyaValueObject.SupriyaValueObject" [color=3, group=2, label=SupriyaValueObject, shape=box]; "supriya.tools.systemtools.SupriyaObject.AbstractBase" -> "supriya.tools.systemtools.SupriyaObject.SupriyaObject"; "supriya.tools.systemtools.SupriyaObject.SupriyaObject" -> "supriya.tools.systemtools.SupriyaValueObject.SupriyaValueObject"; } "builtins.object" -> "supriya.tools.systemtools.SupriyaObject.AbstractBase"; "supriya.tools.systemtools.SupriyaValueObject.SupriyaValueObject" -> "supriya.tools.patterntools.Pattern.Pattern"; }

Attribute summary

arity
is_infinite
patterns
play([clock, event_template, server])
synthdef
with_bus([calculation_rate, channel_count, ...])
with_effect(synthdef[, release_time])
with_group([release_time])
__add__(expr) Adds expr to pattern.
__copy__(*args)
__div__(expr)
__eq__(expr)
__format__([format_specification]) Formats Supriya object.
__getitem__(item)
__hash__()
__iter__()
__mul__(expr)
__pow__(expr)
__radd__(expr)
__rdiv__(expr)
__repr__() Gets interpreter representation of Supriya object.
__rmul__(expr)
__rpow__(expr)
__rsub__(expr)
__sub__(expr)

Read-only properties

Pbind.arity
Pbind.is_infinite
Pbind.patterns
Pbind.synthdef

Methods

(EventPattern).play(clock=None, event_template=None, server=None)
(EventPattern).with_bus(calculation_rate='audio', channel_count=None, release_time=0.25)
(EventPattern).with_effect(synthdef, release_time=0.25, **settings)
(EventPattern).with_group(release_time=0.25)

Special methods

(Pattern).__add__(expr)

Adds expr to pattern.

>>> pattern = patterntools.Pseq([1, 2, 3])
>>> expr = patterntools.Pseq([0, 10])
>>> list(pattern + expr)
[1, 12]
>>> expr = 10
>>> list(pattern + expr)
[11, 12, 13]
>>> expr = [10, [100, 1000]]
>>> list(pattern + expr)
[[11, [101, 1001]], [12, [102, 1002]], [13, [103, 1003]]]
>>> pattern = patterntools.Pseq([[1, [2, 3]], [[4, 5], 6, 7]])
>>> expr = [10, [100, 1000]]
>>> for x in (pattern + expr):
...     x
...
[11, [102, 1003]]
[[14, 15], [106, 1006], 17]
(SupriyaValueObject).__copy__(*args)
(Pattern).__div__(expr)
(SupriyaValueObject).__eq__(expr)
(SupriyaObject).__format__(format_specification='')

Formats Supriya object.

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

Returns string.

Pbind.__getitem__(item)[source]
(SupriyaValueObject).__hash__()
(Pattern).__iter__()
(Pattern).__mul__(expr)
(Pattern).__pow__(expr)
(Pattern).__radd__(expr)
(Pattern).__rdiv__(expr)
(SupriyaObject).__repr__()

Gets interpreter representation of Supriya object.

Returns string.

(Pattern).__rmul__(expr)
(Pattern).__rpow__(expr)
(Pattern).__rsub__(expr)
(Pattern).__sub__(expr)