Skip to main content

Module compile

Module compile 

Source
Expand description

Compile a PatchTree term into a playable quiver [Patch].

Every compiled voice gets the mandatory output chain <audio> → DC blocker → VCA (amp ADSR) → Limiter → StereoOutput and two external controls (pitch in V/Oct, gate in volts) fanned out to every pitched source and every envelope — no evolved patch can bypass the limiter or end up unplayable.

The tail is built once per channel: a subtree that produces true stereo (reverb, chorus) keeps its two tanks all the way to the output rather than having the right one discarded.

§Validation mode

Patches are wired under [ValidationMode::Warn], not Strict: quiver’s Strict rejects warning-class pairs, which includes blessed idioms this compiler leans on (a unipolar mod envelope driving a bipolar FM input, the bipolar pitch [Offset] driving V/Oct inputs). The type discipline that Strict would enforce is already guaranteed by construction: the term’s Audio/Mod sorts are Rust types, and this compiler only emits known-good connection shapes. Compile errors (invalid ports, cycles) are still hard failures; accumulated warnings are returned for inspection and property tests assert they stay within the expected classes.

§Parameter mapping

Genome parameters are normalized [0, 1]; this module owns their musical mapping. Ranges are deliberately bounded away from pathology (max resonance 0.85, max delay feedback 0.7) — the grammar cannot express the most degenerate settings, which is safety layer 3 of the vetting design.

Structs§

CompiledVoice
A compiled, playable voice: the patch plus its external control handles.
ParamHandle
A live control: the atomic the audio thread reads, plus the knob mapping.

Enums§

ParamMap
How a normalized knob value maps to the volts written to its handle.

Functions§

compile
Compile a patch term into a playable voice at the given sample rate.