OSC Server#

API#

The OSC server handles the backend communication from SuperCollider. As OSC useses UDP and it is designed in an async manner we have to send back any result from SuperCollider via a new OSC message. As Django does not natively understand UDP messages and OSC is a rather restrictive protocol we created this server which is able to receive this messages and makes it available to our Django app by using its ORM.

Each SuperCollider instance sends a beacon in order to get discovered by the backend as a StreamPoint.

This is not a Django app but an application on its own.

Todo

A long term goal would be to include this into the Django process but it seems gunicorn only runs when a request hits, making the necessary polling for received messages not working properly.

Server#

A naive server to receive OSC messages from SuperCollider.

class osc_server.server.OSCServer[source]#

Uses pythonosc to map the routes

Routes#

route

method

message

/beacon

beacon_handler()

SCBeaconMessage

/acknowledge_handler

acknowledge_handler()

SCAcknowledgeMessage

/remote/action

remote_action_handler()

RemoteActionMessage

__init__()[source]#
acknowledge_handler(client_address, address, *osc_args)[source]#

Acknowledges a message and updates its associated StreamInstruction.

Return type

None

beacon_handler(client_address, address, *osc_args)[source]#

Accepts a beacon from SuperCollider and creates a StreamPoint from it so it gets discovered by the backend.

Return type

None

remote_action_handler(client_address, address, *osc_args)[source]#

Remote actions are used to trigger actions on a SuperCollider instance and can be send in form of a StreamInstruction or raw from a local running SuperCollider instance which can be used to live code the SuperCollider instances managed by Gencaster.

Return type

None

Models#

Allows to use some static type checks for messages receiving from SuperCollider.

OSCAuthMixin#

Allows to validate a given password for backends.

type

object

properties

  • password

Password

type

string

SCAcknowledgeMessage#

See StreamInstruction.

type

object

properties

  • uuid

Uuid

UUID from stream.models.StreamInstruction

type

string

  • status

#/definitions/GenCasterStatusEnum

  • return_value

Return Value

Allows to store a return value in the database if given.

type

string

definitions

  • GenCasterStatusEnum

GenCasterStatusEnum

Status of our callback.

type

string

enum

SUCCESS, FAILURE, READY, FINISHED, BEACON, RECEIVED

SCBeaconMessage#

Will create a StreamPoint.

type

object

properties

  • name

Name

type

string

  • synth_port

Synth Port

type

integer

  • lang_port

Lang Port

type

integer

  • janus_out_port

Janus Out Port

type

integer

  • janus_in_port

Janus In Port

type

integer

  • janus_out_room

Janus Out Room

type

integer

  • janus_in_room

Janus In Room

type

integer

  • janus_public_ip

Janus Public Ip

type

string

  • use_input

Use Input

type

boolean

  • osc_backend_host

Osc Backend Host

type

string

  • osc_backend_port

Osc Backend Port

type

integer

RemoteActionMessage#

Sends message to SuperCollider cluster.

type

object

properties

  • password

Password

type

string

  • action

#/definitions/RemoteActionType

  • cmd

Cmd

type

string

  • target

Target

type

string

  • protocol_version

Protocol Version

Can be used to upgrade our communication by rejecting older clients/messages

type

string

definitions

  • RemoteActionType

RemoteActionType

Requests an action on SuperCollider instance.

type

string

enum

code, speak

exception osc_server.exceptions.MalformedOscMessage[source]#

OSC message has wrong layout.

exception osc_server.exceptions.OscBackendAuthException[source]#

Authentication failed.