Universal Convolution Generator — User Guide

Multi-algorithm impulse response generator: creates complex rhythmic patterns and temporal structures using mathematical, physical, and musical algorithms for convolution-based audio processing.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.1 (2025) License: MIT License Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

What this does

This script implements a universal convolution generator that creates complex impulse responses using nine different mathematical, physical, and musical algorithms. Unlike traditional convolution that uses pre-recorded impulse responses, this generator creates synthetic impulse patterns based on algorithmic principles, allowing for precise control over rhythmic structures, temporal patterns, and spatial effects when convolved with audio sources.

Key Features:

What is algorithmic convolution? Traditional convolution: audio × impulse response = processed audio with impulse characteristics. Algorithmic convolution: audio × algorithmically-generated pattern = audio with mathematical/rhythmic structure. The nine algorithms generate different temporal patterns: (1) Mathematical sequences: Fibonacci, Euclidean rhythms, golden ratio, (2) Physical simulations: Bouncing ball, accelerando, random walk, (3) Musical patterns: Swing rhythms, stereo Fibonacci, burst patterns. Advantages: (1) Infinite variety: Algorithmic patterns never repeat exactly, (2) Precise control: Mathematical parameters allow exact specification, (3) Creative potential: Unconventional patterns create unique effects, (4) Reproducibility: Same parameters = identical results. Use cases: Rhythmic processing, sound design, experimental music, spatial effects, algorithmic composition.

Technical Implementation: (1) Two-stage interface: Algorithm selection → context-aware parameter dialog. (2) Pattern generation: Each algorithm creates PointProcess objects with precise timing. (3) Impulse creation: Convert PointProcess to pulse train sound. (4) Convolution: Resample source → convolve with generated impulse → output processed audio. (5) Quality control: Fixed pulse characteristics (amplitude=1, width=0.02s), peak normalization, proper cleanup. Key insight: Different algorithms create fundamentally different convolution effects — mathematical sequences create structured rhythms, physical simulations create natural decays, random processes create complex textures.

Quick start

  1. In Praat, select exactly one Sound object.
  2. Run script…universal_convolution_generator.praat.
  3. Step 1: Algorithm Selection
    • Choose from 9 generation algorithms
    • Set Duration (seconds) for impulse pattern
    • Enable Play after processing for preview
    • Click Next >>
  4. Step 2: Algorithm-Specific Parameters
    • Adjust parameters specific to chosen algorithm
    • Set Sampling frequency (typically 44100 Hz)
    • Click Run to process
  5. The script automatically:
    • Generates impulse pattern using selected algorithm
    • Convolves with your source audio
    • Creates result named "originalname_conv_algorithm"
    • Plays result if enabled
    • Cleans up intermediate objects
Quick tip: Start with Euclidean Rhythm for musical rhythmic patterns or Bouncing Ball for natural decay effects. Use shorter durations (1-3 seconds) for rhythmic effects and longer durations (5-10 seconds) for complex textures. Different source material works best with different algorithms: percussive sounds with rhythmic algorithms, sustained sounds with mathematical sequences, noise/textures with random processes. The convolution effect is most audible with transient-rich source material.
Important: SOURCE DEPENDENCE — convolution effects are most noticeable with sounds containing clear transients or noise. Very smooth, sustained sounds may produce subtle results. Processing time increases with duration and sampling frequency. Extreme parameter values may create very dense or very sparse patterns. Stereo Fibonacci creates true stereo impulse responses — other algorithms create mono impulses that are applied to both channels. Random elements in some algorithms (Random Walk, Bursts) produce different results each time. Always preview with play enabled to understand the effect character.

Algorithms

Mathematical Sequences

🔢 Fibonacci (Mono)

Concept: Generates impulses at Fibonacci sequence intervals

Pattern: Exponential spacing based on Fibonacci numbers

Parameters: Number of impulses, Scale divisor, Jitter

Result: Rhythmic patterns with exponential acceleration

