Genetic Recomposer — User Guide
Evolutionary audio recombination: uses genetic algorithms to automatically slice, reorder, and reassemble audio segments, evolving new sonic organisms through fitness-based selection.
What this does
This script implements evolutionary audio recombination — a genetic algorithm approach to sound transformation that treats audio segments as genetic material to be sliced, recombined, and evolved over generations. The process: (1) Segment Extraction: Automatically slices input audio into variable-length segments based on genome parameters. (2) Population Initialization: Creates multiple "individuals" with different segmentation, reordering, and processing characteristics. (3) Fitness Evaluation: Scores each individual based on rhythmicity, continuity, and novelty. (4) Evolutionary Loop: Selects best performers, breeds new individuals through crossover and mutation. (5) Convergence: Over 10-15 generations, evolves toward optimal recombination based on fitness criteria.
Key Features:
- 6 Preset Styles — From subtle textures to extreme fragmentation
- Evolutionary Intelligence — Genetic algorithm optimizes recombination
- Multi-Objective Fitness — Balances rhythm, continuity, and novelty
- Adaptive Parameters — Automatically adjusts based on effect strength
- Real-time Preview — Play best result from each generation
- Customizable Evolution — Control population size, generations, mutation
- Intelligent Crossfading — Smooth transitions between segments
Technical Implementation: (1) Genome Representation: Each individual defined by 8 parameters: segment min/max, bias, reorder probability, crossfade length, silence probability, silence min/max. (2) Fitness Function: Three components: rhythm (event rate from silence detection), continuity (waveform consistency), novelty (DC ratio). (3) Evolution Operators: Tournament selection, blend crossover, Gaussian mutation. (4) Strength Mapping: User's effect strength (1-10) nonlinearly maps to parameter ranges. (5) Real-time Synthesis: Each generation synthesizes all individuals for evaluation. Key insight: The algorithm doesn't just randomly reorder — it evolves toward combinations that satisfy multiple aesthetic criteria simultaneously.
Quick start
- In Praat, select any Sound object (speech, music, field recording).
- Run script… →
genetic_recomposer.praat. - Choose preset based on desired effect (start with "Granular Shimmer").
- Set target_duration_s (output length, default 8.0s).
- Adjust effect_strength (1=subtle, 10=extreme).
- Set pop_size (population size, default 10) and generations (default 10).
- Click OK — watch evolution progress in Info window.
- Final output named "GA_Recombine_best" appears in Objects window.
Genetic Algorithm Basics
🧬 The Evolutionary Process
1. Initialization: Create random population of individuals (audio recombination strategies)
2. Evaluation: Synthesize audio for each individual, calculate fitness score
3. Selection: Choose best individuals as parents for next generation
4. Reproduction: Create new individuals through crossover (mixing parent traits) and mutation (random changes)
5. Iteration: Repeat evaluation-selection-reproduction for specified generations
6. Convergence: Population evolves toward higher fitness solutions
Population Dynamics
| Parameter | Default | Effect | Trade-off |
|---|---|---|---|
| pop_size | 10 | Number of individuals per generation | Larger = better exploration but slower |
| generations | 10 | Evolution cycles | More = better optimization but slower |
| elite_count | 2 | Best individuals preserved unchanged | Preserves good solutions, reduces diversity |
| mutation_rate | 0.30 | Probability of random changes | Higher = more exploration, less convergence |
Crossover and Mutation
Evolutionary Timeline
⏱️ Generation-by-Generation Progress
Generation 1: Random population, wide diversity, low average fitness
Generations 2-4: Rapid improvement, convergence toward viable strategies
Generations 5-8: Slower refinement, exploitation of good solutions
Generations 9-10+: Stabilization, minor improvements, potential stagnation
Typical fitness progression: 0.3 → 0.6 → 0.8 → 0.85 → 0.87...
Preset Styles
🎨 Preset 1: Custom
Character: Manual control, use form values exactly as specified
Use when: You know exactly what parameters you want
Effect strength: As specified in form
Segment range: min_seg_ms to max_seg_ms
🌫️ Preset 2: Subtle Texture
Character: Gentle granulation, minimal disruption
Parameters: strength=3, pop=8, gen=8, xfade=8ms, silence=15%
Best for: Adding subtle motion to static sounds, background textures
Example source: Pads, drones, ambient field recordings
✨ Preset 3: Granular Shimmer
Character: Smooth granular synthesis with musical crossfades
Parameters: strength=5, pop=12, gen=12, xfade=12ms, silence=20%
Best for: Evolving textures, melodic fragmentation, cloud-like effects
Example source: Vocal phrases, piano, string sections
🌀 Preset 4: Glitch / Stutter
Character: Aggressive cuts, digital artifacts, rhythmic stutters
Parameters: strength=8, pop=10, gen=10, xfade=3ms, silence=45%
Best for: Glitch art, IDM, experimental percussion
Example source: Drum breaks, spoken word, synth sequences
💥 Preset 5: Extreme Fragmentation
Character: Maximum chaos, micro-sounds, rapid-fire sequencing
Parameters: strength=10, seg=10-80ms, pop=15, gen=15, xfade=2ms, silence=50%
Best for: Sound design, noise music, abstract composition
Example source: Anything — results will be highly abstracted
🎵 Preset 6: Rhythmic Loops
Character: Longer segments, musical phrases, loop-friendly
Parameters: strength=6, seg=50-250ms, pop=12, gen=12, xfade=10ms, silence=30%
Best for: Beat construction, phrase sampling, loop generation
Example source: Funk guitars, drum loops, basslines
Preset Selection Guide
| Desired Outcome | Recommended Preset | Strength | Notes |
|---|---|---|---|
| Subtle background texture | 2 (Subtle Texture) | 2-4 | Works with any source |
| Musical granular clouds | 3 (Granular Shimmer) | 4-7 | Best with tonal material |
| Glitch effects | 4 (Glitch/Stutter) | 7-9 | Rhythmic sources work best |
| Abstract sound design | 5 (Extreme Fragmentation) | 8-10 | Expect radical transformation |
| Loop construction | 6 (Rhythmic Loops) | 5-7 | Use with musical phrases |
| Complete control | 1 (Custom) | Any | Set all parameters manually |
Genome Structure
🧬 The 8 Genetic Parameters
Each individual in the population is defined by these 8 traits:
- segMinMs / segMaxMs: Minimum and maximum segment length (ms)
- segBias: Distribution bias (-0.8 to 0.8, negative=shorter bias)
- reorderProb: Probability of reordering segments (0-1)
- crossfadeMs: Crossfade length between segments (ms)
- silenceProb: Probability of inserting silence (0-0.6)
- silenceMin / silenceMax: Minimum and maximum silence length (ms)
Segment Generation Algorithm
Segment Reordering
Silence Insertion
Crossfade Smoothing
Strength Mapping
Fitness Evaluation
🏆 Multi-Objective Fitness Function
Total fitness = rhythm_weight × rhythmScore + continuity_weight × continuityScore + novelty_weight × noveltyScore
Default weights: rhythm=1.0, continuity=0.8, novelty=1.0
Goal: Evolve individuals that balance rhythmic interest, smooth continuity, and novelty
Rhythm Score (Event Rate Analysis)
Continuity Score (Waveform Consistency)
Novelty Score (DC Bias Detection)
Fitness Stride Optimization
Interpreting Fitness Values
| Total Fitness | Interpretation | Typical Characteristics |
|---|---|---|
| 0.0 - 0.3 | Poor | Too sparse/too dense, choppy, DC-biased |
| 0.3 - 0.6 | Fair | Imbalanced in one or more dimensions |
| 0.6 - 0.8 | Good | Balanced, musically interesting |
| 0.8 - 1.0 | Excellent | Optimal rhythm, smooth, novel |
| 1.0+ | Theoretical max | Perfect scores in all dimensions |
Creative Applications
Generative Sound Design
🎨 Evolving Textures from Source Material
Workflow:
- Start with simple source (sine wave, noise, single instrument)
- Use preset 3 (Granular Shimmer) with strength 4-6
- Run evolution for 12-15 generations
- Take best result, use as source for another evolution
- Repeat 2-3 times for complex emergent textures
Result: Rich, evolving soundscapes with history of transformations
Algorithmic Remixing
🔄 Intelligent Audio Recombination
Workflow:
- Select musical phrase (vocal, melody, chord progression)
- Use preset 6 (Rhythmic Loops) with strength 5-7
- Set target_duration to original length or multiple
- Evolve for 10+ generations
- Best result often retains musicality while introducing variation
Result: Algorithmic remix that balances familiarity and novelty
Evolutionary Composition
🎼 Generative Music Construction
Workflow:
- Create short musical elements (notes, chords, rhythms)
- Concatenate into source sound
- Evolve with preset 3 or 6
- Export best results, arrange in DAW
- Use as raw material for further composition
Result: Unique musical materials with algorithmic character
Advanced Techniques
- Run evolution on source, save best result
- Use best result as new source
- Run evolution again with different parameters
- Repeat 3-5 times
- Final result often has complex, layered character
Example: Source → Granular Shimmer → Glitch/Stutter → Rhythmic Loops
- Population size exploration: Run with pop_size=5,10,15, compare results
- Generation depth: Run for 5,10,20 generations, observe convergence
- Strength sweep: Run same source at strength 3,6,9, compare transformations
- Preset comparison: Run all 6 presets on same source, collect best of each
Troubleshooting Common Issues
Causes: Population too small, mutation rate too low, fitness plateau
Solutions: Increase pop_size (12-15), increase mutation_rate (0.4-0.5), try different source material
Causes: Effect strength too low, segments too long, reordering too little
Solutions: Increase effect_strength (7-10), decrease max_seg_ms (50-100ms), increase max_silence_prob (0.4-0.5)
Causes: Effect strength too high, segments too short, too much silence
Solutions: Decrease effect_strength (2-4), increase min_seg_ms (50-100ms), decrease max_silence_prob (0.1-0.2)
Causes: Large population, many generations, long target duration
Solutions: Reduce pop_size (8-10), reduce generations (8), reduce target_duration_s (4-6s), increase fitness_stride (3-4)
Performance Optimization
| Setting | Faster | Slower (Better) | Sweet Spot |
|---|---|---|---|
| pop_size | 5-8 | 12-15 | 10 |
| generations | 5-8 | 15-20 | 10-12 |
| fitness_stride | 4-5 | 1-2 | 3 |
| target_duration_s | 4-6 | 12-15 | 8 |
| min_seg_ms | 10-20 | 50-100 | 20-50 |