BusGroup

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_builtins { graph [label=builtins]; node [color=1]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } subgraph "cluster_supriya.realtime" { graph [label="supriya.realtime"]; node [color=2]; "supriya.realtime.AudioInputBusGroup.AudioInputBusGroup" [URL="../api/supriya/realtime/AudioInputBusGroup.html#supriya.realtime.AudioInputBusGroup.AudioInputBusGroup", label="Audio\nInput\nBus\nGroup", target=_top]; "supriya.realtime.AudioOutputBusGroup.AudioOutputBusGroup" [URL="../api/supriya/realtime/AudioOutputBusGroup.html#supriya.realtime.AudioOutputBusGroup.AudioOutputBusGroup", label="Audio\nOutput\nBus\nGroup", target=_top]; "supriya.realtime.BusGroup.BusGroup" [URL="../api/supriya/realtime/BusGroup.html#supriya.realtime.BusGroup.BusGroup", color=black, fontcolor=white, label="Bus\nGroup", target=_top]; "supriya.realtime.ServerObjectProxy.ServerObjectProxy" [URL="../api/supriya/realtime/ServerObjectProxy.html#supriya.realtime.ServerObjectProxy.ServerObjectProxy", label="Server\nObject\nProxy", shape=oval, style=bold, target=_top]; "supriya.realtime.BusGroup.BusGroup" -> "supriya.realtime.AudioInputBusGroup.AudioInputBusGroup"; "supriya.realtime.BusGroup.BusGroup" -> "supriya.realtime.AudioOutputBusGroup.AudioOutputBusGroup"; "supriya.realtime.ServerObjectProxy.ServerObjectProxy" -> "supriya.realtime.BusGroup.BusGroup"; } subgraph "cluster_supriya.system" { graph [label="supriya.system"]; node [color=3]; "supriya.system.SupriyaObject.SupriyaObject" [URL="../api/supriya/realtime/../system/SupriyaObject.html#supriya.system.SupriyaObject.SupriyaObject", label="Supriya\nObject", target=_top]; } "builtins.object" -> "supriya.system.SupriyaObject.SupriyaObject"; "supriya.system.SupriyaObject.SupriyaObject" -> "supriya.realtime.ServerObjectProxy.ServerObjectProxy"; }

class supriya.realtime.BusGroup.BusGroup(bus_count=1, calculation_rate=CalculationRate.CONTROL, bus_id=None)[source]

A bus group.

>>> server = supriya.Server().boot()
>>> bus_group = supriya.BusGroup(bus_count=4)
>>> bus_group
<- BusGroup{4}: ??? (control)>
>>> bus_group.allocate()
<+ BusGroup{4}: 0 (control)>
>>> bus_group[2]
<+ Bus: 2 (control)>
>>> for i in range(len(bus_group)):
...     bus = bus_group[i]
...     value = (i * 0.2) + 0.1
...     bus.set(value)
...
>>> bus_values = bus_group.get()

Values in scsynth don’t necessarily have the same precision as in Python, so we’ll round them here for display purposes:

>>> print([round(value, 1) for value in bus_values])
[0.1, 0.3, 0.5, 0.7]
>>> print(bus_group)
c0
>>> bus_group.free()
<- BusGroup{4}: ??? (control)>

Attributes Summary

__contains__ Test if a bus belongs to the bus group.
__float__
__getitem__ Get item in bus group.
__int__
__iter__
__len__
__repr__ Return repr(self).
__str__ Gets map symbol representation of bus group.
allocate
ar Creates an audio-rate input ugen subgraph.
audio
bus_id
buses
calculation_rate
control
fill Fill buses in bus group with value.
free
get Get bus group values.
index
is_allocated
kr Creates a control-rate input ugen subgraph.
map_symbol
set Set bus group values.

Special methods

__contains__(item)[source]

Test if a bus belongs to the bus group.

>>> bus_group = supriya.BusGroup.control(4)
>>> bus_group[0] in bus_group
True
>>> bus = supriya.Bus.audio()
>>> bus in bus_group
False
__float__()[source]
__getitem__(item)[source]

Get item in bus group.

>>> server = supriya.Server().boot()
>>> bus_group = supriya.BusGroup.control(4).allocate()
>>> bus_group[0]
<+ Bus: 0 (control)>
>>> bus_group[1:]
<+ BusGroup{3}: 1 (control)>
__int__()[source]
__iter__()[source]
__len__()[source]
__repr__()[source]

