Chaotic Function Generator — User Guide

Mathematical chaos synthesis: generates complex, non-repeating waveforms from deterministic yet unpredictable functions for experimental sound design and algorithmic composition.

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 Chaotic Function Generator — a sophisticated mathematical tool that synthesizes audio from deterministic yet unpredictable mathematical functions. By exploiting the sensitive dependence on initial conditions characteristic of chaotic systems, the generator creates complex, non-repeating waveforms that are mathematically precise yet perceptually rich and evolving. The system includes 20 pre-defined chaotic functions plus custom formula support.

Key Features:

What is chaotic synthesis? Traditional synthesis methods (subtractive, additive, FM) create predictable, periodic waveforms. Chaotic synthesis uses mathematical functions that exhibit chaos theory properties: deterministic equations that produce unpredictable, complex behavior due to extreme sensitivity to initial conditions. These functions create sounds that are neither purely random (like noise) nor purely periodic (like sine waves), but exist in a rich middle ground of structured complexity. The sounds evolve endlessly without repeating, making them ideal for creating organic, living textures.

Technical Implementation: (1) Function Selection: User chooses from 20 pre-defined chaotic systems or enters custom formula. (2) Mathematical Safety: Automatic epsilon values prevent division by zero at domain boundaries. (3) Waveform Generation: Praat's formula interpreter evaluates the mathematical expression across the time domain. (4) Visualization: The generated waveform is displayed graphically for immediate feedback. (5) Audio Normalization: Peak amplitude scaled to 0.99 for optimal playback. (6) Playback: Resulting sound played through audio output. The core innovation is the translation of abstract mathematical chaos into audible, musically useful sounds while maintaining mathematical integrity and computational stability.

Quick start

  1. In Praat, ensure no objects are selected (generates new sound).
  2. Run script…chaotic_function_generator.praat.
  3. Choose function from the 20 pre-defined options or select "Custom…".
  4. Set duration_seconds (default 1.0) for output length.
  5. Set sampling_rate_Hz (default 44100) for audio quality.
  6. For custom functions, enter custom_formula using Praat syntax.
  7. Click OK — sound generated, visualized, and played automatically.
  8. Experiment with different functions to discover their unique sonic characters.
Quick tip: Start with sin(1/x) for classic chaotic tones, Logistic Map for mathematical chaos, or exp(-1/x^2)*sin(50*x) for complex textures. Use shorter durations (0.5-2.0 seconds) for quick experimentation. The visualization helps understand the waveform structure — chaotic functions typically show complex, non-repeating patterns. All functions automatically include small epsilon values to prevent mathematical errors at x=0 and x=1, ensuring stable operation.
Important: MATHEMATICAL INTENSITY — some functions are computationally expensive and may cause Praat to become unresponsive with very long durations (>10 seconds). Custom formulas must use valid Praat mathematical syntax. The domain is automatically normalized to [0,1] for time variable x. Very high sampling rates (>96 kHz) with complex functions may slow generation. The sounds are synthesized from scratch — no input audio is used or modified. Some functions may produce very quiet results that require amplification after generation. The system is deterministic — same parameters always produce identical output.

Chaos Theory Fundamentals

What Makes a System Chaotic?

Key Properties of Chaos

Mathematical definition:

Chaotic systems exhibit: 1. Deterministic: Follow precise mathematical rules 2. Sensitive dependence: Small changes in initial conditions → large differences in outcome 3. Topological mixing: Eventually explores all possible states 4. Dense periodic orbits: Infinite number of unstable periodic solutions In audio terms: - Same function always produces same waveform from same start - But waveform is complex and non-repeating - Creates "structured randomness" perceptually - Mathematical precision with perceptual richness

Why 1/x Creates Chaos

The singularity principle:

Domain and Stability

Time Domain Mapping

Normalized time variable:

Time variable: x ranges from 0 to 1 over duration x = time / duration This means: Start: x = 0 (beginning of sound) End: x = 1 (end of sound) Critical points: x = 0: Beginning, potential mathematical singularities x = 1: End, some functions have special behavior Epsilon protection: x → x + ε where ε = 1e-4 Prevents division by zero at boundaries

Mathematical Safety System

Automatic singularity avoidance:

Original formula: sin(1/x) Protected formula: sin(1/(x + 1e-4)) Original formula: sin(1/(x*(1-x))) Protected formula: sin(1/((x+1e-4)*((1-x)+1e-4))) This ensures: - No division by zero errors - Stable computation across entire domain - Preservation of chaotic character - Smooth operation in Praat environment

Chaos vs Randomness

Key Differences

Mathematical distinction:

🎲 Random Noise

Characteristics:

  • Truly unpredictable
  • No underlying pattern
  • Maximum entropy
  • No memory of previous states

Audio example: White noise

🌀 Chaotic System

Characteristics:

  • Deterministic but unpredictable
  • Complex underlying structure
  • Structured complexity
  • Complete memory (dependent on initial conditions)

