Skip to main content

Module prior

Module prior 

Source
Expand description

The patch prior: a typed PCFG over PatchTree terms as a fugue program.

Every node at tree path p (root key "node", children "node/0", "node/0/1", …; a processor’s modulation slot at "<p>/m") emits real probabilistic choices at path-keyed addresses:

SiteAddressDistribution
source-vs-processor<p>#leafBernoulli(source_prob) (forced at max depth)
source kind<p>#srcCategorical(source_weights)
processor kind<p>#opCategorical(op_weights)
modulation kind<p>/m#modCategorical(mod_weights) (leaves only at max mod depth; never empty below a processor)
CV-processor kind<p>/m#modopuniform over ModOp::ALL
CV-combiner kind<p>/m#pairopuniform over PairOp::ALL

Modulation is a recursive sort as of wave 2C: a term’s subterms live at <p>/m/0 and <p>/m/1, the same child convention the audio tree uses and unambiguous because every modulation key sits below a /m. Its parsimony pressure is PatchGrammarPrior::max_mod_depth — see PatchGrammarPrior::mod_weights_at, which is where both of the sort’s renormalizations happen.

A modulation slot hangs off every module that has somewhere to send it. As of wave 2B the exceptions are Noise (its only site is a colour switch) and Mix/RingMod (both inputs are audio, and the one knob is the blend). Having two audio children is not an exception: the four 2B dynamics productions take two subterms and carry a slot as well. | discrete params | <p>#wave / #oct / #color / #fkind / #table / #dmode | uniform categoricals | | continuous params | <p>#det, #cut, #res, … | Uniform(0, 1) |

The amplitude envelope lives at amp#attackamp#release.

Because the structure of an execution is encoded in its own choices, the generic trace machinery (subtree regeneration MH, subtree-swap crossover) applies unchanged — this mirrors fugue-evo’s ArithmeticGrammarPrior design, with quiver signal sorts in place of arithmetic types.

Deeper patches pay more prior mass by construction: parsimony pressure is the grammar itself, not an ad-hoc penalty.

Structs§

PatchGrammarPrior
The typed PCFG over patch terms.

Constants§

N_MODS
Modulation-kind categorical order: None, Lfo, Env, Rand, Follow, Euclid, Op, Pair.
N_MOD_OPS
Unary CV-processor categorical order — ModOp::ALL.
N_OPS
Processor-kind categorical order: Mix, Filter, Fold, Delay, Chorus, Reverb, Distortion, Bitcrush, Phaser, RingMod, Flanger, Tremolo, Vibrato, Eq, Granular, Shift, Comp, Duck, Gate, Vocoder.
N_PAIR_OPS
Binary CV-combiner categorical order — PairOp::ALL.
N_SOURCES
Source-kind categorical order: Vco, Supersaw, Noise, Wavetable, Pluck, Formant.