Chaotic Function Generator - User Guide

A Praat generator with two related modes: directly sampled nonlinear functions and genuinely iterated dynamical maps used as bounded frequency controls.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.4 reviewed (2026) License: MIT License Repo: Praat AudioTools
Contents:

What this does

The script generates a new Sound; no input Sound is required. Its menu combines two different ideas under one interface. The first group samples mathematical functions directly as waveforms. The second group computes an iterated nonlinear map and uses that trajectory to control the instantaneous frequency of a sine oscillator.

Important distinction: functions such as sin(1/u) are highly oscillatory nonlinear functions, but they are not chaotic dynamical systems. Logistic, Tent, and Hénon are iterated maps and are the genuinely dynamical part of this generator.

Quick start

  1. Run Chaotic Function Generator.praat; no object selection is needed.
  2. Choose a preset, or leave Custom and select a Function Type.
  3. For direct functions, set duration and sample rate. For an iterated map, also set carrier frequency, control rate, and FM depth.
  4. Use a positive Random_seed when you want reproducible Logistic/Tent initialization or reproducible randomness inside a custom formula.
  5. Choose Mono, Stereo Wide, or Rotating, then run the script.

Two generator families

Direct sampled functions

The built-ins use normalized time u = t/T. Praat evaluates the chosen expression at an internal sample rate of up to 4x the requested rate, capped at 192 kHz, then resamples to the requested output rate. This reduces aliasing around rapidly oscillating regions but cannot mathematically remove all aliasing near a singularity.

The result is the sampled function itself, followed by the common edge, spatial, and output-level stages.

Iterated dynamical maps

Logistic, Tent, and Hénon are iterated at a separate control rate. After burn-in, the actual trajectory is stored, resampled to audio rate, mapped to a bounded instantaneous-frequency curve, integrated to phase, and rendered as a sine wave.

This means the map controls pitch motion; the raw map samples are not played directly as audio.

Function library

Direct mathematical waveforms

Menu itemImplemented idea
sin(1/u)Reciprocal phase argument; oscillation becomes increasingly rapid toward the start.
sin((1/u)*(1/(1-u)))Rapid oscillation toward both ends of normalized time.
Multi-sine singular mixtureWeighted singular sine/cosine mixture divided by the coefficient sum (10), avoiding definition-level overload.
sin(3/u)*sin(5/(1-u))Product of two oppositely directed singular oscillations.
sin(1/u) + 2*sin(1/(1-u))Asymmetric two-end mixture, divided by 3.
tan(1/u)*cos(1/(1-u))The tangent term is explicitly bounded to -1...+1 before multiplication.
sin(1/u^2)*cos(1/(1-u)^2)More rapidly varying reciprocal-square arguments.
exp(-1/u^2)*sin(50u)Exponential weighting multiplied by sin(50u); 50 is radians across normalized time, not 50 cycles.
sin(1/u)*cos(1/u^2)Two scales of reciprocal oscillation at the same end.
sin(1/(u(1-u)))Two-end reciprocal product inside the sine phase.
sin(ln(u))*cos(ln(1-u))Logarithmic time warping with small positive offsets inside the logarithms.
Custom FormulaEvaluated directly as a waveform. Unlike the built-ins, x is physical time; use x/duration_s if normalized time is desired.

Iterated maps

MapState lawNotes
Logistic Map (r = Chaos_parameter)x[n+1] = r*x[n]*(1-x[n])Chaos_parameter is the actual r value and may also be set to non-chaotic regimes.
Logistic Map (r = 3.7)x[n+1] = 3.7*x[n]*(1-x[n])Fixed-r version.
Tent MapPiecewise tent law with mu = 1.9999The value is deliberately just below 2 to avoid rapid finite-precision collapse of the exact slope-2 orbit.
Hénon Mapx[n+1] = 1 - 1.4*x[n]^2 + y[n]
y[n+1] = 0.3*x[n]
Uses the standard fixed start (0.1, 0.1) and no stochastic escape reset.

How an iterated map becomes sound

The script first discards a burn-in region: 200 iterations for Logistic, 100 for Tent, and 500 for Hénon. Logistic and Tent start from a random value in 0.11...0.89; Hénon starts deterministically at (0.1, 0.1).