🎵 Euclidean Rhythm

Concept: Evenly distributes pulses across time steps

Pattern: Mathematical rhythm generation algorithm

Parameters: Total steps, Active pulses

Result: Perfectly balanced rhythmic patterns

📐 Golden Angle Drift

Concept: Uses golden ratio for optimal spacing

Pattern: Irrational angle distribution prevents repetition

Parameters: Number of impulses, Margin

Result: Evenly distributed, non-repeating patterns

Physical Simulations

🏀 Bouncing Ball

Concept: Simulates physics of a bouncing ball

Pattern: Exponential decay of bounce intervals

Parameters: First bounce time, Gravity, Initial velocity, Bounce coefficient

Result: Natural-sounding decay patterns

⚡ Accelerando

Concept: Exponential acceleration of pulse rate

Pattern: Geometrically decreasing intervals

Parameters: First hit time, Number of pulses, Gap shrink ratio

Result: Rhythmic acceleration effects

🎲 Random Walk

Concept: Stochastic variation of time intervals

Pattern: Random walk with bounded variation

Parameters: Initial gap, Gap variation

Result: Organic, human-like timing variations

Musical & Spatial Patterns

🎧 Stereo Fibonacci

Concept: Independent Fibonacci sequences for left/right channels

Pattern: Different sequences create spatial effects

Parameters: Number of impulses, Left/right start values

Result: True stereo impulse responses with phasing

🎶 Swing

Concept: Applies swing rhythm to regular pulse train

Pattern: Delayed even-numbered beats

Parameters: Tempo (BPM), Swing delay

Result: Musical swing/shuffle rhythms

💥 Bursts and Taps (Ping-Pong)

Concept: Combines isolated taps with dense burst clusters

Pattern: Gaussian-distributed bursts around random centers

Parameters: Tap times, Number of bursts, Points per burst, StdDev

Result: Complex textures with clear reference points

Algorithm Selection Guide

Desired Effect Recommended Algorithm Typical Duration Source Material
Rhythmic patterns Euclidean Rhythm, Swing 2-5 seconds Percussion, drums
Natural decay Bouncing Ball, Accelerando 3-8 seconds Reverb tails, sustained sounds
Spatial effects Stereo Fibonacci 4-10 seconds Mono sources, vocals
Complex textures Bursts and Taps, Random Walk 5-15 seconds Noise, textures, pads
Mathematical structures Fibonacci, Golden Angle 3-10 seconds Melodic material, synths

Parameters

Common Parameters

Parameter Type Range Default Description
Duration positive 0.1-60.0 seconds 2.0 seconds Total length of generated impulse pattern
Sampling frequency positive 8000-192000 Hz 44100 Hz Sample rate for impulse generation
Play after processing boolean 0/1 1 (enabled) Auto-play result after processing

Algorithm-Specific Parameters

Fibonacci (Mono)

Parameter Range Default Effect
Number of impulses 1-100 12 Total Fibonacci sequence elements
Scale divisor 10.0-1000.0 100.0 Scales sequence to fit duration
Jitter (std dev) 0.0-1.0 0.1 Random timing variation

Bouncing Ball

Parameter Range Default Effect
First bounce time 0.01-5.0 seconds 0.10 seconds Initial impact time
Gravity 1.0-20.0 m/s² 9.81 m/s² Physical gravity constant
Initial velocity 0.5-10.0 m/s 3.0 m/s Rebound speed after first bounce
Bounce coefficient 0.1-0.95 0.60 Energy retention per bounce

Euclidean Rhythm

Parameter Range Default Effect
Total Steps 2-64 16 Division of timeline
Active Pulses 1-Total Steps 5 Number of impulses to distribute

Stereo Fibonacci

Parameter Range Default Effect
Number of impulses 1-50 12 Sequence length per channel
Left Start 1 & 2 1-100 1, 1 Left channel Fibonacci seeds
Right Start 1 & 2 1-100 2, 3 Right channel Fibonacci seeds

