pub struct PatchGrammarPrior {
pub source_prob: f64,
pub max_depth: usize,
pub max_mod_depth: usize,
pub source_weights: [f64; 7],
pub op_weights: [f64; 20],
pub mod_weights: [f64; 8],
}Expand description
The typed PCFG over patch terms.
Fields§
§source_prob: f64Probability that a node (below max depth) is a source leaf.
max_depth: usizeMaximum tree depth; nodes at this depth are forced to be sources.
max_mod_depth: usizeMaximum nesting depth of a modulation term: a term at this depth is
forced to be a leaf, exactly as Self::max_depth forces #leaf.
This is the mod sort’s only parsimony pressure. The audio tree pays
for its own size in prior mass because every extra node is another
#leaf/#op draw; a modulation chain pays the same way, but nothing
about the audio term’s mass objects to a forty-node CV chain that
moves one knob, so the ceiling has to be explicit. 2 means a term may
wrap at most two processors before it bottoms out in a leaf.
source_weights: [f64; 7]Weights over source kinds
[Vco, Supersaw, Noise, Wavetable, Pluck, Formant, Silence].
op_weights: [f64; 20]Weights over processor kinds
[Mix, Filter, Fold, Delay, Chorus, Reverb, Distortion, Bitcrush, Phaser, RingMod, Flanger, Tremolo, Vibrato, Eq, Granular, Shift, Comp, Duck, Gate, Vocoder].
mod_weights: [f64; 8]Weights over modulation kinds
[None, Lfo, Env, Rand, Follow, Euclid, Op, Pair].
Implementations§
Source§impl PatchGrammarPrior
impl PatchGrammarPrior
Sourcepub fn sample_with_rng<R: Rng>(&self, rng: &mut R) -> PatchTree
pub fn sample_with_rng<R: Rng>(&self, rng: &mut R) -> PatchTree
Draw a tree with a plain RNG (no trace) — the classic-layer sampler
mirroring Self::model. Used by EvolutionaryGenome::generate.
Trait Implementations§
Source§impl Clone for PatchGrammarPrior
impl Clone for PatchGrammarPrior
Source§fn clone(&self) -> PatchGrammarPrior
fn clone(&self) -> PatchGrammarPrior
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PatchGrammarPrior
impl Debug for PatchGrammarPrior
Source§impl Default for PatchGrammarPrior
impl Default for PatchGrammarPrior
Source§impl GenomePrior for PatchGrammarPrior
impl GenomePrior for PatchGrammarPrior
§fn trace_of(&self, genome: &Self::Genome) -> Trace
fn trace_of(&self, genome: &Self::Genome) -> Trace
Self::model]. The default delegates to
the genome’s canonical [TraceGenome::to_trace] encoding, which is
correct whenever the prior samples exactly the canonical sites (all the
vector priors here). Priors with their own generative scheme — e.g.
ArithmeticGrammarPrior’s
tree-path grammar — override this so that scoring, weighted traces, and
chain warm-starts work for any genome the prior can express.