Wave Terrain Synthesis — Complete Guide

Advanced synthesis technique: generates complex sounds by scanning mathematical terrains with dynamic trajectories, creating rich evolving textures and harmonic structures.

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

What this does

This script implements wave terrain synthesis — an advanced synthesis technique that creates complex audio by scanning mathematical surfaces (terrains) with dynamic paths (trajectories). The system generates a 2D height field where each point represents an amplitude value, then moves through this terrain along user-defined paths to produce the final sound.

Key Features:

What is wave terrain synthesis? Traditional synthesis: oscillators, filters, envelopes. Wave terrain synthesis: Uses 2D surfaces as sound sources scanned by moving paths. Advantages: (1) Complex spectra: Naturally generates rich harmonic and inharmonic content. (2) Evolutionary sounds: Creates naturally evolving textures. (3) Visual intuition: Terrain visualization helps understand sound generation. (4) Algorithmic control: Mathematical precision for reproducible results. (5) Unique timbres: Produces sounds difficult to achieve with other methods. Use cases: Sound design for media, experimental music composition, academic research in synthesis, electronic music production, algorithmic composition systems.

Technical Implementation: (1) Terrain Generation: Creates 2D matrix representing height field. (2) Trajectory Calculation: Generates X and Y paths through terrain. (3) Audio Synthesis: Samples terrain values along trajectories. (4) Visualization: Displays terrain and contour maps. (5) Modulation: Applies frequency modulation to trajectories. (6) Quality Control: Normalization and parameter validation. (7) Progress Reporting: Real-time processing feedback.

Quick start

  1. In Praat, ensure no objects are selected (script creates new sounds).
  2. Run script…wave_terrain_synthesis.praat.
  3. Choose Preset or select "Custom" for manual control.
  4. Set Duration and Sample_rate for output.
  5. Configure Terrain Settings (type, size, scale).
  6. Define Trajectory Settings (frequencies, waveforms, amplitudes).
  7. Adjust Modulation parameters for dynamic effects.
  8. Set Output_gain for final volume.
  9. Click OK — terrain visualization appears and sound generates.
  10. Result plays automatically as "waveTerrain".
Quick tip: Start with Classic Sine Terrain preset for fundamental understanding. The visualization shows your terrain (top) and contour map (bottom). X and Y trajectories move through this terrain to generate sound. Higher terrain values produce louder output. Complex terrains with modulation create evolving textures. Use headphones to appreciate subtle details. For musical results, try frequency ratios like 2:3, 3:4, or 4:5 between X and Y trajectories.
Important: PROCESSING TIME — Terrain generation and audio synthesis are computationally intensive. Large terrain sizes or long durations will take significant time. MEMORY USAGE — High terrain resolutions require substantial RAM. EXTREME PARAMETERS — Very high frequencies or modulation depths can create aliasing or harsh sounds. VISUALIZATION LIMITS — Very large terrains may not display clearly. REAL-TIME CONSTRAINTS — This is offline synthesis, not real-time generation. The script creates a new Sound object called "waveTerrain".

Wave Terrain Synthesis Theory

Core Concept

🗺️ The Terrain as Sound Source

Fundamental idea: A 2D height field where elevation = amplitude

Synthesis process: Move through terrain along defined paths

Output: Terrain values at path positions become audio samples

Mathematical foundation:

TERRAIN: T(x,y) where x,y ∈ [0,1] and T(x,y) ∈ [-1,1] TRAJECTORY: (X(t), Y(t)) paths through terrain OUTPUT: S(t) = T(X(t), Y(t)) Where: T = terrain function (2D surface) X(t), Y(t) = trajectory functions (paths through terrain) S(t) = output sound t = time Discrete implementation: For each sample n at time t = n/sample_rate: x_pos = X(t) mapped to [1, terrain_size] y_pos = Y(t) mapped to [1, terrain_size] sample[n] = terrain[y_pos, x_pos] × gain

Historical Context

Origins and Development

Wave terrain synthesis history:

1970s-1980s: Early research at Bell Labs and CCRMA Pioneers: William Buxton, Curtis Roads, John Snell Initial implementations: Hardware-based systems 1990s: Software implementations become practical 2000s-present: Widespread use in computer music Key innovations: - Mathematical terrain functions - Dynamic trajectory control - Real-time visualization - Hybrid approaches with other synthesis methods Influence on: - Granular synthesis interfaces - Spectral manipulation displays - Algorithmic composition systems - Sound design tools

Advantages Over Traditional Synthesis

Unique Capabilities

Why use wave terrain synthesis?

AspectTraditional SynthesisWave Terrain Synthesis
Spectrum ControlExplicit harmonic designEmergent from terrain structure
Time EvolutionEnvelope-based changesNatural evolution through paths
Visual InterfaceParameter sliders/knobsDirect terrain manipulation
ComplexityAdditive componentsInherent in terrain geometry
UnpredictabilityLimited without modulationNatural from path interactions
Learning CurveTechnical parameter knowledgeSpatial/visual intuition

