nonrealtime

Tools for interacting with non-realtime execution contexts.

class Score(options: Options | None = None, **kwargs)

Bases: Context

A non-realtime execution context.

Parameters:
options: Options | None = None

The context’s options.

**kwargs

Keyword arguments for options.

async __render__(*, output_file_path: PathLike | None = None, render_directory_path: PathLike | None = None, **kwargs) Tuple[Path | None, int]
iterate_datagrams(until: float | None = None) Iterator[bytes]

Iterate datagrams.

Parameters:
until: float | None = None

Timestamp to stop iterating at.

iterate_osc_bundles(until: float | None = None) Iterator[OscBundle]

Iterate OSC bundles.

Parameters:
until: float | None = None

Timestamp to stop iterating at.

iterate_request_bundles(until: float | None = None) Iterator[RequestBundle]

Iterate request bundles.

Parameters:
until: float | None = None

Timestamp to stop iterating at.

async render(output_file_path: PathLike | None = None, *, duration: float | None = None, header_format: HeaderFormat | SupportsInt | str | None = HeaderFormat.AIFF, input_file_path: PathLike | None = None, options: Options | None = None, render_directory_path: PathLike | None = None, sample_format: SampleFormat | SupportsInt | str | None = SampleFormat.INT24, sample_rate: float = 44100, suppress_output: bool = False, **kwargs) Tuple[Path | None, int]

Render the score.

Parameters:
duration: float | None = None

Optional duration to render the score until.

header_format: HeaderFormat | SupportsInt | str | None = HeaderFormat.AIFF

The header format to render with.

input_file_path: PathLike | None = None

The input file to render with.

options: Options | None = None

The context’s options.

render_directory_path: PathLike | None = None

The directory to render the output in. This affords using relative paths and (therefore) stable hashes when rendering multiple scores that interrelate.

sample_format: SampleFormat | SupportsInt | str | None = SampleFormat.INT24

The sample format to render with.

sample_rate: float = 44100

The sample rate to render at.

suppress_output: bool = False

Flag for writing the output soundfile to /dev/null (or equivalent).

**kwargs

Keyword arguments for options.

Returns:

A pair of the output path (if output exists) and the process exit code. If no output file path was provided, one will be generated based on the hash of the score’s datagram, its input file (if provided) and any flags to scsynth that affect rendering.

send(message: SupportsOsc) None

Send a message to the execution context.

Parameters:
message: SupportsOsc

The message to send.

setup_system_synthdefs() None

Load all system synthdefs.