realtime¶
Tools for interacting with realtime execution contexts.
-
class AsyncServer(options: Options | None =
None, name: str | None =None, **kwargs)¶ Bases:
BaseServerA realtime execution context with
asyncio-based OSC and process protocols.- Parameters:
-
async connect(*, options: Options | None =
None, **kwargs) AsyncServer¶ Connect to a running server.
- async disconnect() AsyncServer¶
Disconnect from a running server.
-
async dump_tree(group: Group | None =
None, include_controls: bool =True, sync: bool =True) QueryTreeGroup | None¶ Dump the server’s node tree.
Emit
/g_dumpTreerequests.
-
async get_buffer(buffer: Buffer, *indices: int, sync: bool =
True) dict[int, float] | None¶ Get a buffer sample.
Emit
/b_getrequests.
-
async get_buffer_range(buffer: Buffer, index: int, count: int, sync: bool =
True) Sequence[float] | None¶ Get a buffer sample range.
Emit
/b_getnrequests.
-
async get_bus(bus: Bus, sync: bool =
True, use_shared_memory: bool =False) float | None¶ Get a control bus value.
Emit
/c_getrequests.
-
async get_bus_range(bus: Bus, count: int, sync: bool =
True, use_shared_memory: bool =False) Sequence[float] | None¶ Get a range of control bus values.
Emit
/c_getnrequests.
-
async get_synth_control_range(synth: Synth, control: int | str, count: int, sync: bool =
True) Sequence[float | str] | None¶ Get a range of synth controls.
Emit
/s_getnrequests.
-
async get_synth_controls(synth: Synth, *controls: int | str, sync: bool =
True) dict[int | str, float] | None¶ Get a synth control.
Emit
/s_getrequests.
-
async query_buffer(buffer: Buffer, sync: bool =
True) BufferInfo | None¶ Query a buffer.
Emit
/b_queryrequests.
-
async query_node(node: Node, sync: bool =
True) NodeInfo | None¶ Query a node.
Emit
/n_queryrequests.
-
async query_status(sync: bool =
True) StatusInfo | None¶ Query the server’s status.
Emit
/statusrequests.
-
async query_tree(group: Group | None =
None, include_controls: bool =True, sync: bool =True) QueryTreeGroup | None¶ Query the server’s node tree.
Emit
/g_queryTreerequests.
-
async query_version(sync: bool =
True) VersionInfo | None¶ Query the server’s version.
Emit
/versionrequests.
-
async quit(force: bool =
False) AsyncServer¶ Quit the server.
Emit
/quitrequests.
- async reboot() AsyncServer¶
Reboot the server.
-
register_lifecycle_callback(event: ServerLifecycleEvent | SupportsInt | str | None | Iterable[ServerLifecycleEvent | SupportsInt | str | None], procedure: Callable[[ServerLifecycleEvent], Awaitable[None] | None], *, once: bool =
False, args: tuple | None =None, kwargs: dict | None =None) ServerLifecycleCallback¶ Register a server lifecycle callback.
-
register_osc_callback(pattern: Sequence[float | str], procedure: Callable[[OscMessage], Awaitable[None] | None], *, failure_pattern: Sequence[float | str] | None =
None, once: bool =False, args: tuple | None =None, kwargs: dict | None =None) OscCallback¶ Register an OSC callback.
- async reset() AsyncServer¶
Reset the server’s state without quitting.
-
async sync(sync_id: int | None =
None, timeout: float =1.0) AsyncServer¶ Sync the server.
Emit
/syncrequests.
- unregister_osc_callback(callback: OscCallback) None¶
Unregister an OSC callback.
- Parameters:
- callback: OscCallback¶
The callback to unregister.
- property boot_future : Future[bool]¶
Get the server’s boot future.
Only reference this _after_ booting or connecting, as the future is created when booting or connecting.
- property exit_future : Future[bool]¶
Get the server’s exit future.
Only reference this _after_ booting or connecting, as the future is created when booting or connecting.
- property osc_protocol : AsyncOscProtocol¶
Get the server’s OSC protocol.
- property process_protocol : AsyncProcessProtocol¶
Get the server’s process protocol.
-
class BaseServer(options: Options | None, name: str | None =
None, **kwargs)¶ Bases:
ContextBase class for realtime execution contexts.
- __contains__(object_: ContextObject) bool¶
-
add_amplitude_scope(bus: Bus | BusGroup, add_action: AddAction | SupportsInt | str | None =
AddAction.ADD_TO_TAIL, target_node: Node | None =None) AmplitudeScope¶ Add an amplitude scope.
-
add_frequency_scope(bus: Bus, add_action: AddAction | SupportsInt | str | None =
AddAction.ADD_TO_TAIL, fft_size: int =4096, frequency_mode: 'linear' | 'logarithmic' ='linear', rate: int =4, target_node: Node | None =None) FrequencyScope¶ Add a frequency scope.
- send(message: Sequence | SupportsOsc | str) None¶
Send a message to the execution context.
- Parameters:
- message: Sequence | SupportsOsc | str¶
The message to send.
- unregister_lifecycle_callback(callback: ServerLifecycleCallback) None¶
Unregister a lifecycle callback.
- Parameters:
- callback: ServerLifecycleCallback¶
The callback to unregister.
Get the server’s shared memory interface, if available.
- property status : StatusInfo | None¶
Get the server’s last received status.
-
class Server(options: Options | None =
None, name: str | None =None, **kwargs)¶ Bases:
BaseServerA realtime execution context with
threading-based OSC and process protocols.- Parameters:
-
dump_tree(group: Group | None =
None, include_controls: bool =True, sync: bool =True) QueryTreeGroup | None¶ Dump the server’s node tree.
Emit
/g_dumpTreerequests.
-
get_buffer(buffer: Buffer, *indices: int, sync: bool =
True) dict[int, float] | None¶ Get a buffer sample.
Emit
/b_getrequests.
-
get_buffer_range(buffer: Buffer, index: int, count: int, sync: bool =
True) Sequence[float] | None¶ Get a buffer sample range.
Emit
/b_getnrequests.
-
get_bus(bus: Bus, sync: bool =
True, use_shared_memory: bool =False) float | None¶ Get a control bus value.
Emit
/c_getrequests.
-
get_bus_range(bus: Bus, count: int, sync: bool =
True, use_shared_memory: bool =False) Sequence[float] | None¶ Get a range of control bus values.
Emit
/c_getnrequests.
-
get_synth_control_range(synth: Synth, control: int | str, count: int, sync: bool =
True) Sequence[float | str] | None¶ Get a range of synth controls.
Emit
/s_getnrequests.
-
get_synth_controls(synth: Synth, *controls: int | str, sync: bool =
True) dict[int | str, float] | None¶ Get a synth control.
Emit
/s_getrequests.
-
query_buffer(buffer: Buffer, sync: bool =
True) BufferInfo | None¶ Query a buffer.
Emit
/b_queryrequests.
-
query_status(sync: bool =
True) StatusInfo | None¶ Query the server’s status.
Emit
/statusrequests.
-
query_tree(group: Group | None =
None, include_controls: bool =True, sync: bool =True) QueryTreeGroup | None¶ Query the server’s node tree.
Emit
/g_queryTreerequests.
-
query_version(sync: bool =
True) VersionInfo | None¶ Query the server’s version.
Emit
/versionrequests.
-
register_lifecycle_callback(event: ServerLifecycleEvent | SupportsInt | str | None | Iterable[ServerLifecycleEvent | SupportsInt | str | None], procedure: Callable[[ServerLifecycleEvent], None], *, once: bool =
False, args: tuple | None =None, kwargs: dict | None =None) ServerLifecycleCallback¶ Register a server lifecycle callback.
-
register_osc_callback(pattern: Sequence[float | str], procedure: Callable[[OscMessage], None], *, failure_pattern: Sequence[float | str] | None =
None, once: bool =False, args: tuple | None =None, kwargs: dict | None =None) OscCallback¶ Register an OSC callback.
-
sync(sync_id: int | None =
None, timeout: float =1.0) Server¶ Sync the server.
Emit
/syncrequests.
- unregister_osc_callback(callback: OscCallback) None¶
Unregister an OSC callback.
- Parameters:
- callback: OscCallback¶
The callback to unregister.
- property boot_future : Future[bool]¶
Get the server’s boot future.
Only reference this _after_ booting or connecting, as the future is created when booting or connecting.
- property exit_future : Future[bool]¶
Get the server’s exit future.
Only reference this _after_ booting or connecting, as the future is created when booting or connecting.
- property osc_protocol : ThreadedOscProtocol¶
Get the server’s OSC protocol.
- property process_protocol : ThreadedProcessProtocol¶
Get the server’s process protocol.
- exception FailWarning¶