Terrain Types

Type 1: Sine Product

🌊 Sine Wave Terrain

Formula: sin(2π×nx×scale) × sin(2π×ny×scale)

Sound character: Harmonic, bell-like, crystalline

Best for: Musical tones, harmonic exploration

Mathematical properties:

T(x,y) = sin(2π × f × x) × sin(2π × f × y) Where: f = 4 × terrain_scale (default frequency multiplier) x,y = normalized coordinates [0,1] Spectral characteristics: - Produces harmonic spectra when scanned linearly - Creates combination tones with modulated trajectories - Scale parameter controls "wrinkliness" of terrain - Higher scale = more high-frequency content Visual appearance: - Regular grid pattern - Smooth undulations - Symmetrical structure

Type 2: Chebyshev Polynomials

📐 Chebyshev Terrain

Formula: (2x-1)³(2y-1)² - (2x-1)²(2y-1)³

Sound character: Metallic, complex, inharmonic

Best for: Experimental textures, metallic sounds

Type 3: Random Terrain

🎲 Random Terrain

Formula: Gaussian random values with smoothing

Sound character: Noisy, textured, unpredictable

Best for: Noise textures, granular effects

Type 4: Fractal Terrain

🔺 Fractal Terrain

Formula: Multi-scale sine summation

Sound character: Rich, evolving, complex

Best for: Evolving pads, complex textures

Type 5: Spiral Terrain

🌀 Spiral Terrain

Formula: sin(2π×distance×scale + angle)

Sound character: Swirling, phasey, rotating

Best for: Doppler effects, rotating sounds

Terrain Parameters

ParameterRangeDefaultEffect
Terrain_size32-512128Resolution (higher = more detail)
Terrain_scale0.1-10.01.0Feature size (higher = smaller features)
Terrain_type1-51Mathematical function type

Terrain Visualization

👁️ Understanding the Display

Top panel: Terrain Image

Color mapping: White = high elevation (+1.0) Black = low elevation (-1.0) Gray = zero elevation (0.0) Interpretation: Bright areas = loud samples when traversed Dark areas = quiet or inverted samples Patterns = harmonic relationships in sound

Bottom panel: Contour Map

Contour lines connect points of equal elevation Line spacing indicates terrain steepness Close lines = rapid changes = high frequencies Distant lines = gradual changes = low frequencies Musical interpretation: Circular contours = harmonic relationships Complex patterns = inharmonic spectra Smooth areas = low-frequency content Detailed areas = high-frequency content

Trajectory Systems

Trajectory Fundamentals

🛤️ Paths Through the Terrain

Concept: Time-varying paths that sample the terrain

Dual control: Independent X and Y trajectory functions

Result: Combined path creates complex sampling pattern

Trajectory mathematics:

General form: X(t) = X_amplitude × waveform(2π × X_frequency × t + X_phase) + X_offset Y(t) = Y_amplitude × waveform(2π × Y_frequency × t + Y_phase) + Y_offset Where waveform can be: Sine: sin(θ) Triangle: 2×|2×(θ mod 1) - 1| - 1 Sawtooth: 2×(θ mod 1) - 1 Square: sign(sin(θ)) Final mapping to terrain coordinates: x_terrain = round(X(t) × (terrain_size - 1) + 1) y_terrain = round(Y(t) × (terrain_size - 1) + 1)

Waveform Types

Sine Trajectories

Smooth circular/elliptical paths:

X(t) = amplitude × sin(2π × frequency × t + phase) Y(t) = amplitude × sin(2π × frequency × t + phase) Characteristics: - Smooth, continuous motion - Creates Lissajous figures when frequencies differ - Musical when frequency ratios are simple - Predictable, repeatable patterns Sound results: - Harmonic spectra with simple ratios - Complex tones with irrational ratios - Smooth evolution between harmonics

Triangle Trajectories

Linear ramps with sharp direction changes:

Triangle wave formula: f(θ) = 2 × |2 × (θ mod 1) - 1| - 1 Characteristics: - Linear motion with instant direction changes - Covers terrain edges more than center - Creates percussive transients at turns Sound results: - Bright, buzzy character - Strong odd harmonics - Rhythmic emphasis from direction changes

Sawtooth Trajectories

Continuous sweeps with instant resets:

Sawtooth wave formula: f(θ) = 2 × (θ mod 1) - 1 Characteristics: - Linear sweeps across terrain - Instant jumps back to start - Systematic coverage of terrain Sound results: - Rich harmonic spectra - Bright, nasal character - Strong fundamental emphasis

Square Trajectories

Binary switching between extremes:

