Skip to content

Introduction to PyOSC

This is the documentation for PyOSC, a library for Pytthon to handle the transport of OSC messages and Bundles over a network. It depends on oscparser to parse and serialize OSC messages.

Prerequisites

PyOSC requires Python 3.13 or greater, earlier versions of Python are not supported.

Installation

PyOSC is available on PyPI, so installation is simple using the following commands:

pip install pyopensoundcontrol
poetry add pyopensoundcontrol

Basic Usage

Here is a quick example as to how to send a simple OSC message using PyOSC:

from pyosc import Peer, OSCMessage, OSCModes, OSCFraming, Dispatcher, OSCInt, OSCString

peer = Peer(
    "127.0.0.1",
    3032,
    mode=OSCModes.TCP,
    framing=OSCFraming.OSC11,
)
message = OSCMessage(
    address="/test/message",
    args=(
        OSCInt(value=42),
        OSCString(value="Hello"),
    )
)
peer.send_message(message)
For more detailed examples and advanced usage, please refer to the subsequent sections of this documentation.