Thermodynamic Transform — User Guide

Thermodynamic audio transformation with AI state discovery. Analyzes acoustic structure → discovers phase regimes via machine learning → applies regime-dependent spectral transforms (Crystal/Fluid/Gas/Plasma). Powered by Python (numpy, scipy, scikit-learn, soundfile).

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 1.0 (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 Thermodynamic Transform — an AI-powered audio transformation engine that analyzes acoustic structure, discovers thermodynamic phase regimes via machine learning, and applies regime-dependent transformations to individual audio events. The result is a sound that has been "thermodynamically processed" based on its own intrinsic structure.

🔥 What is Thermodynamic Audio Transformation?

Drawing an analogy from thermodynamics, this model treats audio as a system with four phase regimes:

  • Crystal — ordered, stable, predictable (low entropy)
  • Fluid — flowing, continuous, moderate entropy
  • Gas — dispersed, chaotic, high entropy
  • Plasma — ionized, extreme, maximum entropy

Machine learning (clustering, predictive modeling, or PCA) discovers which regions of the audio correspond to each regime, then a deterministic state machine applies transformations: crystals duplicate, fluids swap, gases drift, plasmas evaporate.

Key Features:

Technical Implementation: (1) Feature Extraction: Praat extracts pitch, HNR, intensity, formants + Python computes spectral features. (2) Thermodynamic Fields: S, O, T constructed from features. (3) AI Analysis: Clustering/predictive modeling discovers regimes. (4) State Machine: Hysteresis, memory, energy budget. (5) Event Segmentation: Novelty-based detection. (6) Relocation: Regime-dependent reordering. (7) Reconstruction: Crossfaded concatenation.

Quick start

  1. In Praat, select exactly one Sound object (any duration, any content).
  2. Run script… → select ThermodynamicTransform.praat.
  3. Choose Preset (2-7 for specific strategies, 1 for custom).
  4. Set thermodynamic controls (thermo intensity, memory, convection, preserve duration).
  5. Select AI mode and AI strength.
  6. Set seed for reproducibility.
  7. Enable Draw_visualization for analysis display.
  8. Click OK — engine extracts features, runs Python analysis, transforms, creates "source_thermo".
Quick tip: Start with Balanced Flow preset on a 10-20 second recording with varied texture. Enable visualization — you'll see the regime timeline (blue=Crystal, green=Fluid, orange=Gas, red=Plasma) and the transformed waveform. Listen to how different sections are treated differently based on their discovered thermodynamic state. The output appears as "source_thermo" in the Objects window.
Important: PYTHON DEPENDENCIES — This script requires Python with numpy, soundfile, scipy, and scikit-learn installed. The script automatically detects Python installations. FIRST RUN may take 1-2 minutes as Python modules are imported. EVENT SEGMENTATION creates events between 200ms and 3s — adjust if needed in Python script. AI MODES produce different results — experiment to find what works for your material. SEED ensures reproducibility — use same seed for identical results.

Thermodynamic & AI Theory

The Four Thermodynamic Regimes

❄️ Crystal — Low Entropy, Ordered

Acoustic signature: Stable pitch, high harmonicity, low spectral flux

Transformation: At intensity ≥ 0.3, duplicate the lowest-entropy Crystal event

💧 Fluid — Moderate Entropy, Flowing

Acoustic signature: Continuous change, moderate flux, connected gestures

Transformation: Swap adjacent Fluid events when first has higher entropy

💨 Gas — High Entropy, Dispersed

Acoustic signature: Chaotic, noisy, high flux, unstable pitch

Transformation: Displace events proportionally to entropy magnitude, in direction of entropy gradient

⚡ Plasma — Maximum Entropy, Extreme

Acoustic signature: Maximum instability, extreme values

Transformation: Evaporate top X% highest-entropy Plasma events, then anchor remaining to structural positions

Thermodynamic Field Construction

S₀ (Entropy) = 0.30·flatness + 0.25·flux + 0.25·(1 - HNRₙ) + 0.20·pitch_instability O₀ (Order) = 0.35·HNRₙ + 0.25·pitch_stability + 0.20·(1 - flatness) + 0.20·voiced T₀ (Temperature) = 0.40·|dS/dt|ₙ + 0.35·flux + 0.25·|dI/dt|ₙ All fields are normalized to [0,1] and smoothed at micro (30ms) and macro (2s) scales.

AI Modes

🧠 Three Machine Learning Approaches

ModeDescriptionAlgorithm
A — Unsupervised clusteringGMM on full feature space → 6 clusters → sorted by mean entropy → mapped to 4 regimesGaussian Mixture Model
B — Predictive instabilityRidge regression predicts future entropy from past context → clusters on predictionsRidge Regression + GMM
C — Learned entropy (PCA)PCA reduces dimension, local variance in latent space becomes learned entropy measurePCA + GMM

AI_strength blends AI-discovered regimes with physics-based fields:

S = (1-α)·S₀ + α·S_ai

State Machine Dynamics

State transitions controlled by: • Hysteresis: heating vs cooling thresholds (0.20/0.42/0.65 vs 0.12/0.30/0.50) • Memory: minimum dwell time before transition • Energy budget: heat accumulates at rate H_HEAT_RATES[regime], cools based on order • AI vote: high-confidence AI predictions can bias transitions Z_final = thermodynamic_state_machine(S, T, O, Z_ai, C_ai, memory, intensity, hop)

Event Segmentation

Novelty curve combines: 0.30·intensity derivative + 0.20·pitch discontinuity + 0.15·HNR drop + 0.20·spectral flux + 0.15·entropy gradient Peaks → candidate boundaries → enforce min (200ms) and max (3s) durations

Regime-Dependent Relocation

Crystal: duplicate lowest-entropy Crystal event (if intensity ≥ 0.3) Fluid: bubble-sort pass swapping adjacent Fluid events when first has higher entropy Gas: displacement = intensity × entropy × direction × total_length × 0.4 Plasma: evaporate top intensity×30% highest-entropy Plasma events; remaining anchored to start/mid/end based on entropy level Convection: global resort bias = (1-γ)·original_pos + γ·entropy_rank

Preset Strategies

Preset 2: Gentle Crystallization

❄️ Subtle, Ordered

Thermo intensity: 0.3 | Memory: 0.7 | Convection: 0.0

AI mode: A | AI strength: 0.4

Character: Gentle transformation emphasizing Crystal regime, high memory for stability

Use on: Delicate material, preservation of structure

Preset 3: Balanced Flow

💧 Balanced, Fluid

Thermo intensity: 0.5 | Memory: 0.5 | Convection: 0.0

AI mode: A | AI strength: 0.5

Character: Balanced across regimes, moderate memory, standard AI influence

Use on: General purpose, exploration

Preset 4: Volatile Atmosphere

💨 Chaotic, Gaseous

Thermo intensity: 0.7 | Memory: 0.3 | Convection: 0.0

AI mode: B | AI strength: 0.6

Character: Higher intensity, low memory → more volatile, Gas regime emphasized

Use on: Experimental, chaotic textures

Preset 5: Deep Plasma

⚡ Extreme Transformation

Thermo intensity: 0.85 | Memory: 0.2 | Convection: 0.0

AI mode: C | AI strength: 0.7

Character: High intensity, low memory → Plasma regime dominates, many evaporations

Use on: Radical transformation, sound destruction

Preset 6: AI Explorer

🤖 AI-Driven Discovery

Thermo intensity: 0.6 | Memory: 0.4 | Convection: 0.0

AI mode: A | AI strength: 0.9

Character: High AI strength — let the machine learning dominate regime discovery

Use on: Exploring AI's interpretation of your sound

Preset 7: Convection Flow

🌊 Convection Currents

Thermo intensity: 0.6 | Memory: 0.3 | Convection: 0.7

AI mode: B | AI strength: 0.5

Character: Strong convection bias — high-entropy events rise, low-entropy sink

Use on: Creating directional flow, layered textures

Parameters & Controls

Thermodynamic Controls

ParameterDefaultDescription
Thermo_intensity0.6Overall transformation strength (0-1)
Memory0.5State machine inertia/hysteresis (0-1) — higher = slower transitions
Convection0.0Global re-sort bias (0-1) — high entropy rises, low entropy sinks
Preserve_duration1Maintain original duration (pad/trim output)

AI Layer

ParameterDefaultDescription
AI_modeAA=Unsupervised clustering, B=Predictive instability, C=Learned entropy
AI_strength0.5Blend between physics-based and AI-discovered regimes (0-1)

Reproducibility

ParameterDefaultDescription
Seed42Random seed for deterministic results

Output

ParameterDefaultDescription
Draw_visualization1Generate 6-panel analysis display
Play_result1Audition after processing

Visualization & Analysis

6-Panel Display

Thermodynamic Transform Visualization: Panel 1: TITLE • Script name, source name, preset, AI mode, seed Panel 2: INPUT WAVEFORM • Gray waveform • Title: "Original" Panel 3: OUTPUT WAVEFORM • Green waveform • Title: "Transformed" • X-axis: Time (s) Panel 4: ORIGINAL SPECTROGRAM • 0-5000 Hz spectrogram of original • Title: "Original Spectrogram" Panel 5: TRANSFORMED SPECTROGRAM • 0-5000 Hz spectrogram of transformed • Title: "Transformed Spectrogram" Panel 6: REGIME TIMELINE • X-axis: Time, Y-axis: Regime (0-3.5) • Colored bands: - Blue = Crystal (0) - Green = Fluid (1) - Orange = Gas (2) - Red = Plasma (3) • Title: "State Timeline: Blue=Crystal | Green=Fluid | Orange=Gas | Red=Plasma" Panel 7: INTENSITY COMPARISON • X-axis: Time, Y-axis: dB • Gray line = original intensity • Green line = transformed intensity • Title: "Intensity: Grey = original | Green = transformed" Panel 8: SUMMARY PANEL • Regime distribution percentages • Transitions count, mean/peak entropy, mean temperature • Event statistics (relocated, evaporated, duplicated) • Parameters: intensity, memory, convection, AI mode+strength, seed, sample rate

Reading the Regime Timeline

What the colors mean:
  • Blue (Crystal): Ordered, stable regions — these will be preserved or duplicated
  • Green (Fluid): Flowing, continuous regions — adjacent events may swap
  • Orange (Gas): Chaotic, dispersed regions — events will drift
  • Red (Plasma): Extreme, maximum entropy regions — events may evaporate
  • The timeline shows how the AI and physics-based fields have classified each moment
  • Watch for transitions — each color change is a regime boundary

Interpreting Summary Statistics

What the numbers mean:
  • Regime distribution: Percentage of time spent in each regime
  • Transitions: Number of regime changes — high = more dynamic transformation
  • Mean entropy S: Average of entropy field (0-1)
  • Mean temperature T: Average of temperature field
  • Events: Number of segmented events
  • Relocated: Events that changed position in order
  • Evaporated: Events removed entirely (Plasma regime)
  • Duplicated: Events copied (Crystal regime)

Applications

Electroacoustic Composition

Use case: Creating complex, evolving textures from source material

Technique: Volatile Atmosphere or Deep Plasma presets on varied sources

Workflow:

Sound Design for Media

Use case: Creating evolving backgrounds, transitions, or abstract textures

Technique: AI Explorer or Convection Flow on appropriate sources

Applications:

Music Production

Use case: Creating variations of loops, stems, or phrases

Technique: Balanced Flow with different seeds

Examples:

Research & Education

Use case: Studying machine learning applications to audio, thermodynamic analogies

Technique: Compare AI modes on same source, examine regime classifications

Learning outcomes:

Practical Workflow Examples

🎬 Film Scene: Evolving Tension

Goal: Create 60-second tension cue from 30-second drone

Settings:

  • Source: 30-second low drone
  • Preset: Volatile Atmosphere
  • Custom: thermo_intensity=0.8, memory=0.2
  • AI mode: B (predictive) — emphasizes instability

Result: Drone evolves through gas-like states, creating evolving tension

🎚️ Electronic Music: Glitch Variation

Goal: Create glitch variation of drum loop

Settings:

  • Source: 8-second drum loop
  • Preset: Deep Plasma
  • Custom: convection=0.5 (adds directional flow)

Result: Hits evaporate, relocate, duplicate — glitchy, unpredictable texture

🎙️ Voice Processing: Choral Effect

Goal: Create choral texture from solo voice

Settings:

  • Source: 10-second vocal phrase
  • Preset: AI Explorer
  • AI mode: C (PCA) — learns entropy from latent space
  • AI_strength=0.9 (let AI dominate)

Result: Voice segmented into events, reordered based on AI-discovered regimes — creates choral-like polyphony

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 scipy scikit-learn
Problem: Processing very slow
Cause: Python startup overhead + complex computations
Solution: First run will be slow; subsequent runs faster. For long files, consider shorter duration.
Problem: Output has clicks
Cause: Crossfade insufficient or splice detection missed
Solution: Increase XFADE_SEC in Python script, or reduce thermo_intensity
Problem: No audible transformation
Cause: thermo_intensity too low, or preserve_duration masking changes
Solution: Increase thermo_intensity, examine regime timeline to see if classification occurred
Problem: Regime timeline all one color
Cause: Feature extraction failed or source too homogeneous
Solution: Check source has variety; adjust hop_sec in script for finer resolution

Advanced Techniques

Custom event duration limits:

In the Python script, modify EVENT_MIN_DUR and EVENT_MAX_DUR (currently 0.200 and 3.000) for different segmentation scales.

Thermodynamic field tuning:

Adjust weights in construct_fields() to emphasize different acoustic features — e.g., more weight on flux for turbulence-sensitive fields.

State machine thresholds:

Modify thresh_heat and thresh_cool arrays in thermodynamic_state_machine() to change regime transition boundaries.

Multi-channel audio:

The script preserves multichannel audio throughout processing — each event extracts all channels, and reconstruction maintains multichannel format.