Phase-Space Composer — Attractor-Driven Event Montage — User Guide

Segments the input into acoustic events, extracts perceptual feature vectors, and drives event recomposition via a deterministic dynamical system (attractor) in the feature space. Attractors: Hopf (limit cycle), Lorenz, Rössler, Logistic Map.

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

What this does

This script implements a Phase-Space Composer — an attractor-driven event montage engine that segments audio into acoustic events, extracts perceptual feature vectors, and drives event recomposition via a deterministic dynamical system (attractor) in the feature space. Four attractors are available: Hopf (limit cycle), Lorenz, Rössler, and Logistic Map.

🌀 What is Phase-Space Composition?

This approach treats the acoustic feature space as a dynamical system:

  • Events are segmented from the source (silence-based)
  • 5 perceptual features extracted per event: spectral centroid, flatness, entropy, flux, RMS
  • State space constructed from 2-5 dimensions of these features
  • Attractor trajectory generated by a deterministic dynamical system (Hopf, Lorenz, Rössler, Logistic Map)
  • Event mapping selects events whose features match the trajectory, with weighted distance, velocity alignment, and feedback coupling

The result is a composition whose temporal structure follows the dynamics of the chosen attractor.

Key Features:

Technical Implementation: (1) Event Segmentation: Silence-based detection. (2) Feature Extraction: Per-event spectral analysis → 5 features. (3) Normalization: Robust 0-1 scaling per dimension. (4) Trajectory Generation: RK4 integration for continuous attractors, delay embedding for logistic map. (5) Mapping: Weighted distance, velocity alignment, coupling, tabu, temperature. (6) Reconstruction: Concatenate events with crossfades.

Quick start

  1. In Praat, select exactly one Sound object (any duration, any content).
  2. Run script… → select PhaseSpaceComposer.praat.
  3. Choose Attractor_type (Hopf, Lorenz, Rössler, LogisticMap).
  4. Select state dimensions and weight preset.
  5. Set composition parameters (number of events, tabu length, temperature, seed).
  6. Adjust dynamics (velocity weight, coupling) if desired.
  7. Set audio parameters (crossfade, min event duration).
  8. Enable Draw_visualization for analysis display.
  9. Click OK — engine segments, extracts features, generates attractor trajectory, maps events, reconstructs.
Quick tip: Start with Lorenz attractor on a 10-20 second recording with varied texture. Set state_dims=3, weight_preset=Uniform, num_events_output=300. Enable visualization — you'll see the phase-space info panel describing the attractor's behavior. Listen to how the event sequence follows the chaotic but structured Lorenz trajectory. The output appears as "source_phaseSpace_Lorenz" in the Objects window.
Important: PYTHON DEPENDENCIES — Requires numpy and soundfile. FEATURE EXTRACTION uses FFT — short events (<30 ms) are padded to minimum size. TRAJECTORY LENGTH = num_events_output; if longer than attractor's natural cycle, it repeats seamlessly. TABU LENGTH must be less than number of events (auto-clamped). VELOCITY WEIGHT >0 makes selection sensitive to direction of change. COUPLING >0 makes trajectory bend toward chosen events.

Phase-Space Theory

Feature Space

Five perceptual features: Centroid: Σ f·|S(f)| / Σ |S(f)| — spectral brightness (Hz) Flatness: geometric_mean / arithmetic_mean of |S(f)| — 0=tonal, 1=noise Entropy: -Σ p(f)·log₂(p(f)) / log₂(N) — spectral disorder (0-1) Flux: mean frame-to-frame spectral change — transientness RMS: root mean square energy — loudness State dimensions: 2D: centroid + flatness 3D: centroid + flatness + flux 4D: centroid + flatness + entropy + flux 5D: centroid + flatness + entropy + flux + rms Robust normalization to [0,1]: subtract median, divide by IQR, clamp to [-3,3], shift/scale.

Trajectory Generation

📈 RK4 Integration & Delay Embedding

Continuous attractors (Hopf, Lorenz, Rössler) integrated with 4th-order Runge-Kutta:

k₁ = f(x, y, z) k₂ = f(x + dt·k₁x/2, y + dt·k₁y/2, z + dt·k₁z/2) k₃ = f(x + dt·k₂x/2, y + dt·k₂y/2, z + dt·k₂z/2) k₄ = f(x + dt·k₃x, y + dt·k₃y, z + dt·k₃z) x_{n+1} = x + (dt/6)(k₁x + 2k₂x + 2k₃x + k₄x)

