Rhythmic Fractal Granulator: Fractal Timing Granular Synthesis
A Praat script that generates self-similar rhythmic patterns using fractal mathematics, creating intricate granular textures from any audio source.
What this does
The Rhythmic Fractal Granulator combines two powerful audio processing techniques: granular synthesis (using tiny audio grains) and fractal mathematics (creating self-similar patterns). The result is complex, evolving textures with inherent rhythmic structure that feels both organic and mathematical.
π΅ Core Concept: Fractal Rhythm Generation
Instead of random or regular timing, this script creates grain positions using a fractal algorithm:
- Start with a single grain at time 0
- For each generation: Add new grains at half-intervals between existing grains
- Mirror the pattern around a central pivot point
- Result: Self-similar rhythmic structure with nested patterns
Key Innovation: The fractal timing creates rhythms that are complex yet perceptually coherent. Our brains recognize the self-similar structure, making the result more musical than random granular clouds.
Quick Start
- In Praat, select exactly one Sound object as source material.
- Open the script editor and load
Rhythmic_Fractal_Granulator.praat. - Choose a Preset based on desired texture:
- Dense Texture: Many short grains, cloud-like
- Sparse Rhythmic: Fewer long grains, rhythmic
- Glitchy: Very short grains, stuttering effect
- Ambient Cloud: Medium grains, evolving texture
- Percussive: Short grains, rhythmic emphasis
- Adjust parameters if desired (see guide below).
- Enable Draw_visualization to see fractal pattern.
- Click Run β Run (or Ctrl+R).
- Listen to the generated fractal texture.
- Best sources: Sustained sounds (pads, drones, vocals)
- Good results: Percussive sounds (for rhythmic effects)
- Avoid: Very short sounds (οΌ0.5s) unless using Sequential mode
- Experiment: Speech, instruments, field recordings, noise
- Output duration: Independent of source length
- Channel preservation: Mono stays mono, stereo conversion optional
- Memory usage: Scales with number of grains
- Random seed: Different each run (for Random Read mode)
- Unique ID: Each output gets random 5-digit identifier
Fractal Rhythm Theory
The Fractal Generation Algorithm
ποΈ Generation by Halving Intervals
Example progression (simplified, no jitter):
- Gen 0: Event at 0.1s
- Gen 1: Add at 0.1 + shiftβ = ~1.0s
- Gen 2: Add at 0.1 + shiftβ, 1.0 + shiftβ = ~0.55s, ~1.45s
- Gen 3: Add at four more positions
- ... etc., creating binary tree structure
Symmetric Mirroring
π Creating Temporal Symmetry
Mirroring process:
Visualization: Creates perfect temporal symmetry around the pivot point.
Why symmetry?
- Musical balance: Creates ABA' form naturally
- Perceptual closure: Feels complete, not arbitrary
- Structural clarity: Easier to follow than asymmetric patterns
- Mathematical elegance: Maintains fractal property through mirroring
Amplitude Decay by Generation
Perceptual effect: Earlier/larger structures dominate, later/finer details provide texture. Creates hierarchical amplitude structure matching rhythmic hierarchy.
Granular Synthesis Basics
What are Audio Grains?
Definition: Short segments of audio (typically 10-200 ms) extracted from a source and processed independently.
In this implementation:
- Grain duration: User-defined (default: 100 ms)
- Extraction: Direct from source without pitch shifting
- Envelopes: Applied to prevent clicks
- Concatenation: Grains placed at fractal-determined times with silence between
Window (Envelope) Shapes
π Bell Shape (Hanning Window)
ποΈ Plateau Shape (Trapezoid)
Source Reading Modes
| Mode | Algorithm | Effect | Best For |
|---|---|---|---|
| Random Offset | Each grain starts at random position in source | Texture cloud, non-linear | Sustained sounds, ambient |
| Sequential Scan | Grains progress linearly through source | Melodic development, narrative | Speech, melodies, recordings |
Preset Configurations
Preset 1: Dense Texture
βοΈ Cloud-Like Texture
| Parameter | Value | Effect |
|---|---|---|
| Total duration | 6.0 s | Medium length texture |
| Grain duration | 0.05 s (50 ms) | Short grains = dense texture |
| Generations | 6 | Many grains = high density |
| Window shape | Bell (Hanning) | Smooth, cloud-like |
| Read mode | Random Offset | Non-linear texture |
Result: Dense, evolving granular cloud. Good for padsβtextures.
Preset 2: Sparse Rhythmic
π₯ Clear Rhythmic Structure
| Parameter | Value | Effect |
|---|---|---|
| Total duration | 8.0 s | Longer for rhythmic development |
| Grain duration | 0.2 s (200 ms) | Long grains = clear attacks |
| Generations | 3 | Few grains = sparse pattern |
| Window shape | Plateau | Percussive, articulated |
| Read mode | Sequential Scan | Melodic progression |
Result: Clear rhythmic pattern with melodic development. Good for percussive sources.
Preset 3: Glitchy
β‘ Stuttering Glitch Effects
| Parameter | Value | Effect |
|---|---|---|
| Total duration | 3.0 s | Short, intense |
| Grain duration | 0.02 s (20 ms) | Very short = stuttering |
| Generations | 7 | Many generations = complex |
| Window shape | Bell (Hanning) | Smooth despite short grains |
| Read mode | Random Offset | Maximum fragmentation |
Result: Intense glitch/stutter effect. Good for vocal snippets, drums.
Preset 4: Ambient Cloud
π«οΈ Evolving Ambient Texture
| Parameter | Value | Effect |
|---|---|---|
| Total duration | 10.0 s | Long, evolving |
| Grain duration | 0.15 s (150 ms) | Medium grains |
| Generations | 4 | Moderate complexity |
| Window shape | Bell (Hanning) | Smooth, ethereal |
| Read mode | Random Offset | Non-linear texture |
Result: Slow-evolving ambient pad. Good for drones, atmospheric sounds.
Preset 5: Percussive
π― Rhythmic Emphasis
| Parameter | Value | Effect |
|---|---|---|
| Total duration | 4.0 s | Medium length |
| Grain duration | 0.08 s (80 ms) | Short but not too short |
| Generations | 3 | Sparse = clear rhythm |
| Window shape | Plateau | Percussive attack |
| Read mode | Sequential Scan | Progressive variation |
Result: Clear rhythmic pattern with evolving timbre. Good for drum loops, percussive sounds.
Parameters Explained
Output Structure Parameters
β±οΈ Total_duration_(s)
Range: 1.0 - 30.0 seconds (practical limit based on grains)
Default: 4.0 seconds
Effect on fractal: Determines time span for pattern generation. Longer durations create more spaced-out patterns (same number of generations but larger intervals).
Musical considerations:
- 1-3 s: Short textures, effects
- 4-8 s: Musical phrases
- 9-15 s: Evolving textures
- 16-30 s: Long-form ambient
π΅ Grain_duration_(s)
Range: 0.01 - 0.5 seconds (10-500 ms)
Default: 0.1 seconds (100 ms)
Perceptual effects:
| Duration | Perception | Use Case |
|---|---|---|
| 10-30 ms | Click, glitch, graininess | Glitch effects, granular clouds |
| 40-80 ms | Articulated, percussive | Rhythmic patterns, staccato |
| 100-200 ms | Note-like, sustained | Melodic, phrase-based |
| 250-500 ms | Textural, pad-like | Ambient, background textures |
π³ Generations
Range: 1 - 8 (practical limit for 4s duration)
Default: 5
Mathematical effect: Number of fractal iterations. Each generation adds grains at half-intervals between existing grains.
Too many generations: May exceed Praat's memory or create overly dense textures.
Envelope & Reading Parameters
| Parameter | Options | Effect | Best With |
|---|---|---|---|
| Window_shape | Bell (Hanning) / Plateau (Trapezoid) | Controls grain envelope smoothness | Bell: pads, clouds Plateau: rhythms, percussion |
| Read_mode | Random Offset / Sequential Scan | How source audio is read for grains | Random: textures Sequential: melodies, speech |
| Stereo | Yes / No | Convert mono to stereo (source stays stereo) | Yes: spatial width No: mono compatibility |
| Normalize | Yes / No | Scale peak to 0.95 (prevents clipping) | Yes: safe playback No: preserve dynamics |
| Draw_visualization | Yes / No | Show fractal pattern and waveforms | Yes: understanding No: faster processing |
Visualization Guide
π Understanding the Graphical Output
Six visualization panels:
| Panel | Content | Purpose |
|---|---|---|
| Title | Script name, source filename | Context |
| Source Waveform | Original audio (gray) | Reference material |
| Fractal Timing Diagram | Grains by generation (colored bars) | Show fractal structure |
| Generation Legend | Color key for generations | Identify hierarchy |
| Output Waveform | Resulting granular texture (green) | Show final audio |
| Event Timeline | Vertical lines at grain positions | Show temporal density |
| Statistics | Parameters and event count | Document settings |
Color Coding by Generation
Interpretation: Darker colors = earlier generations (parent grains). Lighter colors = later generations (children grains). Shows hierarchical structure visually.
Reading the Fractal Timing Diagram
Y-axis (vertical): Generation number (0 to GENERATIONS)
X-axis (horizontal): Time (0 to total_duration)
Pivot line: Vertical dashed line at center (total_duration/2)
Colored bars: Each bar represents one grain:
- Width: grain_duration
- Height: 0.8 units (centered on generation)
- Color: Based on generation
- Position: Exact timing with jitter
Look for patterns:
- Symmetry: Pattern should mirror around pivot
- Hierarchy: Gen 0 grains as anchors, later gens fill gaps
- Density gradient: More grains in middle, fewer at edges
- Jitter effect: Small random timing variations
Event Timeline Interpretation
Simple representation: Vertical lines at each grain start time, colored by generation.
What to observe:
- Temporal density: Where are grains clustered?
- Symmetry: Left/right mirroring
- Generation distribution: Are all generations evenly represented?
- Gaps: Areas with no grains (silence)
Density patterns: Should show fractal distribution - dense where many generations overlap, sparse at edges.
Applications & Examples
Sound Design & Textures
π¨ Transforming Simple Sounds
Example 1: Voice β Granular Cloud
- Source: Sustained vowel ("aaaah")
- Preset: Dense Texture
- Result: Evolving vocal pad texture
Example 2: Percussion β Rhythmic Pattern
- Source: Single drum hit
- Preset: Percussive
- Adjust: grain_duration = 0.06 s, generations = 4
- Result: Complex rhythmic pattern from single hit
Example 3: Field Recording β Ambient
- Source: Forest recording (30 seconds)
- Preset: Ambient Cloud
- Adjust: total_duration = 15.0 s, read_mode = Random
- Result: Abstracted environmental texture
Musical Composition
πΆ Generating Rhythmic Material
Technique 1: Fractal Rhythm Generation
- Source: Short melodic fragment (piano, synth)
- Use Sequential Scan read mode
- Preset: Sparse Rhythmic
- Result: Fractal variation of melody with inherent rhythm
Technique 2: Layered Textures
- Process same source with different parameters
- Layer results (e.g., dense cloud + sparse rhythm)
- Pan layers differently in DAW
- Add reverb/delay to taste
Technique 3: Parameter Automation
- Create multiple versions with evolving parameters
- Crossfade between versions over time
- Example: generations 2β6, grain_duration 0.2β0.05
Experimental & Academic
π¬ Perceptual Studies
Research applications:
- Rhythm perception: How do we perceive fractal vs. regular rhythms?
- Auditory streaming: At what density do grains fuse vs. separate?
- Memory & expectation: How does symmetry affect musical expectation?
- Timbre perception: How does grain duration affect source recognition?
Experimental design:
- Systematically vary one parameter (e.g., generations)
- Generate stimulus set
- Run listening tests (similarity, preference, identification)
- Analyze results statistically
Creative Processing Chain
β‘ Advanced Processing Pipeline
Result: Professionally produced granular composition with depth and movement.