Return repr(self).

__str__()[source]

Gets map symbol representation of bus group.

>>> server = supriya.Server().boot()
>>> control_bus_group = supriya.BusGroup.control(4).allocate()
>>> audio_bus_group = supriya.BusGroup.audio(4).allocate()
>>> print(str(control_bus_group))
c0
>>> print(str(audio_bus_group))
a16

Methods

allocate(server=None)[source]
ar()[source]

Creates an audio-rate input ugen subgraph.

>>> import supriya.realtime
>>> audio_bus_group = supriya.realtime.BusGroup(
...     bus_id=8,
...     bus_count=4,
...     calculation_rate='audio',
...     )
>>> ugen = audio_bus_group.ar()
>>> graph(ugen)  
>>> print(ugen)
synthdef:
    name: 0af6b551a643cad01e9994845ff4ae40
    ugens:
    -   In.ar:
            bus: 8.0
>>> control_bus_group = supriya.realtime.BusGroup(
...     bus_id=8,
...     bus_count=4,
...     calculation_rate='control',
...     )
>>> ugen = control_bus_group.ar()
>>> graph(ugen)  
>>> print(ugen)
synthdef:
    name: ecaa7fe9417cb0742cdcda87657fe9de
    ugens:
    -   In.kr:
            bus: 8.0
    -   K2A.ar/0:
            source: In.kr[0]
    -   K2A.ar/1:
            source: In.kr[1]
    -   K2A.ar/2:
            source: In.kr[2]
    -   K2A.ar/3:
            source: In.kr[3]

Returns ugen.

fill(value)[source]

Fill buses in bus group with value.

>>> server = supriya.Server().boot()
>>> bus_group = supriya.BusGroup.control(4).allocate()
>>> bus_group.get()
(0.0, 0.0, 0.0, 0.0)
>>> bus_group.fill(0.5)
>>> bus_group.get()
(0.5, 0.5, 0.5, 0.5)
>>> bus_group = supriya.BusGroup.audio(4)
>>> bus_group.fill(0.5)
Traceback (most recent call last):
...
supriya.exceptions.BusNotAllocated
>>> bus_group.allocate().fill(0.5)
Traceback (most recent call last):
...
supriya.exceptions.IncompatibleRate
free()[source]
get()[source]

Get bus group values.

>>> server = supriya.Server().boot()
>>> bus_group = supriya.BusGroup().control(4).allocate()
>>> bus_group.get()
(0.0, 0.0, 0.0, 0.0)
index(item)[source]
kr()[source]

Creates a control-rate input ugen subgraph.

>>> import supriya.realtime
>>> audio_bus_group = supriya.realtime.BusGroup(
...     bus_id=8,
...     bus_count=4,
...     calculation_rate='audio',
...     )
>>> ugen = audio_bus_group.kr()
>>> graph(ugen)  
>>> print(ugen)
synthdef:
    name: ffeda833c370bc644251437469e243ef
    ugens:
    -   In.ar:
            bus: 8.0
    -   A2K.kr/0:
            source: In.ar[0]
    -   A2K.kr/1:
            source: In.ar[1]
    -   A2K.kr/2:
            source: In.ar[2]
    -   A2K.kr/3:
            source: In.ar[3]
>>> control_bus_group = supriya.realtime.BusGroup(
...     bus_id=8,
...     bus_count=4,
...     calculation_rate='control',
...     )
>>> ugen = control_bus_group.kr()
>>> graph(ugen)  
>>> print(ugen)
synthdef:
    name: b64857a04b384841694ba85f74f0fd0b
    ugens:
    -   In.kr:
            bus: 8.0

Returns ugen.

set(values)[source]

Set bus group values.

>>> server = supriya.Server().boot()
>>> bus_group = supriya.BusGroup.control(4).allocate()
>>> bus_group.get()
(0.0, 0.0, 0.0, 0.0)
>>> bus_group.set((-0.5, 0.5, -0.5, 0.5))
>>> bus_group.get()
(-0.5, 0.5, -0.5, 0.5)

Class & static methods

classmethod audio(bus_count=1)[source]
classmethod control(bus_count=1)[source]

Read-only properties

bus_id
buses
calculation_rate
is_allocated
map_symbol