Logistic Map (1D chaos) lifted to D dimensions via time-delay embedding:

x_{n+1} = r·x_n·(1-x_n) (r=3.9) state_k = [x_k, x_{k-1}, ..., x_{k-(D-1)}]

All trajectories are min-max normalized to [0,1] per dimension.

Trajectory → Event Mapping

🎯 Three Complementary Mechanisms

1. Weighted Euclidean Distance:

d_pos[i] = √ Σ_d w[d]·(X[i,d] - target[d])²

Dimension weights emphasize specific acoustic qualities.

2. Velocity/Direction Alignment (velocity_weight > 0):

v_traj = traj[k] - traj[k-1] delta_i = X[i] - X[prev_chosen] cos_sim[i] = (delta_i·v_traj) / (||delta_i||·||v_traj||) d_vel[i] = (1 - cos_sim[i]) / 2 d_final = (1-vel_w)·d_pos + vel_w·d_vel

Makes event selection follow attractor's direction of change.

3. Feedback Coupling (coupling > 0):

working_pos = traj[k] + coupling·(X[chosen] - traj[k])

Trajectory bends toward chosen events — data–dynamics interaction.

Anti-repetition + Stochastic Selection:

  • Tabu list: last N chosen events forbidden (unless pool empty)
  • Temperature: 0 = greedy (closest), >0 = softmax over top K=ceil(temp×20) candidates

Attractor Types

Hopf (Limit Cycle)

🔄 Stable Periodic Orbit

dx/dt = α·x − ω·y − x·(x²+y²) dy/dt = ω·x + α·y − y·(x²+y²) Parameters: α=0.5 (radius √α), ω=2π (frequency)

Character: Smooth periodic cycles — repeating morphological patterns without exact repetition

Musical effect: Looping structures with subtle variation, cyclic forms

Lorenz

🦋 Strange Attractor

dx/dt = σ(y - x) dy/dt = x(ρ - z) - y dz/dt = xy - βz Parameters: σ=10, ρ=28, β=8/3 (standard chaotic regime)

Character: Bounded chaos — structured recurrence with sensitive dependence

Musical effect: Familiar patterns returning in unpredictable ways, chaotic but organized

Rössler

🌀 Single-Scroll Chaos

dx/dt = -y - z dy/dt = x + a·y dz/dt = b + z·(x - c) Parameters: a=0.2, b=0.2, c=5.7

Character: Smooth spiral divergence + sudden return — simpler than Lorenz, more regular

Musical effect: Gradual divergence then snap back — tension/release cycles

Logistic Map

📈 1D Chaos + Delay Embedding

x_{n+1} = r·x_n·(1 - x_n) (r=3.9, fully chaotic) state_k = [x_k, x_{k-1}, ..., x_{k-(D-1)}]

Character: Bursts, intermittency, regime shifts — from the classic logistic map

Musical effect: Sudden changes, unpredictable transitions, bursts of activity

Parameters & Controls

Attractor Parameters

ParameterDefaultDescription
Attractor_typeLorenzHopf, Lorenz, Rössler, LogisticMap

State Space Parameters

ParameterDefaultDescription
State_dims3D2D, 3D, 4D, 5D feature spaces

Distance Weighting

ParameterDefaultDescription
Weight_presetUniformUniform, Brightness, Noisiness, Energy, Transient

Composition Parameters

ParameterDefaultDescription
Num_events_output300Number of events in output composition (10–2000)
Tabu_length12Anti-repetition window (1–500, clamped to < n_events)
Temperature0.15Stochastic selection (0 = greedy, 1 = very random)
Seed1234Random seed for reproducibility

Dynamics Parameters

ParameterDefaultDescription
Velocity_weight0.00 = position only, 1 = direction only, blends both
Coupling0.0Feedback strength (events bend trajectory toward them)

Audio Parameters

ParameterDefaultDescription
Crossfade_ms10Crossfade between events (ms)
Crossfade_jitter_ms1.5Random variation in crossfade
Min_event_duration_ms30Minimum event length (ms)

Segmentation Parameters

ParameterDefaultDescription
Silence_threshold_dB-25dB below which is silence
Min_silent_interval0.05Minimum silence for segmentation (s)
Min_sounding_interval0.03Minimum sounding interval (s)

Output

ParameterDefaultDescription
Draw_visualization1Generate 5-panel analysis display
Play_result1Audition after processing
Debug0Write verbose debug log

Visualization & Analysis

5-Panel Display

