Skip to content

Project Generator

Copies gen~ export files, runs template substitution, and invokes platform-specific project generation.

project

Project generator for gen_dsp.

Creates new project structures from gen~ exports using templates. Uses the platform registry for platform-specific project generation.

ProjectConfig dataclass

ProjectConfig(
    name: str,
    platform: str = "pd",
    buffers: list[str] = list(),
    apply_patches: bool = True,
    output_dir: Optional[Path] = None,
    shared_cache: bool = True,
    board: Optional[str] = None,
    no_midi: bool = False,
    midi_gate: Optional[str] = None,
    midi_freq: Optional[str] = None,
    midi_vel: Optional[str] = None,
    midi_freq_unit: str = "hz",
    num_voices: int = 1,
    inputs_as_params: Optional[list[str]] = None,
    midi_mapping: Optional[MidiMapping] = None,
)

Configuration for a new project.

validate

validate() -> list[str]

Validate the configuration.

Returns:

Type Description
list[str]

List of validation error messages (empty if valid).

list_platforms staticmethod

list_platforms() -> list[str]

Return sorted list of available platform identifiers.

ProjectGenerator

ProjectGenerator(
    export_info: ExportInfo, config: ProjectConfig
)

Generate new project from gen~ export or dsp-graph.

Initialize generator with export info and configuration.

Parameters:

Name Type Description Default
export_info ExportInfo

Parsed information from gen~ export.

required
config ProjectConfig

Configuration for the new project.

required

from_graph classmethod

from_graph(
    graph: Graph, config: ProjectConfig
) -> ProjectGenerator

Create a ProjectGenerator from a dsp-graph Graph object.

Parameters:

Name Type Description Default
graph Graph

A gen_dsp.graph.models.Graph instance.

required
config ProjectConfig

Project configuration.

required

Returns:

Type Description
ProjectGenerator

A ProjectGenerator configured for the dsp-graph path.

generate

generate(output_dir: Optional[Path] = None) -> Path

Generate the project.

Parameters:

Name Type Description Default
output_dir Optional[Path]

Output directory. If None, uses config.output_dir or creates a directory named after the project.

None

Returns:

Type Description
Path

Path to the generated project directory.

Raises:

Type Description
ProjectError

If project cannot be generated.

ValidationError

If configuration is invalid.