Skip to main content

Module genetic

Module genetic 

Source
Expand description

Simple evolutionary operators on track parameters.

Each track’s “genome” is the tuple of tonal params (freq, cutoff, resonance, reverb_mix, pulse_depth). Mutation perturbs them by a strength-scaled random; crossover mixes two tracks gene-by-gene and snaps the frequency back onto a golden-pentatonic lattice so the mix stays harmonically coherent.

Structs§

Genome
Opaque view of a track’s params — everything mutate and crossover touch. Keeps this module free of audio::track coupling.

Functions§

crossover
Uniform crossover — each gene comes from a or b with 50/50 chance. Result is written into a. Freq is snapped to pentatonic afterwards.
mutate
Mutate a single gene slot. strength in [0, 1]: 0.0 → no-op, 0.3 → gentle drift (default), 1.0 → wild.