Latent Folding — Topological Manifold Navigation — User Guide
Treats the learned latent audio space as a deformable manifold. Three topologies: Mirror (reflection), Möbius (twist/inversion), Torus (seamless wrap). As the observer traverses the space, boundaries fold or invert acoustic identity — not time-reversal, but identity-reversal. Creates "Recursive Spectralism."
What this does
This script implements Latent Folding — a topological manifold navigation engine that treats the learned latent audio space as a deformable manifold. Three topologies are available: Mirror (reflection at boundaries), Möbius (twist/inversion), and Torus (seamless wrap). As the observer traverses the space, boundaries fold or invert acoustic identity — creating what might be called "Recursive Spectralism."
🧭 What is Topological Manifold Navigation?
This approach treats the latent space as a geometric object that can be folded, twisted, or wrapped:
- Mirror topology: When the observer reaches a boundary, the space reflects — like a mirrored room. Acoustic identity flips.
- Möbius topology: Crossing a boundary twists the space, inverting polarity and flipping acoustic properties (bright↔dark, noisy↔tonal).
- Torus topology: The space wraps seamlessly — exiting one side re-enters the opposite side, creating endless loops.
The result is a journey through a folded acoustic universe where identities invert and recur, creating "Recursive Spectralism."
Key Features:
- 6 Preset Strategies — Gentle Mirror to Palindromic Möbius, plus Custom
- 3 Topological Manifolds — Mirror (reflection), Möbius (twist), Torus (wrap)
- Fold Density — Number of folds in the manifold (1-12)
- Curvature — Controls fold sharpness (0 = smooth Escher-like, 1 = sharp folds)
- Permutation Intensity — Lateral drift strength during traversal
- Symmetry — Palindromic structure: first half, then inverted second half
- LRU Event Selection — Prevents immediate repetition
- Comprehensive Visualization — 5-panel display with waveforms, spectrograms, topology stats, summary
Technical Implementation: (1) Event Segmentation: Praat segments audio into 200ms–3s events. (2) Mel Patches: 40×32 log-mel patches per event. (3) Autoencoder: Train on-the-fly, encode to latent space Z. (4) Manifold Boundaries: Compute bounding box and principal axes. (5) Folding Engine: Traverse manifold with topology-specific boundary behaviors. (6) Reconstruction: Concatenate selected events with crossfades. (7) Stats & Visualization.
Quick start
- In Praat, select exactly one Sound object (any duration, any content).
- Run script… → select
latent_folding.praat. - Choose Preset (2-7 for specific strategies, 1 for custom).
- Set latent size and learning steps.
- Choose manifold type, fold density, curvature, permutation intensity, symmetry, speed.
- Enable Draw_visualization for analysis display.
- Click OK — engine segments, trains autoencoder, folds manifold, reconstructs.
Topological Manifold Theory
The Three Topologies
🪞 Mirror Topology (Reflection)
🌀 Möbius Topology (Twist)
⭕ Torus Topology (Wrap)
Folding Parameters
📐 Fold Density
Number of folds in the manifold:
📈 Curvature
Controls fold sharpness (0 = smooth, 1 = sharp):
🔄 Permutation Intensity
Lateral drift during traversal:
Symmetry / Palindromic Structure
LRU Event Selection
Preset Strategies
Preset 2: Gentle Mirror
🪞 Soft Reflections
Manifold: Mirror | Fold density: 2 | Curvature: 0.3
Permutation: 0.3 | Symmetry: 0.0 | Speed: 0.4
Latent: 8 | Steps: 100
Character: Gentle reflections with low curvature — smooth, gradual identity flips
Use on: Ambient, subtle transformations
Preset 3: Sharp Mirror
⚡ Abrupt Reflections
Manifold: Mirror | Fold density: 5 | Curvature: 0.9
Permutation: 0.7 | Symmetry: 0.0 | Speed: 0.6
Character: Many sharp folds, high permutation — dramatic, abrupt flips
Use on: Glitch, abrupt transformations
Preset 4: Möbius Twist
🌀 Identity Inversion
Manifold: Möbius | Fold density: 3 | Curvature: 0.6
Permutation: 0.5 | Symmetry: 0.0 | Speed: 0.5
Latent: 10 | Steps: 120
Character: Moderate twists — polarity inversions flip acoustic identity
Use on: Transformative material, exploring opposites
Preset 5: Torus Loop
⭕ Endless Wrap
Manifold: Torus | Fold density: 2 | Curvature: 0.4
Permutation: 0.4 | Symmetry: 0.0 | Speed: 0.5
Character: Seamless wrapping — cycles endlessly through acoustic space
Use on: Loops, cycles, infinite variations
Preset 6: Palindromic Mirror
🔄 Recursive Structure
Manifold: Mirror | Fold density: 3 | Curvature: 0.5
Permutation: 0.5 | Symmetry: 1.0 | Speed: 0.5
Latent: 10 | Steps: 120
Character: First half traverses, second half is inverted palindrome — recursive structure
Use on: Recursive forms, self-similar structures
Preset 7: Palindromic Möbius
🎭 Recursive Inversion
Manifold: Möbius | Fold density: 4 | Curvature: 0.7
Permutation: 0.6 | Symmetry: 1.0 | Speed: 0.6
Latent: 12 | Steps: 150
Character: Möbius twists plus palindromic structure — maximum recursion
Use on: Complex recursive forms, "Recursive Spectralism"
Parameters & Controls
Manifold Parameters
| Parameter | Default | Description |
|---|---|---|
| Latent_size | 8 | Autoencoder latent dimensions (2–32) |
| Learning_steps | 100 | Training iterations (10–500) |
| Manifold_type | Mirror | Mirror (reflection), Möbius (twist), Torus (wrap) |
| Fold_density | 3 | Number of folds in manifold (1–12) |
| Curvature | 0.5 | Fold sharpness (0 = smooth, 1 = sharp) |
| Permutation_intensity | 0.5 | Lateral drift strength (0–1) |
| Symmetry | 0.0 | Palindromic symmetry (0 = off, 1 = full) |
| Speed | 0.5 | Traversal speed (0.1–3.0) |
Output
| Parameter | Default | Description |
|---|---|---|
| Seed | 42 | Random seed for reproducibility |
| Draw_visualization | 1 | Generate 5-panel analysis display |
| Play_result | 1 | Audition after processing |
Visualization & Analysis
5-Panel Display
Reading Topology Stats
- Fold density: How many folds in the manifold
- Curvature: 0 = smooth, 1 = sharp folds
- Fold events: Number of times boundaries were crossed:
- Mirrors: Reflection events
- Twists: Polarity inversions (Möbius)
- Wraps: Seamless wraps (Torus)
- Symmetry: If ON, second half is identity-inverted mirror of first half
- Palindromic score: How different the second half's events are from first half (higher = more inverted)
Applications
Electroacoustic Composition
Use case: Creating recursive, folded structures from source material
Technique: Palindromic Mirror or Palindromic Möbius presets
Workflow:
- Select a 20-60 second recording with diverse textures
- Run with Palindromic Mirror preset
- Examine topology stats to understand folding events
- Export and use as recursive movement in larger work
Recursive Spectralism
Use case: Creating compositions where acoustic identities invert and recur
Technique: Möbius topology with symmetry
Concept: "Recursive Spectralism" — the idea that musical material can be folded back on itself, with identities inverting at each fold, creating infinite regress.
Sound Design for Media
Use case: Creating surreal, Escher-like soundscapes
Technique: Torus Loop with low curvature for smooth wraps
Applications:
- Surreal scenes: Torus creates endless, looping spaces
- Psychological tension: Sharp Mirror creates abrupt flips
- Transformations: Möbius twists identity gradually or abruptly
Research & Education
Use case: Studying topological spaces, manifold navigation
Technique: Compare presets on same source, examine fold events
Learning outcomes:
- Understand how different topologies affect traversal
- See how fold density and curvature shape output
- Explore palindromic symmetry and identity inversion
- Connect topological concepts to musical structure
Practical Workflow Examples
🎬 Film Scene: Recursive Nightmare
Goal: Create 60-second cue representing recursive nightmare logic
Settings:
- Source: 30-second drone with voice
- Preset: Palindromic Möbius
- Custom: curvature=0.8 (sharp twists), fold_density=5
Result: Voice inverts, recurses, creating unsettling recursive nightmare
🎚️ Electronic Music: Infinite Loop
Goal: Create endless loop from 4-bar phrase
Settings:
- Source: 8-second phrase
- Preset: Torus Loop
- Custom: speed=0.3 (slow wrap), curvature=0.2 (smooth)
Result: Phrase wraps seamlessly, creating infinite variation
🎙️ Voice Processing: Identity Inversion
Goal: Transform voice into its opposite
Settings:
- Source: 10-second vocal phrase
- Preset: Möbius Twist
- Custom: symmetry=0.0, curvature=0.5
Result: At each twist, voice inverts — bright↔dark, noisy↔tonal, creating surreal effect
Troubleshooting Common Issues
Cause: Python not installed, or packages missing
Solution: Install Python and required packages: pip install numpy soundfile scipy
Cause: Source has few intensity peaks, or segmentation parameters inappropriate
Solution: Use source with more dynamic variation, or adjust min/max event duration in script
Cause: Too few steps, too small latent size, or data too complex
Solution: Increase learning_steps, increase latent_size, or use simpler source
Cause: Fold density too low, or traversal never reaches boundaries
Solution: Increase fold_density, increase speed, check manifold type
Cause: Crossfade insufficient at splice points
Solution: Increase XFADE_SEC in Python script (currently 8ms)
Advanced Techniques
In Python script, add new manifold types by implementing new fold functions and adding to generate_folding_path().
Modify thresholds for detecting fold events (currently median_dist * 0.1) to change sensitivity.
Change recency window (currently 4) and penalty scaling to control repetition avoidance.
The script preserves input channels. For multi-channel input, output maintains same number of channels.