sc3.synth.bus module

Bus.sc

exception BusException

Bases: Exception

exception BusAlreadyFreed(method=None)

Bases: sc3.synth.bus.BusException

class Bus(value)

Bases: sc3.synth._graphparam.UGenParameter, sc3.synth._graphparam.NodeParameter

Client side representation of server buses.

Bus objects are used to keep track and manage the buses being used in the server, they can be passed as arguments instead of using the bus number directly.

From ControlBus objects bus values can be obtained or assigned via OSC commands.

Parameters
  • channels (int) – Number of channels, default is 1.

  • server (Server) – Target server.

  • index (int) – Sets the bus index. If index is None bus number is automatically allocated (client side) by the bus allocator class.

property index

Bus index in the server.

property channels

Number of channels.

property server

Target server of the bus object.

classmethod new_from(bus, offset, channels=1)

Create a new object from bus.

Parameters
  • bus (Bus) – The bus from wich to create the new object.

  • offset (int) – Channel offset from wich to create the new bus object.

  • channels (int) – Number of channels from to count from offset.

sub_bus(offset, channels=1)

Return a sub-range of channels from this bus.

free()
class AudioBus(channels=1, server=None, index=None)

Bases: sc3.synth.bus.Bus

free()

Free the bus object index.

as_map()

Return the map string of this bus.

class ControlBus(channels=1, server=None, index=None)

Bases: sc3.synth.bus.Bus

clear()

Set bus value to zero for all channels.

free()

Free the bus object index.

as_map()

Return the map string of this bus.

set(*values)

Set bus value or values for consecutive channels.

This method uses ‘/c_set’ command. The length of *values shouldn’t be larger than the number of channels or it will override values set by other bus objects.

setn(values)

Set the list of values to consecutive channels.

This method uses ‘/c_setn’ command that sets a list of values to a contiguous range of buses. The length of *values shouldn’t be larger than the number of channels or it will override values set by other bus objects.

set_at(offset, *values)

Set the value of consecutive buses using ‘/c_set’ command.

Parameters
  • offset (int) – Start index relative to this bus index.

  • *values (float) – A scalar value for each consecutive bus.

Notes

Booth set_at and set_pairs are different parameter organizations for the ‘/c_set’ command.

setn_at(offset, values)

Set the value of consecutive buses using ‘/c_setn’ command.

Parameters
  • offset (int) – Start index relative to this bus index.

  • values (list[float]) – A list of values for each consecutive bus.

set_pairs(*pairs)

Set the value of buses by index relative to this bus.

Parameters

*paris (tuple(int, float)) – Tuples or lists indicating the index and value of each bus.

Notes

Booth set_at and set_pairs are different parameter organizations for the ‘/c_set’ command.

get(action=None)

Get the bus current value.

Parameters

action (function) – A function to be evaluated with the bus’ value as argument.

getn(count=None, action=None)

Get consecutive channels’ values from this bus index.

Parameters
  • count (int) – Number of channels to get the values from.

  • action (function) – A function to be evaluated with a list of buses’ values as argument.

fill(value, channels)

Set contiguous buses from this bus index to a single value.

This method uses ‘/c_fill’ command.

Parameters
  • value (int | float) – Value to assign in the buses.

  • channels (int) – Number of contiguous buses to set.