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.
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.
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
- Run
Chaotic Function Generator.praat; no object selection is needed. - Choose a preset, or leave Custom and select a Function Type.
- For direct functions, set duration and sample rate. For an iterated map, also set carrier frequency, control rate, and FM depth.
- Use a positive Random_seed when you want reproducible Logistic/Tent initialization or reproducible randomness inside a custom formula.
- 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 item | Implemented 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 mixture | Weighted 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 Formula | Evaluated directly as a waveform. Unlike the built-ins, x is physical time; use x/duration_s if normalized time is desired. |
Iterated maps
| Map | State law | Notes |
|---|---|---|
| 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 Map | Piecewise tent law with mu = 1.9999 | The value is deliberately just below 2 to avoid rapid finite-precision collapse of the exact slope-2 orbit. |
| Hénon Map | x[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).
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
| Preset | Overrides |
|---|---|
| Custom | No preset overrides. |
| Gentle Singularity | 2.0 s; sin(1/u); Mono. |
| Dense Oscillation | 1.5 s; Multi-sine singular mixture; Stereo Wide. |
| Logistic Chaos | 3.0 s; custom-r Logistic; carrier 200 Hz; control 500 Hz; depth 0.65; r=3.95; Rotating. |
| Hénon Attractor | 4.0 s; Hénon map; carrier 150 Hz; control 800 Hz; depth 0.65; Rotating. |
| Tent Map Texture | 2.0 s; Tent map; carrier 300 Hz; control 600 Hz; depth 0.75; Stereo Wide. |
Parameters
| Parameter | Default | Meaning |
|---|---|---|
| Duration_s | 1.0 | Final sound duration. |
| Sample_rate_Hz | 44100 | Output sample rate; accepted range 8,000...192,000 Hz. |
| Function_type | sin(1/u) | Selects a direct waveform or an iterated map. |
| Map_carrier_frequency_Hz | 200 | Carrier around which an iterated-map trajectory moves instantaneous frequency. |
| Control_rate_Hz | 1000 | Iteration/control sampling rate for map trajectories. Minimum 20 Hz; upper-limited automatically. |
| FM_depth_fraction | 0.65 | Fractional frequency deviation; accepted range 0...0.95. |
| Chaos_parameter | 3.9 | Logistic-map r for the custom-r Logistic option only; accepted range greater than 0 through 4. |
| Random_seed | 0 | 0 = unpredictable initialization; positive value = reproducible stochastic initialization/custom random formula. |
| Spatial_mode | Mono | Mono, Stereo Wide, or Rotating. |
| Normalize_output | yes | If enabled and the output is nonzero, target peak normalization to 0.90. |
| Draw_visualization | yes | Draw the mechanism/QC figure. |
| Play_result | yes | Play the completed Sound. |
| Custom_formula | sin(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.
| Mode | Implementation |
|---|---|
| Mono | The generated mono signal is retained. |
| Stereo Wide | Left = source / sqrt(2). Right = a delayed copy / sqrt(2). Delay is the smaller of 9 ms and 2% of the sound duration. |
| Rotating | Equal-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.
| Panel | Direct functions | Iterated maps |
|---|---|---|
| A | Sampled mathematical model before edge/spatial rendering. | Actual map geometry: return map x(n) versus x(n+1), or the x-y Hénon attractor. |
| B | Measured final output waveform, using the stronger stereo channel by whole-file RMS when stereo. | Actual bounded instantaneous-frequency trajectory used by the oscillator. |
| C | Measured output spectrogram. | Measured spectrogram with the instantaneous-frequency model guide overlaid. |
| Mechanism strip | Normalized time -> mathematical function -> oversampling/resampling -> output render. | Map state -> control -> bounded frequency -> phase integral -> sine. |
| QC | Sampling 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
- Strogatz, S. H. (2018). Nonlinear Dynamics and Chaos: With Applications to Physics, Biology, Chemistry, and Engineering, 2nd ed. CRC Press. A direct background source for iterated maps, logistic dynamics, Hénon dynamics, bifurcations, and chaos.
- Hénon, M. (1976). "A Two-dimensional Mapping with a Strange Attractor." Communications in Mathematical Physics, 50(1), 69-77. DOI: 10.1007/BF01608556.
- Bidlack, R. (1992). "Chaotic Systems as Simple (But Complex) Compositional Algorithms." Computer Music Journal, 16(3), 33-47. A directly relevant music-composition reference for nonlinear dynamical systems.