Square wave formula: f(θ) = sign(sin(θ)) Characteristics: - Jumps between minimum and maximum - Samples only terrain edges - Creates rhythmic, pulsed patterns Sound results: - Hollow, woody character - Strong odd harmonics - Rhythmic, percussive quality

Trajectory Parameters

ParameterRangeDefaultEffect
X_frequency0.1-20000 Hz220 HzHorizontal motion speed
Y_frequency0.1-20000 Hz330 HzVertical motion speed
X_amplitude0.0-1.00.8Horizontal motion range
Y_amplitude0.0-1.00.8Vertical motion range
X_offset0.0-1.00.5Horizontal center position
Y_offset0.0-1.00.5Vertical center position
X_phase0-360°Horizontal starting phase
Y_phase0-360°90°Vertical starting phase

Frequency Modulation

Dynamic Trajectory Control

Adding motion to motion:

Modulation formula: X_mod(t) = X(t) × (1 + mod_depth × sin(2π × X_freq_mod × t)) Y_mod(t) = Y(t) × (1 + mod_depth × sin(2π × Y_freq_mod × t)) Where: X_freq_mod, Y_freq_mod = modulation frequencies mod_depth = modulation intensity (0-1) Effects: - Creates evolving, non-repeating paths - Adds sidebands to spectral content - Prevents periodic looping - Increases apparent complexity Musical applications: - Vibrato-like effects - Evolving textures - Chaotic but controlled variation

Built-in Presets

Preset 1: Classic Sine Terrain

🎵 Fundamental Wave Terrain

Configuration: Sine terrain with sine trajectories

Sound character: Pure, harmonic, bell-like

Best for: Learning, fundamental tones

Preset parameters:

Terrain: Sine product (Type 1) X_frequency: 220 Hz (A3) Y_frequency: 330 Hz (E4) - perfect fifth Trajectories: Both sine waves Amplitudes: 0.9 (almost full terrain coverage) No modulation Result: Clean, musical interval with harmonic richness Perfect for understanding basic principles

Preset 2: Metallic Chebyshev

🔩 Metallic Textures

Configuration: Chebyshev polynomials with sine motion

Sound character: Metallic, complex, inharmonic

Best for: Industrial sounds, metallic effects

Preset 3: Chaotic Fractal

🌪️ Complex Evolution

Configuration: Fractal terrain with modulated triangles

Sound character: Evolving, chaotic, rich

Best for: Soundscapes, experimental music

Preset 4: Spiral Galaxy

🌌 Rotating Patterns

Configuration: Spiral terrain with modulated sines

Sound character: Swirling, phasey, rotating

Best for: Doppler effects, spatial motion

Preset 5: FM Complex

📡 Frequency Modulation

Configuration: Sine terrain with heavy FM

Sound character: Dense, bright, evolving

Best for: FM-like textures, complex spectra

Preset 6: Alien Landscape

👽 Experimental Textures

Configuration: Random terrain with square waves

Sound character: Noisy, unpredictable, gritty

Best for: Sci-fi effects, noise textures

Preset 7: Rhythmic Pulses

🥁 Rhythmic Patterns

Configuration: Sine terrain with mixed waveforms

Sound character: Pulsed, rhythmic, articulated

Best for: Rhythmic content, percussive sounds

Preset 8: Smooth Ambient

☁️ Gentle Textures

Configuration: Subtle sine terrain with slow motion

Sound character: Smooth, ambient, pad-like

Best for: Background textures, ambient music

Preset Comparison Table

PresetTerrainX TrajY TrajComplexityMusicality
Classic SineSineSineSineLowHigh
MetallicChebyshevSineSineMediumMedium
Chaotic FractalFractalTriangleSawHighLow
Spiral GalaxySpiralSineSineMediumMedium
FM ComplexSineSineSineHighMedium
Alien LandscapeRandomSquareTriangleVery HighLow
Rhythmic PulsesSineSquareSineMediumHigh
Smooth AmbientSineSineSineLowHigh

Applications

Sound Design for Media

Use case: Creating unique sounds for film, games, and animation

Technique: Use complex terrains with modulated trajectories

Presets: Alien Landscape, Chaotic Fractal, Metallic Chebyshev

Electronic Music Production

Use case: Generating synth sounds and textures

Technique: Musical frequency ratios with harmonic terrains

Presets: Classic Sine, FM Complex, Rhythmic Pulses

Algorithmic Composition

Use case: Creating evolving musical structures

Technique: Parameter automation through time

Presets: All, with focus on evolutionary parameters

Academic Research

Use case: Studying complex synthesis methods

Technique: Systematic parameter exploration

Presets: Custom configurations for specific studies

Music Education

Use case: Teaching synthesis and sound physics

Technique: Visual demonstration of sound generation

Presets: Classic Sine for clear demonstrations