Parameter Effects Summary

Duration (0.1-60.0s):
< 1s: Very short, percussive effects
1-3s: Rhythmic patterns, short textures
3-10s: Complex patterns, medium textures
>10s: Very complex, evolving textures

Density Control (algorithm-specific):
Fibonacci: Higher "number of impulses" = denser
Euclidean: Higher "active pulses" = denser
Bouncing Ball: Higher "initial velocity" = more bounces
Random Walk: Lower "initial gap" = denser

Timing Character:
Mathematical: Precise, structured timing
Physical: Natural, exponential decays
Random: Organic, human-like variations
Musical: Groove-based, rhythmic timing

Technical Theory

Convolution Mathematics

Digital Convolution Fundamentals

Convolution operation:

Discrete convolution: y[n] = Σ[k=-∞ to ∞] x[k] × h[n-k] Where: x[n] = input signal (source audio) h[n] = impulse response (generated pattern) y[n] = output signal (processed audio) In frequency domain: Y(ω) = X(ω) × H(ω) This means: Output spectrum = Input spectrum × Impulse spectrum The impulse response acts as a frequency filter For impulse trains: h[n] = Σ[i] δ[n - n_i] (sum of delta functions at times n_i) This creates echoes/repitions of the input signal

Algorithm Mathematics

Fibonacci Sequence Generation

Classic Fibonacci algorithm:

Fibonacci sequence: F₁ = 1, F₂ = 1 Fₙ = Fₙ₋₁ + Fₙ₋₂ for n > 2 Time calculation: tᵢ = (Fᵢ / scale_divisor) × duration With jitter: tᵢ = (Fᵢ / scale_divisor) × duration + N(0, jitter) Stereo version: Left: tᵢ = (Fᵢ(left) / 100) × duration + N(0, 0.01) Right: tᵢ = (Fᵢ(right) / 120) × duration + N(0, 0.02) Properties: Exponential growth: Fₙ ≈ φⁿ/√5 where φ = golden ratio Creates accelerating rhythmic patterns

Euclidean Rhythm Algorithm

Bjorklund's algorithm implementation:

Euclidean rhythm generation: FOR i FROM 0 TO steps-1: IF (i × pulses) mod steps < pulses: place impulse at time i × (duration/steps) This evenly distributes 'pulses' across 'steps' Example: 5 pulses in 16 steps → [x...x...x...x..x] Mathematical properties: Maximizes evenness of distribution Creates balanced, musical rhythms Used in traditional music and electronic rhythms Time calculation: tᵢ = i × (duration / steps) for active pulses

Bouncing Ball Physics

Physical simulation equations:

Bounce timing calculation: Initial: t₀ = first_bounce_time Velocity after bounce: vₙ = coefficient × vₙ₋₁ Time between bounces: Δtₙ = 2 × vₙ / gravity Next bounce: tₙ = tₙ₋₁ + Δtₙ Energy decay: Kinetic energy: Eₙ = (1/2)mvₙ² After bounce: Eₙ₊₁ = coefficient² × Eₙ This creates exponential decay of bounce height Termination conditions: Δtₙ < 0.001s (too small to hear) tₙ > duration (exceeds time limit) n > 50 (safety limit)

Implementation Architecture

Processing Pipeline

STEP 1: SOURCE PREPARATION Select original Sound Copy → "XXXX_src" Resample to target sampling frequency → "XXXX_resampled" STEP 2: PATTERN GENERATION Create empty PointProcess "pp_gen" FOR each algorithm: Calculate impulse times using algorithm mathematics Add points to PointProcess at calculated times STEP 3: IMPULSE CREATION Convert PointProcess to Sound (pulse train) Parameters: amplitude=1, width=0.02s, period=2000 Rename → "IMPULSE_FINAL" Scale peak: 0.99 STEP 4: CONVOLUTION Select "XXXX_resampled" + "IMPULSE_FINAL" Convolve: "peak 0.99", "zero" Rename: "originalname_conv_algorithm" STEP 5: CLEANUP Remove intermediate objects Play result if enabled