Audio example: sin(1/x) synthesis

Classical Chaotic Systems

Logistic Map

Mathematical definition:

Logistic Map equation: xₙ₊₁ = r · xₙ · (1 - xₙ) Where: xₙ = value at step n (between 0 and 1) r = growth rate parameter In this implementation: r = 3.9 (chaotic regime) Formula: 3.9*x*(1-x) Behavior: - For r < 3.57: periodic behavior - For r ≥ 3.57: chaotic behavior - At r = 3.9: fully developed chaos

Tent Map

Piecewise linear chaos:

Tent Map definition: xₙ₊₁ = μ · min(xₙ, 1 - xₙ) In this implementation: μ = 2 (maximal chaos) Formula: if x<0.5 then 2*x else 2*(1-x) endif Properties: - Piecewise linear function - Uniform invariant distribution - Exact solutions possible - Simpler than logistic map but equally chaotic

📈 Visualizing Chaos

sin(1/x) near x=0:

As x approaches 0, 1/x approaches infinity

sin(1/x) oscillates infinitely rapidly

Creates dense, non-repeating waveform


Logistic Map bifurcation:

At r=3.9, system never settles to fixed point

Continually visits different values in [0,1]

Creates unpredictable yet deterministic sequence

Function Library

Singularity-Based Functions

FunctionFormulaSonic Character
sin(1/x)sin(1/(x+ε))Classic chaotic oscillation, infinite frequency at start
sin((1/x)*(1/(1-x)))sin((1/(x+ε))*(1/((1-x)+ε)))Dual singularity, complex both ends
sin(1/(x*(1-x)))sin(1/((x+ε)*((1-x)+ε)))Product singularities, rich texture
atan(1/x)*sin(10/x)arctan(1/(x+ε))*sin(10/(x+ε))Bounded chaos, smoother evolution

Multi-component Functions

FunctionFormulaSonic Character
Multi-sine/cosine2*sin(3/x)+3*cos(5/x)+4*sin(6/x)+cos(3/x)Rich harmonic chaos, complex beating
sin(1/x) + 2*sin(1/(1-x))sin(1/(x+ε)) + 2*sin(1/((1-x)+ε))Mirrored chaos, symmetric structure
sin(3/x)*sin(5/(1-x))sin(3/(x+ε))*sin(5/((1-x)+ε))Modulated chaos, product complexity
tan(1/x)*cos(1/(1-x))tan(1/(x+ε))*cos(1/((1-x)+ε))Unbounded growth with modulation

Power Law Functions

FunctionFormulaSonic Character
sin(1/x²)*cos(1/(1-x)²)sin(1/(x+ε)²)*cos(1/((1-x)+ε)²)Rapid divergence, extreme chaos
sin(1/x)*cos(1/x²)sin(1/(x+ε))*cos(1/(x+ε)²)Multi-scale chaos, nested patterns
(sin(1/x)+sin(1/x³))/2(sin(1/(x+ε))+sin(1/(x+ε)³))/2Averaged chaos, smoothed result
cos(1/x³)+sin(1/(1-x)³)cos(1/(x+ε)³)+sin(1/((1-x)+ε)³)Cubic singularity, very rapid oscillation

Exponential and Logarithmic

FunctionFormulaSonic Character
exp(-1/x²)*sin(50*x)exp(-1/(x+ε)²)*sin(50*x)Gaussian-weighted oscillation
sin(ln(x+0.01))*cos(ln(1.01-x))sin(ln(x+0.01))*cos(ln(1.01-x))Logarithmic stretching, slow evolution
exp(sin(1/x))*cos(1/(1-x))exp(sin(1/(x+ε)))*cos(1/((1-x)+ε))Exponential modulation, growing complexity
sin(1/x)*sin(1/x²)*sin(1/x³)sin(1/(x+ε))*sin(1/(x+ε)²)*sin(1/(x+ε)³)Triple product, maximal complexity

Classical Chaotic Maps

FunctionFormulaSonic Character
Logistic Map3.9*x*(1-x)Mathematical chaos, unpredictable yet deterministic
Tent Mapmin(2*x, 2*(1-x))Piecewise linear chaos, sharp transitions

Specialized Functions

FunctionFormulaSonic Character
Weighted oscillation(1/x)*sin(10*x)+(1/(1-x))*cos(10*(1-x))Amplitude-modulated chaos
Square root chaossin(1/√(x+0.001))*cos(1/√(1.001-x))Slower divergence, smoother chaos

Function Character Guide

🎵 Musical Chaos

For rich, evolving tones:

  • Multi-sine/cosine: Complex harmonic beating
  • exp(-1/x²)*sin(50*x): Musical oscillation with chaos
  • sin(1/x) + 2*sin(1/(1-x)): Balanced chaotic structure

🌊 Textural Chaos

