Skip to content

Compiler

SCgf binary serialization. Most users reach this through SynthDef.compile(); compile_synthdefs() is the entry point for writing several definitions into a single bundle. The byte layout is specified in SCgf Format.

nanosynth.compiler

SCgf binary compiler for nanosynth.

compile_synthdefs

compile_synthdefs(
    synthdef: SynthDef,
    *synthdefs: SynthDef,
    use_anonymous_names: bool = False,
) -> bytes

Compile one or more SynthDefs to SuperCollider's SCgf binary format.

The output is a complete SCgf version-2 file containing the constant table, parameter index, and UGen graph for each SynthDef.

Args: synthdef: First SynthDef (required). synthdefs: Additional SynthDefs to include in the same binary. use_anonymous_names: If True, use MD5-hash names instead of the SynthDef's name attribute.

Returns: The SCgf binary bytes, suitable for sending to scsynth via /d_recv or writing to a .scsyndef file.