Module: Musa::Variatio
- Included in:
- All
- Defined in:
- lib/musa-dsl/generative/variatio.rb
Overview
Combinatorial variation generator with Cartesian product.
Variatio generates all possible combinations of parameter values across defined fields, creating comprehensive variation sets. Uses Cartesian product to produce exhaustive parameter combinations, then constructs objects and applies attribute modifications.
Core Concepts
- Fields: Named parameters with option sets
- Fieldsets: Nested field groups with their own options
- Constructor: Creates base objects from field values
- with_attributes: Modifies objects with field/fieldset values
- Finalize: Post-processes completed objects
- Variations: All Cartesian product combinations
Generation Process
- Define: Specify fields, fieldsets, constructor, attributes, finalize
- Combine: Calculate Cartesian product of all field options
- Construct: Create objects using constructor with each combination
- Attribute: Apply with_attributes blocks for each combination
- Finalize: Run finalize block on completed objects
- Return: Array of all generated variations
Musical Applications
- Generate all variations of a musical motif
- Create comprehensive parameter sweeps for synthesis
- Produce complete harmonic permutations
- Build exhaustive rhythm pattern combinations
Defined Under Namespace
Classes: Variatio