For complex textures:

  • sin(1/(x*(1-x))): Rich, dense patterns
  • sin(1/x)*sin(1/x²)*sin(1/x³): Maximum complexity
  • Logistic Map: Mathematical texture

⚡ Extreme Chaos

For rapid, intense patterns:

  • sin(1/x²)*cos(1/(1-x)²): Very rapid oscillation
  • cos(1/x³)+sin(1/(1-x)³): Cubic singularity intensity
  • Tent Map: Sharp, discontinuous chaos

Parameters

Core Generation Parameters

ParameterTypeDefaultDescription
functionoptionmenusin(1/x)Mathematical function for synthesis (20 options + custom)
duration_secondsreal1.0Length of generated sound in seconds
sampling_rate_Hzinteger44100Audio sampling rate (samples per second)
custom_formulatextsin(1/x)User-defined mathematical expression (Praat syntax)

Automatic Processing Parameters

ParameterBehaviorPurpose
Epsilon protectionAutomaticPrevents division by zero (ε=1e-4)
Peak normalizationAutomaticScales output to 0.99 peak amplitude
Waveform visualizationAutomaticDraws generated waveform for inspection
Auto-playbackAutomaticPlays sound immediately after generation

Parameter Guidelines

⏱️ Duration Settings

Short (0.1-0.5s): Quick experimentation, impulse-like sounds

Medium (0.5-2.0s): General use, manageable file sizes

Long (2.0-10.0s): Extended textures, may slow generation

Very Long (>10.0s): Risk of Praat slowdown, complex functions

🎚️ Sampling Rate Settings

CD Quality (44100 Hz): Standard audio, good performance

High Quality (48000-96000 Hz): Extended frequency range

Low Quality (22050 Hz): Faster generation, lo-fi character

Very High (>96000 Hz): May slow complex functions

Applications

Sound Design and Synthesis

Use case: Creating unique, evolving synthetic textures

Technique: Generate chaotic sounds, then process with filters/effects

Example: Use Logistic Map as source for granular synthesis

Algorithmic Composition

Use case: Generating musical material with mathematical structure

Technique: Use chaotic functions to create pitch/rhythm sequences

Example: Extract features from chaos for melody generation

Scientific and Educational Use

Use case: Demonstrating mathematical concepts through sound

Technique: Compare different chaotic systems auditorily

Example: Hear the difference between periodic and chaotic behavior

Experimental Music

Use case: Creating non-repeating, organic musical structures

Technique: Layer multiple chaotic generators

Example: Create ever-changing drone textures

Practical Workflow Examples

🎹 Chaotic Melodic Source

Goal: Create evolving melodic patterns

Settings:

  • Function: exp(-1/x²)*sin(50*x)
  • Duration: 5.0 seconds
  • Sampling Rate: 44100 Hz

Process: Generate, then apply pitch shifting and time stretching

Result: Musical chaos with pitched characteristics

🌫️ Textural Bed Creation

Goal: Generate complex background textures

Settings:

  • Function: sin(1/(x*(1-x)))
  • Duration: 10.0 seconds
  • Sampling Rate: 48000 Hz

Process: Generate multiple layers, apply reverb and filtering

Result: Rich, non-repeating textural background

🔬 Mathematical Demonstration

Goal: Compare different chaotic systems

Settings:

  • Functions: sin(1/x), Logistic Map, Tent Map
  • Duration: 2.0 seconds each
  • Sampling Rate: 44100 Hz

Process: Generate and compare waveforms and sounds

Result: Audible differences between chaotic systems

Advanced Techniques

Custom formula creation:
  • Use x as time variable: Ranges from 0 to 1 over duration
  • Praat math functions: sin, cos, tan, exp, ln, sqrt, arctan, etc.
  • Conditional logic: if...then...else...endif statements
  • Multiple operations: Combine functions for complexity
  • Avoid extreme values: Very large outputs may cause clipping
  • Test with visualization: Use drawing to verify function behavior
Post-processing strategies:
  • Filtering: Shape frequency content of chaotic sounds
  • Time-stretching: Extend chaotic evolution
  • Layering: Combine multiple chaotic generators
  • Modulation: Use chaos to modulate other sounds
  • Granular processing: Break chaos into micro-sounds
  • Spatialization: Place chaotic elements in stereo field

Troubleshooting Common Issues

Problem: Praat becomes unresponsive during generation
Cause: Very long duration with complex function
Solution: Use shorter durations (1-5 seconds), simpler functions
Problem: Generated sound is very quiet
Cause: Function produces small output values
Solution: Use Amplify... function in Praat to increase gain
Problem: Custom formula produces errors
Cause: Invalid Praat syntax or mathematical errors
Solution: Check formula syntax, avoid division by zero, test simple first
Problem: Sound is mostly noise with little structure
Cause: Extreme chaotic function or inappropriate parameters
Solution: Try different functions, adjust duration, use visualization
Problem: No sound generated or played
Cause: Audio system issues or extreme function values
Solution: Check Praat audio settings, try basic function first