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.
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:
targetF0(t) = sourceF0(t) × 2^(pitchShift(t)/12)
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
- Select exactly one Sound object.
- Run
Fractal_Pitch_Terrain.praat. - Choose Manual or one of the seven built-in terrain presets.
- Use the main form to set the macro terrain controls: layer count, base frequency, chaos, pitch depth, drift, and time evolution.
- Enable Advanced_settings when you need direct control over layer decay, waveform mix, frequency multiplication, normalization, phase progression, or pitch-analysis limits.
- Choose whether to draw the visualization and play the result.
- Click OK. The processed Sound remains selected when the script finishes.
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.
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
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.
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
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.
| Preset | Layers | Base Hz | Decay | Chaos | Sin / Sq | Freq × | Depth | Drift amp | Evolution |
|---|---|---|---|---|---|---|---|---|---|
| Manual | Uses the current form and Advanced settings values. | ||||||||
| Gentle Fractal | 4 | 1.2 | 0.60 | 0.10 | 0.90 / 0.10 | 2.0 | 8 st | 1 st | 0.20 |
| Complex Terrain | 7 | 1.5 | 0.55 | 0.25 | 0.70 / 0.30 | 2.618 | 18 st | 2 st | 0.40 |
| Chaotic Mountains | 8 | 2.0 | 0.45 | 0.60 | 0.50 / 0.50 | 3.0 | 25 st | 3 st | 0.70 |
| Micro Fractal | 5 | 0.8 | 0.70 | 0.05 | 0.95 / 0.05 | 1.5 | 4 st | 0.5 st | 0.10 |
| Rhythmic Layers | 6 | 3.0 | 0.50 | 0.15 | 0.40 / 0.60 | 2.0 | 12 st | 1.5 st | 0.30 |
| Evolving Landscape | 7 | 1.3 | 0.58 | 0.20 | 0.80 / 0.20 | 2.3 | 20 st | 2.5 st | 0.80 |
| Extreme Chaos | 10 | 2.5 | 0.40 | 0.80 | 0.30 / 0.70 | 3.5 | 35 st | 4 st | 1.00 |
Parameters
Main form
| Parameter | Default | What it controls |
|---|---|---|
| Preset | Manual | Selects Manual or one of seven built-in terrain configurations. |
| Iterations | 6 | Requested number of oscillator layers. Layers above the 45 Hz control-bandwidth limit are omitted. |
| Base_frequency | 1.5 Hz | Frequency of the first terrain layer. Must not exceed 45 Hz. |
| Chaos_factor | 0.3 | Strength of the random-amplitude sinusoidal chaos term. Must be non-negative. |
| Pitch_depth | 15 st | Scale applied to the layered terrain. With normalization on, it controls the nominal terrain depth before drift is added. |
| Drift_amplitude | 2 st | Peak scale of the separate drift component before the u² growth term. |
| Drift_frequency | 0.7 Hz | True oscillation frequency of the drift component. |
| Time_evolution_strength | 0.5 | Controls how strongly terrain magnitude evolves across normalized time. |
| Advanced_settings | No | Opens the secondary fractal-shaping and pitch-analysis dialog. |
| Draw_visualization | Yes | Draws the diagnostic Picture-window summary. |
| Play_result | Yes | Plays the processed Sound at the end. |
Advanced settings
| Parameter | Default | What it controls |
|---|---|---|
| Amplitude_decay | 0.55 | Per-layer amplitude multiplier; valid range is >0 to 1. |
| Sine_mix | 0.7 | Weight of the sine component. |
| Square_mix | 0.3 | Weight of the square component. |
| Frequency_multiplier | 2.618 | Per-layer frequency multiplier. |
| Phase_increment | 0.33 | Additional phase-cycle offset accumulated between successive layers. |
| Normalize_depth | Yes | Scales the active layer sum by the nominal active-layer bound before applying Pitch_depth. |
| Time_evolution_power | 2 | Exponent applied to normalized time in the evolution curve. |
| Time_step | 0.005 s | Praat pitch-analysis time step. It does not change the fixed 10 ms terrain-control grid. |
| Minimum_pitch | 50 Hz | Pitch-analysis floor. |
| Maximum_pitch | 900 Hz | Pitch-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
- Name:
<source>_fractal_Manual,_Gentle,_Complex,_Chaotic,_Micro,_Rhythmic,_Evolving, or_Extreme. - Duration: preserved.
- Sample rate / sample grid: preserved.
- Channels: preserved.
- Randomness: the chaos term uses unseeded random values when
Chaos_factor > 0; repeated runs can differ. - Peak handling: the final Sound is scaled to a peak of 0.95 only when its absolute peak exceeds 0.95. Quieter output is not raised. This is an attenuate-only peak safety, not target normalization.
Visualization
When Draw_visualization is enabled, the script draws:
- Original waveform — the selected source Sound.
- Result waveform — the processed multichannel Sound.
- Fractal terrain curve — the final semitone control trajectory after terrain scaling and drift.
- Layer decomposition — up to the first six active fractal layers, before global terrain scaling and drift.
- Statistics line — active layers, frequency multiplier, amplitude decay, chaos, and the selected depth mode.
- Summary strip — compact description of the displayed control terrain and rendered output.
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.