OSC Codec¶
nanosynth.osc ¶
Minimal standalone OSC message/bundle encode/decode.
OscMessage ¶
An Open Sound Control message with an address pattern and typed arguments.
Supports encoding to and decoding from the OSC binary wire format. Contents can be ints, floats, strings, bytes, bools, None, nested messages/bundles, or arrays. Uses C++ acceleration when available, falling back to a pure-Python implementation.
Args:
address: OSC address pattern (e.g. "/s_new") or integer address.
contents: Typed arguments (int, float, str, bytes, bool, None,
OscMessage, OscBundle, or sequences thereof).
from_datagram
classmethod
¶
from_datagram(datagram: bytes) -> OscMessage
Decode an OSC binary datagram into an OscMessage.
Raises OscError on malformed input (both the native and
pure-Python paths).
to_list ¶
to_list() -> list[Any]
Convert to a nested list representation: [address, arg1, arg2, ...].
OscBundle ¶
A timestamped collection of OSC messages and/or nested bundles.
Bundles allow multiple messages to be dispatched atomically at a
specified time. A None timestamp means "immediately".
Args:
timestamp: Unix epoch seconds (the time.time() domain) at which to
execute the contents, or None for immediate execution. The
NTP-epoch conversion (seconds since 1900-01-01) is applied on the
wire only when encoding with realtime=True; the stored and
decoded value is always Unix seconds.
contents: Sequence of OscMessage and/or OscBundle instances.
from_datagram
classmethod
¶
from_datagram(datagram: bytes) -> OscBundle
Decode an OSC binary datagram into an OscBundle.
Raises OscError on malformed input (both the native and
pure-Python paths).
to_datagram ¶
to_datagram(realtime: bool = True) -> bytes
Encode this bundle to an OSC binary datagram.