subsequence.osc

OSC integration for realtime control and state broadcasting.

Start the OSC server by calling composition.osc() before composition.play(). The server listens on a UDP port (default 9000) for incoming control messages and sends state updates to a target host/port (default 127.0.0.1:9001).

Built-in Receive Handlers ─────────────────────────

  • /bpm <int>: Set tempo

  • /mute/<name>: Mute a pattern

  • /unmute/<name>: Unmute a pattern

  • /data/<key> <value>: Update shared data (supports int, float, str)

Built-in Send Events ────────────────────

  • /bar <int>: On bar change

  • /chord <string>: On chord change

  • /section <string>: On section change

  • /bpm <int>: On tempo change

Module Contents

class subsequence.osc.OscServer(composition: subsequence.composition.Composition, receive_port: int = 9000, send_port: int = 9001, send_host: str = '127.0.0.1', receive_host: str = '0.0.0.0')[source]

Async OSC server/client for bi-directional communication.

Wire up the OSC ports and built-in control handlers; call start() to begin listening.

map(address: str, handler: Callable) None[source]

Register a custom OSC handler.

send(address: str, *args: Any) None[source]

Send an OSC message.

async start() None[source]

Start the OSC server and client.

async stop() None[source]

Stop the OSC server and close the outgoing client socket.