common Module

StructPacking Class

class oscpython.common.StructPacking(value: Tuple[Any], format: str)[source]

Bases: object

Helper for zipping struct format strings and values

ArgumentList Class

class oscpython.common.ArgumentList(initlist=None)[source]

Bases: object

Container for Argument

append(item: oscpython.arguments.Argument)[source]

Add an Argument

extend(other)[source]

Merge a sequence of Argument instances or another ArgumentList

get_struct_fmt()str[source]

Get the struct format string for all arguments in the list

pack()bytes[source]

Pack all arguments in the list to binary using struct.pack()

formats()Iterable[str][source]

Iterate over the format strings for each argument

values()Iterable[Any][source]

Iterate (flattened) over all argument values (taken from arguments.Argument.get_pack_value())

Client Class

class oscpython.common.Client(address: str, port: int)[source]

Bases: object

A network address and port

address: str

The host address

port: int

The service port

to_tuple()Tuple[str, int][source]

Create a tuple of (address, port)

classmethod from_tuple(addr: Tuple[str, int])oscpython.common.Client[source]

Create a Client from a tuple of (address, port)

TimeTag Class

class oscpython.common.TimeTag(seconds: int = 0, fraction: int = 0)[source]

Bases: object

An OSC timetag represented as two 32-bit integers (formatted as NTP)

The values for seconds and fraction are relative to the NTP epoch (number of seconds since January 1, 1900).

seconds: int = 0

Whole number of seconds since the epoch

fraction: int = 0

32-bit integer representing the fractional remainder of seconds

Immediately: ClassVar[oscpython.common.TimeTag] = TimeTag(seconds=0, fraction=1)

A constant used to send a special-case timetag meaning “immediately”

property is_immediate

Whether the special case of “immediately” is indicated

property float_seconds

The seconds and fraction combined into a float

to_epoch()float[source]

Return the values as a POSIX timestamp

to_datetime_utc()datetime.datetime[source]

Create a datetime.datetime in UTC

to_datetime()datetime.datetime[source]

Create a datetime.datetime with the local timezone offset

Note

The returned datetime is naive (tzinfo=None)

classmethod from_float(value: float)oscpython.common.TimeTag[source]

Create a TimeTag from an NTP timestamp

classmethod from_epoch(seconds: float)oscpython.common.TimeTag[source]

Create a TimeTag from a POSIX timestamp

classmethod from_datetime(dt: datetime.datetime)oscpython.common.TimeTag[source]

Create a TimeTag from a datetime.datetime

The timezone behavior of the given datetime matches that of datetime.datetime.timestamp()

classmethod now()oscpython.common.TimeTag[source]

Create a TimeTag from the current date and time

classmethod utcnow()oscpython.common.TimeTag[source]

Create a TimeTag using the current UTC date and time

ColorRGBA Class

class oscpython.common.ColorRGBA(r: int = 0, g: int = 0, b: int = 0, a: int = 0)[source]

Bases: object

A 32-bit RGBA color with 8 bits per component

r: int = 0

Red component (0-255)

g: int = 0

Green component (0-255)

b: int = 0

Blue component (0-255)

a: int = 0

Alpha component (0-255)

MidiMessage Class

class oscpython.common.MidiMessage(port_id: int = 0, status_byte: int = 0, data1: int = 0, data2: int = 0)[source]

Bases: object

A 4-byte MIDI message

port_id: int = 0

Port id

status_byte: int = 0

status_byte

data1: int = 0

data1

data2: int = 0

data2

Infinitum Class

class oscpython.common.Infinitum[source]

Bases: object

An OSC “Infinitum” argument, typically referred to as an “Impulse”

There is no value for the argument as its presence in an OSC message provides the only semantic meaning.