Evolving Granular — User Guide
Granular resynthesis with time-varying event density, pitch trajectory, grain duration statistics, source-position scatter, amplitude variation, and stereo decorrelation.
What this does
Evolving Granular creates a new granular texture from the selected Sound. The source is converted to mono for grain extraction, but the result is always a new stereo Sound. Each grain is a short Hanning-windowed excerpt of the source. Its source position, output time, duration, pitch shift, amplitude, and right-channel deviations are determined before rendering.
The three evolution modes do not vary the same parameters. Density Growth changes event density over output time. Pitch Sweep uses an approximately constant mean event density while pitch follows output time. Statistical Shift divides the output into three statistical regions with different duration, pitch, pitch-randomness, and amplitude distributions.
Position_randomness perturbs where a grain is read from the source. It does not jitter the left-channel event time. This keeps the requested temporal evolution readable.What is a grain?
A grain is a short excerpt of the source waveform used as one synthesis event. In this script, each grain is extracted with Praat's Hanning window, multiplied by a per-grain amplitude factor, optionally pitch-shifted by varispeed resampling, and added into the stereo output at a scheduled start time.
Many grains can overlap in the same output region. Their samples are added rather than concatenated, so increasing density increases the amount of overlap and changes the resulting texture.
Quick start
- Select exactly one Sound object in Praat.
- Run
Evolving_Granular.praat. - Choose one of the eight presets or keep Custom.
- For Custom, set the density values and grain-duration range.
- Choose Density growth, Pitch sweep, or Statistical shift.
- Set source-position, pitch, and amplitude randomness.
- Set Stereo_width; 0 creates identical L/R channels, while larger values increase right-channel decorrelation.
- Enable or disable pitch shifting, visualization, and automatic playback.
- Run the script. The result is named
<source>_<presetName>.
Presets
Named presets replace the grain, evolution, and randomization settings shown below. Stereo_width, Draw_visualization, and Play_result remain at the values chosen in the form.
| Preset | Density | Grain duration | Mode | Pitch target | Position rand. | Pitch rand. | Amp rand. | Pitch |
|---|---|---|---|---|---|---|---|---|
| Dense Cloud | 20 → 40/s | 40–100 ms | Density Growth | 3 st* | 0.40 | 1.5 st | 0.25 | On |
| Sparse Texture | 5 → 12/s | 80–200 ms | Density Growth | 2 st* | 0.20 | 1.0 st | 0.15 | On |
| Rising Pitch Sweep | 15 / 30 | 50–120 ms | Pitch Sweep | +12 st | 0.25 | 2.0 st | 0.20 | On |
| Falling Pitch Sweep | 15 / 30 | 50–120 ms | Pitch Sweep | −12 st | 0.25 | 2.0 st | 0.20 | On |
| Three Region Evolution | 18 / 35 | 30–150 ms | Statistical Shift | 8 st | 0.35 | 2.5 st | 0.25 | On |
| Gentle Growth | 8 → 20/s | 60–160 ms | Density Growth | 2 st* | 0.15 | 1.0 st | 0.10 | On |
| Extreme Density Build | 10 → 60/s | 30–80 ms | Density Growth | 5 st* | 0.50 | 3.0 st | 0.30 | On |
| Micro Grains | 30 → 50/s | 20–50 ms | Density Growth | 7 st* | 0.30 | 4.0 st | 0.25 | Off |
Pitch_shift_semitones as a base pitch target. Its grain pitch is centred at 0 semitones and comes only from Pitch_randomness. The preset still assigns a Pitch_shift value, but that value has no effect while the mode remains Density Growth.Evolution modes
1. Density Growth
The requested density is a linear function of normalized output time:
The total requested grain count is:
Instead of generating candidates and rejecting some of them, v0.5.2 places deterministic quantiles of the cumulative density law. For each grain, it inverts the cumulative integral of λ(u). This avoids the saturation problem that occurs when an acceptance probability exceeds 1.
The selected grain duration is uniformly random between the minimum and effective maximum. Its legal start interval is therefore 0 ... duration − grainDuration, and the density-law position is mapped into that range. Pitch is 0 + Gaussian pitch randomness; amplitude is 1 + Gaussian amplitude randomness, clamped to 0.3–1.5.
2. Pitch Sweep
Here, Initial_density and Final_density are used only through their average to determine N. Grain centres are drawn uniformly across the output, so the expected event rate is approximately constant at that mean density.
A positive target rises from 0 toward that interval; a negative target falls. The base amplitude also changes with time:
3. Statistical Shift
Grain centres are drawn uniformly in time. As in Pitch Sweep, the two density fields determine only the total grain count through their average. The output is divided at normalized times 0.33 and 0.66:
| Region | Duration range within user's min–max span | Base pitch | Pitch randomness σ | Base amplitude |
|---|---|---|---|---|
| First third | 55%–100% | −0.5 × target | 1.0 × Pitch_randomness | 0.9 |
| Middle third | 25%–65% | +0.25 × target | 1.5 × Pitch_randomness | 0.7 |
| Final third | 0%–35% | +1.0 × target | 2.0 × Pitch_randomness | 0.5 |
Amplitude randomness is added to the regional base and then clamped to 0.2–1.3.
Pitch shifting & grain duration
Pitch shifting is implemented by varispeed resampling, not by PSOLA. For a per-grain pitch shift s in semitones:
This changes both pitch and duration: positive shifts shorten the rendered grain, while negative shifts lengthen it. The output placement procedure uses the transformed grain's actual duration and truncates its contribution at the end of the output canvas if necessary.
Pitch processing is skipped only when |shift| ≤ 0.005 semitone, or when Enable_pitch_shifting is off. When pitch shifting is disabled, stored pitch values are set to zero so the visualization matches the rendered audio.
Stereo construction
The synthesis source is mono. Every planned grain is rendered once into the left channel and again into the right channel. The right copy receives three small independent deviations controlled by Stereo_width:
The right channel uses the same grain amplitude as the left. At Stereo_width = 0, all three deviations are zero, so the output is a stereo object with identical L/R channels. At larger values the two channels carry the same granular plan but are increasingly decorrelated.
Parameters
| Parameter | Default | Actual role |
|---|---|---|
| Preset | Custom | Custom plus eight named parameter sets. |
| Initial_density | 10.0 | Start density in Density Growth; otherwise contributes only to mean grain count. |
| Final_density | 25.0 | End density in Density Growth; otherwise contributes only to mean grain count. |
| Grain_duration_min | 0.05 s | Minimum planned grain duration. |
| Grain_duration_max | 0.15 s | Maximum planned duration; clipped internally to the source duration. |
| Evolution_type | Density growth | Density Growth, Pitch Sweep, or Statistical Shift. |
| Pitch_shift_semitones | 7.0 | Pitch endpoint/range control for Pitch Sweep and Statistical Shift; unused as a base target in Density Growth. |
| Position_randomness | 0.3 | Source-read scatter in seconds. Density/Statistical use σ = 0.5 × value; Pitch Sweep uses σ = 0.3 × value. |
| Pitch_randomness | 2.0 st | Gaussian pitch standard deviation; Statistical Shift multiplies it by 1, 1.5, or 2 by region. |
| Amplitude_randomness | 0.2 | Gaussian variation around each mode's base amplitude. |
| Stereo_width | 0.3 | 0–1 scaling of right-channel detune, source jitter, and timing jitter. |
| Enable_pitch_shifting | On | Enables varispeed pitch processing. |
| Draw_visualization | On | Draws Source → Grain evolution map → Output → Summary. |
| Play_result | On | Automatically plays the result. |
Visualization
The Picture window is organized as Source → Grain evolution map → Output → Summary.
- Source: mono display copy of the original source.
- Grain evolution map: each planned grain is a dot; x = left-channel output start time, y = stored pitch shift, and colour = planned grain duration.
- Density strip: measured planned grains per second in time bins. In Density Growth, a dashed line also shows the requested initial-to-final density trajectory.
- Pitch Sweep: a neutral line shows the requested 0 → target pitch trajectory.
- Statistical Shift: neutral boundaries mark the 0.33 and 0.66 region divisions.
- Output: left channel in blue and right channel in orange.
- Summary: preset, mode, grain count, density values, duration range, randomization values, stereo width, and output duration.
Source and Output use the same amplitude scale. Dot size changes automatically with grain count so both sparse and dense clouds remain readable.
Output & limits
- Exactly one Sound must be selected.
- Both density values must be positive.
- Grain durations must be positive and maximum must be at least minimum.
- The source must be at least as long as
Grain_duration_min. - Position, pitch, and amplitude randomness must be non-negative.
Stereo_widthmust be between 0 and 1.- Total grain count is
round(meanDensity × sourceDuration), with a minimum of 1. - Requests above 5,000 grains stop with an error rather than silently reducing density.
- The output duration is the same as the source duration.
- The output is always stereo; a multichannel source is folded to mono for synthesis.
Final level
After all grains are mixed, the script measures the output extremum. If the result is non-silent, it performs peak normalization to 0.95. This can attenuate or amplify the complete texture; it is not an attenuate-only safety ceiling.
Output name
The result is renamed <source name>_<presetName>, for example voice_RisingPitch or field_Custom.