Classes

OSCPacket

class osc.OSCPacket(dgram)

Unit of transmission of the OSC protocol.

Any application that sends OSC Packets is an OSC Client. Any application that receives OSC Packets is an OSC Server.

items

Returns asc-time-sorted TimedMessages of the messages in this packet.

OSCMessage

class osc.OSCMessage(address=None)

Builds arbitrary OSCMessage instances.

address

Returns the OSC address this message will be sent to.

args

Returns list of arguments values.

params

Returns the (type, value) arguments list of this message.

size

Returns the length of the datagram for this message.

dgram

Returns the datagram from which this message was built.

add(arg_value, arg_type=None)

Add a typed argument to this message.

Args:
  • arg_value: The corresponding value for the argument.

  • arg_type: A value in ARG_TYPE_* defined in this class,

    if none then the type will be guessed.

Raises:
  • ValueError: if the type is not supported.
build()

Builds an OSCMessage from the current state of this builder.

Raises:
  • MessageBuildError: if the message could not be build or if the address was empty.
Returns:
  • an OSCMessage instance.
is_bundle()

Returns whether this is bundle or not

static parse(dgram)

Create OSCMessage from datagram

Args:
  • dgram: from what to build OSCMessage
Returns:
OSCMessage
static is_valid(dgram)

Returns whether this datagram starts as an OSC message.

OSCBundle

class osc.OSCBundle(timestamp=0)

Builds arbitrary OSCBundle instances.

timestamp

Returns the timestamp associated with this bundle.

length

Returns number of messages in bundle.

size

Returns the length of the datagram for this bundle.

dgram

Returns the datagram from which this bundle was built.

add(content)

Add a new content to this bundle.

Args:
  • content: Either an OSCBundle or an OSCMessage
build()

Build an OSCBundle with the current state of this builder.

Raises:
  • BundleBuildError: if we could not build the bundle.
content(index)

Returns the bundle’s content 0-indexed.

is_bundle()

Returns whether this is bundle or not.

static is_valid(dgram)

Returns whether this datagram starts like an OSC bundle.

OSCServer

Subclass OSCServer for message handling

class osc.OSCServer(address, port)

Superclass for different flavors of OSCServer

handle(address, message, time)

Handle recieving of OSCMessage or OSCBundle

Args:
  • address: typle (host, port)
  • message: OSCMessage or OSCBundle
  • time: int number which represents time of message

OSCClient

Subclass from OSCClient if you want to send something custom

class osc.OSCClient(address, port)

OSC client to send OSCMessages or OSCBundle’s via UDP.

send(message)

Sends an OSCBundle or OSCMessage to the server.