Computational Considerations

Performance Characteristics

Time Complexity:
Pattern Generation: O(N) where N = number of impulses
PointProcess Creation: O(N) operations
Pulse Train Generation: O(sr × duration) operations
Convolution: O(M × log M) where M = samples in signal

Memory Usage:
PointProcess: Minimal (stores only time points)
Impulse Sound: O(sr × duration) samples
Temporary objects: 3-4 Sound objects during processing

Typical Processing Times:
1-second impulse + 10-second audio: 2-5 seconds
5-second impulse + 30-second audio: 10-20 seconds
10-second impulse + 60-second audio: 30-60 seconds

Applications

Rhythmic Processing

Use case: Adding complex rhythmic patterns to audio material

Technique: Use Euclidean Rhythm or Swing algorithms with percussive sources

Examples: Drum loop enhancement, rhythmic guitar processing, vocal rhythm effects

Sound Design and Textures

Use case: Creating complex evolving textures from simple sources

Technique: Use long-duration algorithms with noise or sustained sounds

Results: Granular-like textures, ambient beds, synthetic environments

Spatial Audio Effects

Use case: Creating stereo width and spatial movement

Technique: Stereo Fibonacci with mono sources

Applications: Mono-to-stereo conversion, phantom center effects, rotating sounds

Algorithmic Composition

Use case: Generating musical structures through mathematical processes

Technique: Process melodic material with mathematical sequences

Results: Structured variations, canon-like effects, mathematical music

Practical Workflow Examples

🥁 Drum Loop Enhancement

Goal: Add complex rhythmic variations to drum loops

Settings:

  • Algorithm: Euclidean Rhythm
  • Duration: 2.0 seconds
  • Total Steps: 16, Active Pulses: 5
  • Source: Drum loop or percussion track

Result: Drum loop with added polyrhythmic complexity and variation

🎹 Synthetic Texture Creation

Goal: Transform simple synth sounds into complex textures

Settings:

  • Algorithm: Bursts and Taps
  • Duration: 8.0 seconds
  • Bursts: 4, Points per burst: 15, StdDev: 0.05
  • Source: Sustained synth pad or drone

Result: Evolving granular texture with clear rhythmic reference points

🎤 Vocal Spatial Effects

Goal: Create stereo width and movement for mono vocals

Settings:

  • Algorithm: Stereo Fibonacci
  • Duration: 6.0 seconds
  • Impulses: 20, Different L/R seeds
  • Source: Mono vocal recording

Result: Vocals with natural stereo width and subtle phasing effects

Advanced Techniques

Creative processing chains:
  • Multiple passes: Apply different algorithms sequentially
  • Layered processing: Process same source with different algorithms and mix
  • Parameter automation: Change algorithm parameters over time
  • Extreme settings: Push parameters beyond normal ranges for experimental results

Combine with other Praat AudioTools for complex processing chains

Algorithm combinations:
  • Rhythmic + Spatial: Euclidean → Stereo Fibonacci
  • Natural + Mathematical: Bouncing Ball → Fibonacci
  • Structured + Random: Swing → Random Walk
  • Simple → Complex: Short duration → Long duration processing

Troubleshooting Common Issues

Problem: No audible effect
Cause: Source material lacks transients, impulse too sparse
Solution: Use transient-rich sources, increase impulse density, try shorter duration
Problem: Overwhelming/muddy result
Cause: Too many impulses, source too dense
Solution: Reduce number of impulses, use sparser algorithms, try cleaner sources
Problem: Processing very slow
Cause: Long duration, high sampling frequency
Solution: Reduce duration, lower sampling frequency, use faster algorithms
Problem: Unexpected patterns
Cause: Random elements, extreme parameters
Solution: Use deterministic algorithms, moderate parameter values, preview first