Practical Workflow Examples

🎬 Sci-Fi Sound Design

Goal: Create alien technology sounds

Settings:

  • Preset: Alien Landscape
  • Duration: 3-5 seconds
  • Add modulation for evolution
  • Experiment with extreme parameters

Result: Unique, otherworldly sound effects

🎹 Electronic Music

Goal: Create synth bass or lead sounds

Settings:

  • Preset: Classic Sine or FM Complex
  • Use musical frequency ratios (2:3, 3:4, etc.)
  • Shorter durations for notes
  • Moderate modulation for warmth

Result: Rich, evolving synth tones

🌊 Ambient Soundscapes

Goal: Create background textures

Settings:

  • Preset: Smooth Ambient or Spiral Galaxy
  • Long durations (10-30 seconds)
  • Slow frequencies and subtle modulation
  • Low output gain for background levels

Result: Evolving ambient pads and textures

Creative Techniques

Parameter exploration strategies:
  • Start simple: Use Classic Sine preset as baseline
  • Change one parameter at a time: Understand individual effects
  • Use musical ratios: 2:3, 3:4, 4:5 for harmonic results
  • Experiment with extremes: Discover unexpected textures
  • Combine terrains and trajectories: Create unique hybrids
Advanced techniques:
  • Parameter automation: Change frequencies over time
  • Hybrid approaches: Combine with other synthesis methods
  • Spectral processing: Apply filters or effects to output
  • Multi-layer: Combine multiple terrain sounds
  • Custom terrains: Modify the terrain generation code

Troubleshooting Common Issues

Problem: Output sounds noisy or distorted
Cause: Extreme parameters, aliasing, clipping
Solution: Reduce frequencies, lower gain, use anti-aliasing
Problem: Processing very slow
Cause: Large terrain size, long duration, high sample rate
Solution: Reduce terrain size, shorten duration, lower sample rate
Problem: Sound is too simple or repetitive
Cause: Simple ratios, no modulation, small terrain
Solution: Use complex ratios, add modulation, increase terrain size
Problem: Memory errors
Cause: Very large terrain, insufficient RAM
Solution: Reduce terrain size, close other applications
Problem: Cannot hear expected harmonics
Cause: Trajectories not crossing harmonic features
Solution: Adjust trajectory parameters, try different terrains

Technical Reference

Complete Parameter Reference

ParameterTypeDefaultDescription
Presetoptionmenu1Pre-configured sound settings
Durationpositive1.0Output sound duration (seconds)
Sample_ratepositive22500Audio sampling rate (Hz)
Terrain_sizepositive128Terrain resolution (pixels)
Terrain_typeoptionmenu1Mathematical terrain function
Terrain_scalereal1.0Terrain feature size scaling
X_frequencypositive220Horizontal trajectory frequency (Hz)
Y_frequencypositive330Vertical trajectory frequency (Hz)
X_phasereal0Horizontal starting phase (degrees)
Y_phasereal90Vertical starting phase (degrees)
X_trajectoryoptionmenu1Horizontal waveform type
Y_trajectoryoptionmenu1Vertical waveform type
X_amplitudereal0.8Horizontal motion range (0-1)
Y_amplitudereal0.8Vertical motion range (0-1)
X_offsetreal0.5Horizontal center position (0-1)
Y_offsetreal0.5Vertical center position (0-1)
X_freq_modreal0Horizontal frequency modulation (Hz)
Y_freq_modreal0Vertical frequency modulation (Hz)
Mod_depthreal0.5Modulation intensity (0-1)
Output_gainpositive0.5Final output amplitude

Performance Characteristics

Processing Time Factors

Major time consumers:

1. Terrain generation: O(terrain_size²) - Filling each cell with mathematical function - Smoothing for random terrains 2. Trajectory calculation: O(samples × 2) - Calculating X and Y paths separately - Applying modulation if enabled 3. Audio synthesis: O(samples) - Looking up terrain values for each sample - Progress reporting overhead 4. Visualization: O(terrain_size²) - Drawing terrain image and contours Total complexity: O(terrain_size² + samples) Typical performance: 128×128 terrain, 1s audio: 2-5 seconds 256×256 terrain, 5s audio: 10-30 seconds 512×512 terrain, 10s audio: 1-3 minutes

Output Specifications

Generated Sound Properties

Technical details:

Output object: "waveTerrain" Type: Mono Sound Channels: 1 Duration: user-specified duration Sampling frequency: user-specified sample_rate Amplitude: normalized to peak 0.99 after gain Spectral content: Determined by terrain structure and trajectories Can be harmonic, inharmonic, or noise-like Evolves according to trajectory paths Limited by sampling rate and terrain resolution Quality considerations: Terrain resolution affects high-frequency content Sampling rate must be sufficient for highest frequencies Gain staging prevents clipping