Phase-Space Composer Visualization: Panel 1: TITLE • Script name, source name, attractor, state dims, weight preset, dynamics parameters Panel 2: INPUT WAVEFORM • Gray waveform with red vertical lines = event boundaries • Title: "Original (N events)" Panel 3: OUTPUT WAVEFORM • Blue waveform = phase-space composition • Title: "Output" • X-axis: Time (s) Panel 4: INPUT SPECTROGRAM • 0-5000 Hz spectrogram of original • Title: "Original spectrogram" Panel 5: OUTPUT SPECTROGRAM • 0-5000 Hz spectrogram of output • Title: "Output spectrogram (attractor)" Panel 6: PHASE-SPACE INFO PANEL • Attractor name and description • Source events count, output steps, unique used, repetition rate • Weight preset, trajectory speed • Velocity weight, coupling, tabu, temperature • Attractor-specific description line Panel 7: SUMMARY PANEL • Attractor, state dims, crossfade • Events, tabu, temperature, weights • Velocity weight, coupling • RMS comparison, duration change, seed

Reading the Phase-Space Info Panel

What the numbers mean:
  • Source events: Number of events detected in input
  • Output steps: Number of events in composition (num_events_output)
  • Unique used: How many distinct source events were selected
  • Repetition rate: (output - unique)/output — higher = more repetition
  • Trajectory speed: Mean step distance in feature space — how fast attractor moves
  • Attractor description: Brief explanation of each attractor's musical character

Interpreting Event Boundaries

Red lines on input waveform:
  • Each red vertical line marks the start of a detected event
  • Events are based on silence threshold and min durations
  • The number of events determines the source material available to the attractor

Applications

Electroacoustic Composition

Use case: Creating compositions whose temporal structure follows attractor dynamics

Technique: Lorenz or Rössler attractors on varied source material

Workflow:

Algorithmic Composition

Use case: Generating new structures from existing material

Technique: Compare different attractors on same source

Examples:

Sound Design for Media

Use case: Creating evolving textures with specific dynamical characters

Technique: Weight presets to emphasize different acoustic qualities

Applications:

Research & Education

Use case: Studying dynamical systems through auditory display

Technique: Enable debug mode, compare attractors on simple sources

Learning outcomes:

Practical Workflow Examples

🎬 Film Scene: Chaotic Narrative

Goal: Create 60-second cue representing chaotic psychological state

Settings:

  • Source: 30-second ambient recording
  • Attractor: Lorenz, 3D
  • Velocity_weight=0.3, coupling=0.1

Result: Chaotic but structured event sequence — psychological turmoil

🎚️ Electronic Music: Cyclic Pad

Goal: Create evolving pad with cyclic variations

Settings:

  • Source: 8-second synth pad
  • Attractor: Hopf, 2D (centroid+flatness)
  • num_events=200, temperature=0.1

Result: Smooth cyclic variations in brightness and noisiness

🎙️ Voice Processing: Bursting Speech

Goal: Create bursts of speech fragments

Settings:

  • Source: 10-second spoken phrase
  • Attractor: LogisticMap, 3D
  • Temperature=0.25, tabu=8

Result: Intermittent bursts of speech, regime shifts

Troubleshooting Common Issues

Problem: Python not found or missing packages
Cause: Python not installed, or packages missing
Solution: Install Python and required packages: pip install numpy soundfile
Problem: Too few events detected
Cause: Silence threshold too high/low, or source has no clear events
Solution: Adjust silence_threshold_dB, reduce min_event_duration_ms
Problem: All output events the same
Cause: Temperature too low, tabu too short, or attractor not exploring
Solution: Increase temperature, increase tabu, try different attractor
Problem: Output has clicks
Cause: Crossfade too short or events too short
Solution: Increase crossfade_ms, increase min_event_duration_ms
Problem: Trajectory speed zero or very low
Cause: Attractor settled into fixed point (rare)
Solution: Use different initial conditions (change seed), or different attractor

Advanced Techniques

Custom weight presets:

Edit dimWeights$ in the Praat script to create custom weight combinations for specific perceptual focuses.

Attractor parameter tuning:

In the Python script, modify the attractor parameters (σ, ρ, β, a, b, c, r) to change the dynamics.

Delay embedding dimensions:

For LogisticMap, the embedding dimension D is set by state_dims — higher dimensions capture more history.

Multi-channel input:

Script converts to mono for analysis; output preserves original channel count. For multichannel, modify reconstruction to handle each channel separately.