Fractal Pitch Terrain — User Guide

Builds a layered pitch-control terrain from scaled oscillators, optional square-wave content, bounded control-bandwidth layers, deterministic drift, and an unseeded chaos component, then applies the terrain as a time-varying transposition of the detected source F0 contour.

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

What this does

Fractal Pitch Terrain creates a multi-scale control signal by summing oscillator layers whose frequency is multiplied and whose amplitude decays from layer to layer. Each active layer can combine sine and square-wave shapes plus a small random-amplitude chaos term. A separate low-frequency drift and a time-evolution multiplier can then reshape the terrain over the duration of the Sound.

The resulting terrain is interpreted in semitones and applied as a transposition of the detected source F0 at each voiced control point:

sourceF0(t) → terrain shift in semitones → targetF0(t)

targetF0(t) = sourceF0(t) × 2^(pitchShift(t)/12)
Source contour is preserved: the script does not replace the melody or intonation with a single reference pitch. It follows the analyzed F0 contour and moves each voiced point up or down by the generated terrain amount.

The pitch-control grid is fixed at 10 ms (100 Hz). Fractal layers above 45 Hz are omitted rather than sampled beyond the safe control bandwidth. The script stops if no usable source pitch is detected.

Quick start

  1. Select exactly one Sound object.
  2. Run Fractal_Pitch_Terrain.praat.
  3. Choose Manual or one of the seven built-in terrain presets.
  4. Use the main form to set the macro terrain controls: layer count, base frequency, chaos, pitch depth, drift, and time evolution.
  5. Enable Advanced_settings when you need direct control over layer decay, waveform mix, frequency multiplication, normalization, phase progression, or pitch-analysis limits.
  6. Choose whether to draw the visualization and play the result.
  7. Click OK. The processed Sound remains selected when the script finishes.
Preset interaction: preset values are applied after the Advanced settings dialog. A preset therefore overrides its own terrain-shaping fields even if you edited those fields in Advanced settings. Advanced parameters not assigned by the preset remain as you set them.

Terrain construction

Active layers

Layer 1 starts at Base_frequency with amplitude 1. Each following layer multiplies frequency by Frequency_multiplier and amplitude by Amplitude_decay. Only layers at or below 45 Hz are active.

frequency(iter) = Base_frequency × Frequency_multiplier^(iter−1)
amplitude(iter) = Amplitude_decay^(iter−1)

If a requested layer falls above 45 Hz it is omitted from the DSP. The Info window reports both requested and active layer counts.

Wave shape and chaos

combinedWave = Sine_mix × sin(phase) + Square_mix × sign(sin(phase))

chaos = Chaos_factor × sin(2.3 × phase) × Uniform(0.9, 1.1)

layerValue = layerAmplitude × (combinedWave + chaos)

Chaos_factor introduces unseeded randomness. There is no random-seed parameter, so repeated runs with the same source and settings can produce slightly different terrain curves whenever Chaos_factor > 0.

Phase progression

Each layer uses real elapsed time in seconds. After every layer, Phase_increment × iteration is added to the phase-cycle offset for the next layer.

Depth normalization

With Normalize_depth enabled, the summed active-layer terrain is divided by a nominal bound derived from the active amplitudes and the sine/square/chaos weights. It is then scaled by Pitch_depth and by the normalized time-evolution factor.

timeFactor = 1 + Time_evolution_strength × u^Time_evolution_power

normalizedTerrain = Pitch_depth × (layerSum / normFactor) × (timeFactor / (1 + Time_evolution_strength))

The chaos multiplier can vary up to 1.1, so the normalization is a practical nominal scaling rather than a strict mathematical peak limiter.

Drift

drift(t) = Drift_amplitude × sin(2π × Drift_frequency × elapsedTime) × u²

finalPitchShift = normalized-or-raw terrain + drift