control trajectory m(t), limited to -1...+1 for sonification f(t) = carrier * [1 + depth * m(t)] phase[n] = phase[n-1] + 2*pi*f[n]/Fs y[n] = sin(phase[n])

FM_depth_fraction therefore specifies a true fractional frequency deviation around the carrier. A depth of 0.65 requests approximately carrier x (1 - 0.65) through carrier x (1 + 0.65), subject to the actual map trajectory.

The carrier is automatically reduced if necessary so that the requested maximum excursion stays below 45% of the sample rate. Control rate is limited to at most 5 kHz and at most one quarter of the audio sample rate.

Presets

PresetOverrides
CustomNo preset overrides.
Gentle Singularity2.0 s; sin(1/u); Mono.
Dense Oscillation1.5 s; Multi-sine singular mixture; Stereo Wide.
Logistic Chaos3.0 s; custom-r Logistic; carrier 200 Hz; control 500 Hz; depth 0.65; r=3.95; Rotating.
Hénon Attractor4.0 s; Hénon map; carrier 150 Hz; control 800 Hz; depth 0.65; Rotating.
Tent Map Texture2.0 s; Tent map; carrier 300 Hz; control 600 Hz; depth 0.75; Stereo Wide.
Presets do not replace every form field. In particular, sample rate, Random_seed, Normalize_output, Draw_visualization, Play_result, and the Custom Formula text remain as entered unless the selected preset explicitly changes the relevant field.

Parameters

ParameterDefaultMeaning
Duration_s1.0Final sound duration.
Sample_rate_Hz44100Output sample rate; accepted range 8,000...192,000 Hz.
Function_typesin(1/u)Selects a direct waveform or an iterated map.
Map_carrier_frequency_Hz200Carrier around which an iterated-map trajectory moves instantaneous frequency.
Control_rate_Hz1000Iteration/control sampling rate for map trajectories. Minimum 20 Hz; upper-limited automatically.
FM_depth_fraction0.65Fractional frequency deviation; accepted range 0...0.95.
Chaos_parameter3.9Logistic-map r for the custom-r Logistic option only; accepted range greater than 0 through 4.
Random_seed00 = unpredictable initialization; positive value = reproducible stochastic initialization/custom random formula.
Spatial_modeMonoMono, Stereo Wide, or Rotating.
Normalize_outputyesIf enabled and the output is nonzero, target peak normalization to 0.90.
Draw_visualizationyesDraw the mechanism/QC figure.
Play_resultyesPlay the completed Sound.
Custom_formulasin(1/((x/duration_s)+eps))Direct Praat Sound formula. Script variables such as duration_s and eps are available.

Output and spatial modes

Before spatial rendering, the generator applies one combined linear edge envelope. Its fade duration is the smaller of 10 ms and 20% of the total duration.

ModeImplementation
MonoThe generated mono signal is retained.
Stereo WideLeft = source / sqrt(2). Right = a delayed copy / sqrt(2). Delay is the smaller of 9 ms and 2% of the sound duration.
RotatingEqual-power complementary stereo trajectory at 0.2 Hz.

If Normalize_output is enabled, the final nonzero output is scaled to peak 0.90. If normalization is disabled, a direct/custom waveform is only scaled down when its pre-render peak exceeds 0.98; this is a playback-range safety ceiling, not normalization. Iterated-map audio is already a bounded sine oscillator.

The final Sound is named chaos_<preset>.

Visualization and QC

The figure changes according to the generator family rather than forcing both mechanisms into one explanation.

PanelDirect functionsIterated maps
ASampled mathematical model before edge/spatial rendering.Actual map geometry: return map x(n) versus x(n+1), or the x-y Hénon attractor.
BMeasured final output waveform, using the stronger stereo channel by whole-file RMS when stereo.Actual bounded instantaneous-frequency trajectory used by the oscillator.
CMeasured output spectrogram.Measured spectrogram with the instantaneous-frequency model guide overlaid.
Mechanism stripNormalized time -> mathematical function -> oversampling/resampling -> output render.Map state -> control -> bounded frequency -> phase integral -> sine.
QCSampling method, safety scaling, output peak/RMS, spatial mode, normalization, seed.Map law, burn-in, control range, requested carrier/depth, realized frequency range, output metrics.

Further Reading