Add a second synthesis engine — the format and switches already expect one #5

Closed
opened 2026-08-18 01:34:38 +00:00 by bcox · 1 comment
Owner

The codebase is shaped for more than one synthesis engine and currently has
exactly one (FmPairLayer). Adding a second is the extension the architecture
most explicitly anticipates.

What is already in place:

  • The patch format is additive. plugin/patch_format.h opens with it: a
    reader skips any chunk it does not recognise, and layers are themselves
    tagged and length-prefixed inside the layer chunk, "so a reader that has
    never heard of a layer type can step over it rather than losing the rest of
    the patch."
  • Switches over LayerKind are registration sites. .bazelrc sets
    -Werror=switch precisely so a missed arm fails the build rather than
    silently doing nothing: "a missed arm is an engine that silently does nothing
    at that site rather than one that fails to build." Adding a kind will produce
    a list of every place that needs teaching.
  • The matrix writer is factored for reuse. plugin/patch_format.h:295
    notes the FM pair's record writer is arranged so "the next engine with a
    matrix reuses it instead of" duplicating it.
  • Heterogeneous slots already work. Voice<kCapacity, Layers...> is
    variadic over layer types; the single-engine case is just the current
    instantiation.

So this is less "build an extension point" than "use the one that exists".
Whoever takes it should expect the compiler to enumerate the work.

The codebase is shaped for more than one synthesis engine and currently has exactly one (`FmPairLayer`). Adding a second is the extension the architecture most explicitly anticipates. What is already in place: - **The patch format is additive.** `plugin/patch_format.h` opens with it: a reader skips any chunk it does not recognise, and layers are themselves tagged and length-prefixed inside the layer chunk, "so a reader that has never heard of a layer type can step over it rather than losing the rest of the patch." - **Switches over `LayerKind` are registration sites.** `.bazelrc` sets `-Werror=switch` precisely so a missed arm fails the build rather than silently doing nothing: "a missed arm is an engine that silently does nothing at that site rather than one that fails to build." Adding a kind will produce a list of every place that needs teaching. - **The matrix writer is factored for reuse.** `plugin/patch_format.h:295` notes the FM pair's record writer is arranged so "the next engine with a matrix reuses it instead of" duplicating it. - **Heterogeneous slots already work.** `Voice<kCapacity, Layers...>` is variadic over layer types; the single-engine case is just the current instantiation. So this is less "build an extension point" than "use the one that exists". Whoever takes it should expect the compiler to enumerate the work.
Author
Owner

We have VA and unvoiced formants now.

We have VA and unvoiced formants now.
bcox closed this issue 2026-08-22 19:10:48 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
bcox/tymbal#5
No description provided.