The drift starts at zero and grows quadratically across the Sound. It is added after terrain normalization, so Pitch_depth is not necessarily the final maximum absolute transposition when Drift_amplitude is non-zero.

Presets

There are seven built-in presets plus Manual. Presets override only the fields shown in the table. Drift_frequency, Phase_increment, Normalize_depth, Time_evolution_power, pitch-analysis settings, visualization, and playback remain at the current form/Advanced settings values.

PresetLayersBase HzDecayChaosSin / SqFreq ×DepthDrift ampEvolution
ManualUses the current form and Advanced settings values.
Gentle Fractal41.20.600.100.90 / 0.102.08 st1 st0.20
Complex Terrain71.50.550.250.70 / 0.302.61818 st2 st0.40
Chaotic Mountains82.00.450.600.50 / 0.503.025 st3 st0.70
Micro Fractal50.80.700.050.95 / 0.051.54 st0.5 st0.10
Rhythmic Layers63.00.500.150.40 / 0.602.012 st1.5 st0.30
Evolving Landscape71.30.580.200.80 / 0.202.320 st2.5 st0.80
Extreme Chaos102.50.400.800.30 / 0.703.535 st4 st1.00

Parameters

Main form

ParameterDefaultWhat it controls
PresetManualSelects Manual or one of seven built-in terrain configurations.
Iterations6Requested number of oscillator layers. Layers above the 45 Hz control-bandwidth limit are omitted.
Base_frequency1.5 HzFrequency of the first terrain layer. Must not exceed 45 Hz.
Chaos_factor0.3Strength of the random-amplitude sinusoidal chaos term. Must be non-negative.
Pitch_depth15 stScale applied to the layered terrain. With normalization on, it controls the nominal terrain depth before drift is added.
Drift_amplitude2 stPeak scale of the separate drift component before the u² growth term.
Drift_frequency0.7 HzTrue oscillation frequency of the drift component.
Time_evolution_strength0.5Controls how strongly terrain magnitude evolves across normalized time.
Advanced_settingsNoOpens the secondary fractal-shaping and pitch-analysis dialog.
Draw_visualizationYesDraws the diagnostic Picture-window summary.
Play_resultYesPlays the processed Sound at the end.

Advanced settings

ParameterDefaultWhat it controls
Amplitude_decay0.55Per-layer amplitude multiplier; valid range is >0 to 1.
Sine_mix0.7Weight of the sine component.
Square_mix0.3Weight of the square component.
Frequency_multiplier2.618Per-layer frequency multiplier.
Phase_increment0.33Additional phase-cycle offset accumulated between successive layers.
Normalize_depthYesScales the active layer sum by the nominal active-layer bound before applying Pitch_depth.
Time_evolution_power2Exponent applied to normalized time in the evolution curve.
Time_step0.005 sPraat pitch-analysis time step. It does not change the fixed 10 ms terrain-control grid.
Minimum_pitch50 HzPitch-analysis floor.
Maximum_pitch900 HzPitch-analysis ceiling; must remain below Nyquist.

Pitch mapping and resynthesis

For multichannel input, a mono copy is used only for pitch analysis. The detected F0 contour is sampled at each 10 ms terrain-control position using linear interpolation. Unvoiced positions do not create target PitchTier points.

Target F0 is constrained to 20 Hz through 0.45 × input sample rate. These are target-synthesis safety limits and are separate from the user-set analysis floor and ceiling.

The same target PitchTier is then applied independently to every original channel through Praat Manipulation → Replace pitch tier → Get resynthesis (overlap-add). The original channel count is therefore preserved, while all channels follow the same generated target pitch trajectory.

Output behavior

Visualization

When Draw_visualization is enabled, the script draws:

Visualization storage is decimated to at most 500 points, but the DSP always uses the complete 100 Hz terrain grid. The exact endpoint is retained in the display data.

Waveform scaling: the Original and Fractal waveform panels each use Praat's automatic amplitude range independently; they do not share one common amplitude scale.