Additive Particle Field — User Guide

Granular sound transformation: decomposes audio into pitched particles distributed in time and space, creating ethereal clouds, rhythmic pulses, and shimmering textures.

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

What this does

This script implements additive particle synthesis — a granular approach to audio transformation that decomposes a source sound into short "grains" or "particles" and redistributes them according to analytical and stochastic parameters. Each particle is a pitched sine grain whose frequency, amplitude, timing, and panning are derived from the source sound's features. The result is a shimmering, cloud‑like texture that retains spectral characteristics of the original while creating entirely new temporal and spatial structures.

Key Features:

What are granular particles? In granular synthesis, sound is treated as a cloud of tiny sonic "grains" (typically 10‑100 ms). Each grain is a short waveform (often a sine wave) with its own pitch, amplitude, duration, and spatial position. By controlling the distribution of thousands of these grains, complex textures can be created that are impossible with traditional synthesis. The Additive Particle Field script analyzes an input sound to determine the characteristics of each grain, creating a particle‑based reinterpretation of the source material.

Technical Implementation: (1) Analysis: Extract pitch (via Praat's Pitch object) and intensity from the source sound. (2) Particle Generation: For each of N particles, determine its time position (linear/exponential/random), pitch (from Pitch object at that time), amplitude (from waveform + intensity), panning (pitch‑derived/random/fixed). (3) Grain Synthesis: Create a short sine wave with the selected pitch, windowed by the chosen envelope shape. (4) Spatial Mixing: Add each grain to left/right buffers with appropriate panning gains. (5) Visualization: Plot particles in time‑pitch and time‑pan spaces, color‑coded by panning/amplitude.

Quick start

  1. In Praat, select exactly one Sound object (mono or stereo).
  2. Run script…additive_particle_field.praat.
  3. Choose a Preset or select "Custom" to adjust all parameters manually.
  4. Adjust Particles parameters (number, grain duration, envelope shape).
  5. Set Panning mode and Fixed pan if using fixed panning.
  6. Optionally enable Apply_LFO and set its frequency.
  7. Choose Time distribution (how particles are spread over time).
  8. Enable Draw_visualization to see the particle field.
  9. Click OK — the particle‑based sound appears as "originalname_particles".
Quick tip: Start with the Dense Cloud preset for a rich, granular texture. Use Sparse Field for clearly articulated individual grains. Rhythmic Pulse creates a rhythmic, LFO‑modulated pattern. Enable visualization to see exactly how particles are distributed in time, pitch, and stereo space. The script works best on sounds with clear pitch content (voice, instruments) but produces interesting results with noise as well.
Important: The script requires a selected Sound object. Very short sounds (<0.5 s) may not provide enough analysis data. Large numbers of particles (>500) can be CPU‑intensive. Grain durations shorter than 10 ms may cause aliasing. Pitch‑derived panning maps higher pitches to the right channel, lower pitches to the left. The output is normalized to ‑0.95 dBFS. Visualization creates a multi‑panel Praat picture; disable if you need faster processing.

Granular & Particle Theory

Granular Synthesis Basics

The Sonic Particle

Each particle (grain) is defined by:

Duration: grain_duration_s (typically 0.01–0.2 s) Frequency: f (Hz) derived from source pitch at time t Amplitude: A derived from source amplitude + intensity at time t Envelope: w(t) ∈ {Hann, Gaussian, Rectangular} Panning: p ∈ [0,1] (0 = full left, 1 = full right) Time position: t ∈ [0, duration] within output The grain signal: grain(t) = A × w(t) × sin(2π × f × t) The complete output is the sum of all grains, each placed at its time position.

Why Sine Grains?

Sine waves are used because:

Alternatives (not implemented): Saw/triangle waves (harmonic richness), filtered noise (textural), windowed source excerpts (granular sampling).

Parameter Extraction

Pitch Tracking

🎵 Pitch‑to‑Particle Mapping

Praat's Pitch object analyzes the source sound using an autocorrelation method.

For each particle at time t:

  • Query pitch at time t (linear interpolation between frames)
  • If pitch is undefined (unvoiced/noise), use defaultPitch (200 Hz)
  • Clamp to minPitch (75 Hz) and maxPitch (600 Hz) for musical range

Result: Particles follow the melodic contour of the source.

Amplitude Determination

Two sources combined:

1. Waveform amplitude at time t: amp = |sample_value(t)| 2. Intensity (RMS energy) at time t: intensityValue = Intensity(t) in dB Convert to linear: intensityLin = 10^(intensityValue/20) / 100 Combined: grainAmp = 0.2 × (amp + intensityLin) The factor 0.2 prevents clipping; LFO modulation can further scale this.

Spatialization (Panning)

Three Panning Modes

1. Pitch‑derived panning:
pan = (cos(2π × pitch/maxPitch) + 1) / 2
Low pitches → left, high pitches → right
Creates spectral spread across stereo field

2. Random panning:
pan = randomUniform(0, 1)
Each particle gets random stereo position
Creates diffuse, cloud‑like spatialization

3. Fixed panning:
pan = fixed_pan (0–1)
All particles at same stereo position
Useful for mono‑compatible effects

Pan‑to‑Gain Conversion

For natural loudness preservation (constant power): gainL = √(1 − pan) gainR = √(pan) Example: pan = 0.5 (center) gainL = √0.5 ≈ 0.707 gainR = √0.5 ≈ 0.707 Total power = 0.707² + 0.707² = 1.0 Example: pan = 0.0 (full left) gainL = 1.0, gainR = 0.0

Time Distribution Strategies

Linear Distribution

Particles evenly spaced in time:

For i = 1 to N: t_i = (i − 1) / (N − 1) × duration Result: Regular, metronomic particle stream Use: Rhythmic patterns, clear temporal structure

Exponential Distribution

More particles near the beginning:

For i = 1 to N: x = (i − 1) / (N − 1) t_i = duration × (1 − exp(−3x)) / (1 − exp(−3)) The −3 factor controls density falloff. Result: Dense onset, sparse tail Use: Percussive sounds, natural decays

Random Distribution

Uniform random timing:

For i = 1 to N: t_i = randomUniform(0, duration) Result: Cloud‑like texture, no temporal pattern Use: Atmospheric pads, noise‑based textures

LFO Modulation

Amplitude Modulation

Optional sine‑wave LFO:

If apply_LFO = 1: lfoValue = 0.5 × [1 + sin(2π × lFO_frequency × t)] grainAmp = grainAmp × lfoValue The LFO runs at absolute time (not grain‑local time). All particles at time t share the same LFO value.

LFO Applications

Processing Pipeline

STEP 1 – ANALYSIS: Input sound → Intensity object (Praat) Input sound → Pitch object (75–600 Hz range) STEP 2 – PARTICLE PARAMETER CALCULATION (for i = 1 to N): Time position: t_i (linear/exponential/random) Pitch: f_i = Pitch(t_i) clamped to [75, 600] Hz Amplitude: A_i = 0.2 × (|waveform(t_i)| + Intensity(t_i)/100) Panning: p_i (pitch‑derived/random/fixed) LFO scale: if LFO enabled, multiply A_i by 0.5×[1+sin(2π×lfo_freq×t_i)] STEP 3 – GRAIN SYNTHESIS: Create grain of duration grain_duration_s Formula: "A_i × envelope(x) × sin(2π × f_i × x)" Place grain at time t_i in mix buffers STEP 4 – SPATIAL MIXING: Left channel: sum of all grains × √(1 − p_i) Right channel: sum of all grains × √(p_i) STEP 5 – POST‑PROCESSING: Combine L/R to stereo Normalize peak to 0.95 Fade in/out (handled by grain envelopes) STEP 6 – VISUALIZATION (optional): Plot 1: Original vs particle waveform Plot 2: Particles in time‑pitch space (color by pan) Plot 3: Particles in time‑pan space (color by amplitude)

Preset Descriptions

Built‑in Presets

PresetParticlesGrain DurationEnvelopePanningLFOTime Dist.Character
Dense Cloud30030 msGaussianRandomNoRandomRich, diffuse texture
Sparse Field30150 msHannPitch‑derivedNoLinearArticulated individual grains
Rhythmic Pulse8040 msRectangularFixed (center)4 HzLinearMetronomic, rhythmic
Shimmer15060 msGaussianRandom0.25 HzExponentialSlowly evolving, sparkling
Long Resonance15800 msHannPitch‑derived0.15 HzExponentialSustained, drone‑like

☁️ Preset Deep Dive: Dense Cloud

Intended use: Create rich, granular textures from any source.

Parameters: 300 particles (dense), 30 ms grains (short), Gaussian envelope (smooth), random panning (diffuse), random timing (cloud‑like).

Result: The source sound is transformed into a shimmering particle cloud where individual grains blend into a continuous texture. Works well on speech, instruments, or noise.

🎯 Preset Deep Dive: Sparse Field

Intended use: Highlight individual grains for melodic/rhythmic clarity.

Parameters: 30 particles (sparse), 150 ms grains (long), Hann envelope (natural), pitch‑derived panning (spectral spread), linear timing (even spacing).

Result: Each particle is clearly audible, creating a pointillistic rendition of the source. Pitch contours remain recognizable; stereo field reflects pitch height.

✨ Preset Deep Dive: Shimmer

Intended use: Create evolving, sparkling textures with slow amplitude modulation.

Parameters: 150 particles (medium‑dense), 60 ms grains, Gaussian envelope, random panning, 0.25 Hz LFO (slow swell), exponential timing (dense→sparse).

Result: A slowly pulsating particle field that "shimmers" with amplitude variation. Exponential timing creates a natural decay feeling. Excellent for pad creation.

Parameters & Controls

Particle Parameters

ParameterTypeDefaultDescription
Number_of_particlesinteger100Total number of grains (10–1000)
Grain_duration_sreal0.050Duration of each grain in seconds (0.005–2.0)
Envelope_shapeoptionHannGrain window: Hann (smooth), Gaussian (softer), Rectangular (abrupt)

Panning Parameters

ParameterTypeDefaultDescription
Panning_modeoptionPitch‑derivedSpatial distribution: Pitch‑derived, Random, Fixed
Fixed_panreal0.5When Panning_mode = Fixed, stereo position (0=left, 1=right)

Modulation Parameters

ParameterTypeDefaultDescription
Apply_LFOboolean0Enable amplitude modulation via LFO
LFO_frequencyreal0.5LFO rate in Hz (0.05–20.0)

Time Distribution Parameters

ParameterTypeDefaultDescription
Time_distributionoptionLinearHow particles are spread over time: Linear (even), Exponential (dense→sparse), Random (cloud)

Output Parameters

ParameterTypeDefaultDescription
Draw_visualizationboolean1Draw particle field visualization after processing
Play_resultboolean1Play the result automatically

⚙️ Parameter Interactions

Number_of_particles × Grain_duration_s: Determines density. Many short grains = cloud; few long grains = individual events.

Time_distribution × Apply_LFO: Exponential + LFO = natural decay with pulsation; Random + LFO = chaotic amplitude variation.

Panning_mode × Envelope_shape: Pitch‑derived + Hann = clear spectral stereo image; Random + Gaussian = diffuse spatial cloud.

Fixed ranges: Pitch clamped to 75–600 Hz (musical range); Panning limited to 0–1; Grain duration positive but typically 0.005–0.5 s.

Applications

Granular Texture Creation

Use case: Transform any sound into evolving granular textures for ambient music, sound design, or experimental composition.

Technique: Use Dense Cloud preset with 300–500 particles, random timing, Gaussian envelopes.

Example: Process a spoken word into a shimmering texture that retains phonetic contours but loses intelligibility.

Pointillistic Music

Use case: Create "particle‑based" arrangements where individual grains act as musical notes.

Technique: Use Sparse Field preset with 20–50 particles, linear timing, Hann envelopes.

Workflow:

Rhythmic Processing

Use case: Add rhythmic pulsation or gating effects to sustained sounds.

Technique: Use Rhythmic Pulse preset with LFO enabled (4–8 Hz), rectangular envelopes, fixed panning.

Advantages:

Spectral Spatialization

Use case: Create immersive stereo or surround‑like effects from mono sources.

Technique: Use pitch‑derived panning with many particles (200+), random timing.

Example: Process a mono violin recording; high notes appear on right, low notes on left, creating a "virtual orchestra" effect.

Drone & Ambient Pad Generation

Use case: Generate sustained, evolving drones from short source sounds.

Technique: Use Long Resonance preset with very long grains (0.5–2.0 s), exponential timing, slow LFO.

Example: Process a 2‑second guitar note into a 30‑second drone with slowly shifting particle density and amplitude.

Practical Workflow Examples

🎵 Ambient Texture from Field Recording

Goal: Transform urban noise into ethereal ambient material.

Settings:

  • Preset: Dense Cloud
  • Adjust: Particles = 400, Grain duration = 0.02 s
  • Add: LFO at 0.3 Hz for slow pulsation
  • Time distribution: Random

Result: The noise becomes a shimmering, cloud‑like texture suitable for film backgrounds or music beds.

🎻 Virtual String Orchestra

Goal: Create ensemble‑like texture from solo violin.

Settings:

  • Preset: Sparse Field
  • Adjust: Particles = 60, Grain duration = 0.2 s
  • Panning: Pitch‑derived
  • Time distribution: Linear with slight randomness

Result: The solo violin expands into a chamber‑like texture with individual "players" spread across stereo field.

🔬 Scientific Sonification

Goal: Represent data as particle sound for auditory display.

Settings:

  • Custom parameters
  • Map data values to pitch (min/max frequency)
  • Map time series to particle timing
  • Use amplitude for data intensity
  • Panning for categorical differentiation

Result: Multidimensional data becomes an audible particle field where patterns can be heard.

Advanced Techniques

Parameter automation via scripting:
  • Dynamic particle count: Use a for-loop to process the same sound multiple times with increasing particle counts, then mix.
  • Evolutionary textures: Start with Sparse Field, end with Dense Cloud by interpolating parameters over time.
  • Spatial animation: Automate Fixed_pan from 0 to 1 over duration for moving particle clouds.
  • Multi‑stage processing: Process sound → particle field → process again with different settings → layer results.
Creative parameter combinations:
  • Extreme values: 1000 particles × 0.005 s grains = "stochastic rain" texture.
  • Contradictory settings: Linear timing + Random panning + LFO = rhythmic pattern with random spatial jumps.
  • Minimalist: 5 particles × 2.0 s grains = sparse, meditative events.
  • Hyper‑dense: 800 particles × 0.015 s grains = continuous granular mass.

Troubleshooting Common Issues

Problem: Output too quiet or inconsistent
Cause: Source has low amplitude or pitch tracking fails (unvoiced/noisy).
Solution: Normalize source first; adjust minPitch/maxPitch; use defaultPitch for unvoiced sections.
Problem: Metallic/aliased sound
Cause: Grain duration too short for pitch frequency (less than 2–3 cycles).
Solution: Increase grain_duration_s, especially for low pitches; use Gaussian envelope.
Problem: Processing very slow
Cause: Too many particles and/or long grain duration creating many overlapping grains.
Solution: Reduce number_of_particles or grain_duration_s; disable visualization for speed.
Problem: Stereo image too narrow/wide
Cause: Panning mode not matching material; all particles clustered or too diffuse.
Solution: Try different panning mode; adjust fixed_pan; combine with dry signal for anchor.

Technical Deep Dive

Particle Storage & Visualization

Data Structures

During synthesis, particle parameters are stored in arrays:

particleTime[1..N] # Time position (0–duration) particlePitch[1..N] # Frequency (Hz) particlePan[1..N] # Panning (0–1) particleAmp[1..N] # Amplitude (linear) These arrays are used for: 1. Visualization (plotting time‑pitch‑pan relationships) 2. Debugging (parameter distribution analysis) 3. Optional export (for external processing)

Visualization Algorithm

Three‑panel display:

1. Waveform comparison:
Top: Original waveform (gray)
Bottom: Particle output (purple)

2. Time‑Pitch space:
X‑axis: Time (0–duration)
Y‑axis: Pitch (75–600 Hz)
Color: Blue→Red gradient based on panning
Dot size: Fixed

3. Time‑Pan space:
X‑axis: Time (0–duration)
Y‑axis: Panning (0=left, 1=right)
Color: Green→Yellow gradient based on amplitude
Horizontal line at 0.5 (center reference)

Optimization Strategies

Efficient Grain Synthesis

Instead of creating full‑length sounds for each grain:

Method used: 1. Calculate grain duration (clamped to not exceed total duration) 2. Create sound only for grain duration, not entire output 3. Use Formula with time‑domain conditional to add to mix buffers 4. Remove grain immediately after adding Optimization: Original approach: N × duration samples stored Current approach: N × grain_duration samples stored For 100 particles, 0.05 s grains, 10 s duration: Original: 100 × 10 s = 1000 s of audio storage Current: 100 × 0.05 s = 5 s of audio storage (200× reduction)

Formula‑Based Mixing

Using Praat's Formula for buffer addition:

For each grain: # Left channel formula mixL.Formula: "if x >= start and x <= end then self + grain(x) * gainL else self fi" # Right channel formula mixR.Formula: "if x >= start and x <= end then self + grain(x) * gainR else self fi" This avoids costly Copy/Plus operations and works directly in the time domain.

Mathematical Foundations

Envelope Functions

Three window functions implemented:

1. Hann (raised cosine): w(t) = 0.5 × [1 − cos(2π × t/T)] for t ∈ [0, T] 2. Gaussian: w(t) = exp(−0.5 × [(t − T/2) / (T/4)]²) 3. Rectangular: w(t) = 1 for t ∈ [0, T] Where T = grain_duration_s. Properties: Hann: Smooth, zero at boundaries, minimal spectral leakage Gaussian: Softer, infinite support (effectively truncated) Rectangular: Abrupt, maximal spectral leakage (creates "clicks")

Exponential Time Distribution

The exponential mapping formula:

Given normalized index x ∈ [0, 1]: t(x) = duration × [1 − exp(−α × x)] / [1 − exp(−α)] Where α = 3 (hard‑coded decay factor). Properties: As α → 0: approaches linear distribution As α → ∞: all particles at t = 0 α = 3: ~95% of distribution in first half of duration Can be modified for different density profiles.