Layered Markov Texture — User Guide

A coupled multi-layer Markov event generator. Each layer has its own Poisson event clock, finite-state transition behavior, frequency anchor, and event stream; optional cross-layer coupling biases future state transitions toward the current ensemble state.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.4 (2026) License: MIT License Repo: Praat AudioTools
Contents:

What this does

Layered Markov Texture generates a texture from up to eight independent-but-optionally-coupled event layers. It is one synthesis engine, not a collection of unrelated synthesis modes.

Each layer has:

All layers are scheduled together in chronological order. When a layer's next Poisson event becomes due, that layer emits an event using its current state, then chooses its next state.

Cross-layer influence acts inside the Markov process. When enabled, the current normalized mean state of the other layers biases the active layer's up/down transition probabilities. It is not an audio effect applied after synthesis.

Quick start

  1. Run Layered_Markov_Texture.praat. No input Sound is required.
  2. Choose Custom or one of the six texture presets.
  3. For Custom, set Duration, Sample rate, Base frequency, layer count/layout/motion, Event rate per layer, Complexity, coupling, and Spatial mode.
  4. Open Edit Markov texture details for state pitch span, event-duration behavior, jitter, coupling strength, layer-motion depth, rotation rate, edge fade, and Random seed.
  5. Run the script. The complete stochastic realization is scheduled first, then rendered into a mono or stereo Sound.

Non-Custom presets override the controls listed in the preset section. To hand-set all synthesis parameters, use Custom.

The layer-specific Markov process

Number of states

Layers deliberately do not all use the same state count:

number of states in layer L = 4 + L

Layer 1 therefore has 5 states, layer 2 has 6, and so on up to 12 states for layer 8.

Normalized state position

The current discrete state is converted to a normalized position from 0 to 1:

statePosition = (state - 1) / (numberOfStates - 1)

This one value influences pitch, duration, level, and second-harmonic weight.

Mobility and jumps

Complexity affects only the transition process. Higher values increase the probability of leaving the current state and modestly increase the probability of a long-distance state jump. Higher-numbered layers also receive slightly more mobility.

Every transition decision has four possible outcomes:

At the lower and upper state boundaries, an outward neighbor move is reflected inward so the chain remains inside its state range.

Directional bias

Without coupling, lower layers have a mild downward tendency and higher layers a mild upward tendency. The base upward bias runs from approximately .35 in the lowest layer to .65 in the highest.

Cross-layer coupling

When Cross-layer influence is enabled, the active layer compares its current normalized state with the mean normalized state of all other layers:

bias = localBias + couplingStrength × (otherLayerMean - currentStatePosition)

The resulting bias is limited to .08–.92. If the other layers are collectively above the active layer, upward moves become more probable; if they are below it, downward moves become more probable. Coupling changes transition direction, not the layer's basic mobility.

With one layer, cross-layer coupling has no effect because there is no ensemble state to compare against.

Event timing and overlap

Poisson event clocks

Each layer has an independent Poisson clock. Inter-onset intervals follow an exponential distribution:

Δt = -ln(U) / EventRate

Event rate per layer is therefore an expected statistical rate, not an exact number of events per second. A particular realization can contain more or fewer events.

The scheduler repeatedly finds whichever layer has the earliest next event, renders that event into the global realization list, advances only that layer's Poisson clock, and continues until the requested Duration is reached.

Event duration is independent of IOI

Event duration does not determine the next onset. It is derived from Mean event duration, state position, and the event-duration spread:

stateDurationFactor = 0.65 + 0.70 × statePosition duration = meanDuration × stateDurationFactor × random factor

The random factor lies between 1 - spread and 1 + spread. Because duration and inter-onset interval are independent, events can overlap within one layer and between layers.

Event-count safety

The form rejects settings whose expected count exceeds 7000 events. Because a Poisson process can exceed its expectation, an additional runtime guard stops a realization if it grows beyond 10000 events rather than continuing without a bound.

Overlap compensation

After scheduling, the script measures:

overlapLoad = sum(event durations) / Duration eventGain = 0.48 / sqrt(max(1, overlapLoad))

This is an energy-management heuristic for overlapping events. It is not final normalization.

State → pitch and timbre

Pitch around a layer anchor

The layer's current anchor is interpolated in log-frequency between its start and end values. The Markov state then places the event symmetrically around that anchor:

f = anchor(t) × 2^(StatePitchSpan × (statePosition - 0.5)) × frequencyJitter

Because statePosition - 0.5 runs from -0.5 to +0.5, State pitch span is the complete low-to-high span in octaves. The anchor lies at the logarithmic center of that state range.

Frequency jitter

Jitter is a direct percentage multiplier around the state-derived fundamental, not a cents value. For example, 1.5% permits a factor from .985 to 1.015.

State-dependent event sound

Each event is a Hann-windowed sinusoidal source. The state also controls a second-harmonic weight:

harmonic2Weight = 0.12 + 0.42 × statePosition

The fundamental + second-harmonic pair receives an approximate RMS compensation before event gain is applied. Phase is randomized per event.

Higher states also have somewhat longer nominal durations and greater nominal event amplitudes. There is no separate “synthesis mode” menu in v0.4; state behavior, layer organization, and event scheduling together form the texture.

Layer layout and motion

Geometric layout

anchor(L) = BaseFrequency × LayerSpacing^(L - 1)

Layer spacing is used only in Geometric layout.

Harmonic layout

anchor(L) = BaseFrequency × L

Harmonic layout ignores Layer spacing and places the layer anchors on integer multiples of the Base frequency.

Stationary

Start and end anchors are identical.

Converging

The geometric mean of all starting anchors is treated as the ensemble frequency center. Each layer's end anchor moves toward that center in log-frequency according to Layer motion depth. At depth 1, all layer anchors end at the common center.

Diverging

Each layer's log-frequency distance from the common center is enlarged. At depth 1, that initial log-distance is doubled by the end of the Sound.

Common frequency scaling

Before events are scheduled, the script estimates the complete possible fundamental range, including layer motion, state span, and frequency jitter. It reserves room for the optional second harmonic and applies one common scale to every layer if required:

frequencyScale = min(1, (0.45 × Fs / 2) / requestedTopFundamental)

Using one scale preserves the relative geometry between all layer anchors. If the resulting lowest possible fundamental would fall below 20 Hz, the script stops instead of distorting the layout independently layer by layer.

Controls

ControlDefault / rangeBehavior
Duration10 s; max 180 sExact final Sound duration.
Sample rate44.1 kHz; 8–192 kHzDirect synthesis and final output rate.
Base frequency80 HzReference anchor for the layer layout.
Number of layers3; 1–8Number of independent Poisson/Markov processes.
Layer layoutGeometricGeometric spacing or harmonic multiples.
Layer spacing1.5; 1–6Ratio between adjacent anchors in Geometric layout; ignored in Harmonic layout.
Layer motionStationaryStationary, Converging, or Diverging anchor trajectory.
Event rate per layer3 events/s; max 60Expected rate of each independent Poisson clock.
Complexity1; 0–3Raises state mobility and long-distance jump probability only.
Cross-layer influenceonEnables ensemble-state bias inside the transition decision.
Spatial modeMonoMono, fixed Layer Spread, or time-varying Rotating Layers.

Advanced details

ControlDefaultBehavior
State pitch span.72 octavesTotal state-controlled pitch span around each layer anchor.
Mean event duration.18 sBase event duration before state and random variation.
Event duration spread.35Symmetric random duration factor; allowed range 0–.9.
Frequency jitter1.5%Per-event multiplicative pitch jitter; allowed range 0–50%.
Cross-layer coupling strength.35Strength of the ensemble-state term added to transition direction bias.
Layer motion depth.70Amount of convergence/divergence in log-frequency.
Rotation rate.08 HzPan-motion rate in Rotating Layers; not used by the other spatial modes.
Edge fade.06 sCommon linear fade at both ends, capped at 20% of total Duration.
Random seed00 = unpredictable; a positive seed reproduces the stochastic schedule, state paths, event parameters, phases, and spatial realization.

Presets

PresetMain structureAdvanced overrides
Sparse Independent Layers14 s; 2 layers; Geometric spacing 2.0; Stationary; 1.5 events/s/layer; Complexity .45; coupling offPitch span .55 oct; mean duration .22 s; coupling strength 0
Dense Coupled Weave12 s; 4 layers; Geometric 1.34; Stationary; 5 events/s/layer; Complexity 1.55; coupling onPitch span .82 oct; mean duration .20 s; coupling .48
Harmonic Layer Stack14 s; base 55 Hz; 5 layers; Harmonic; Stationary; 3 events/s/layer; Complexity .80; coupling onPitch span .42 oct; mean duration .20 s; coupling .28
Wide Geometric Spread12 s; 3 layers; Geometric spacing 3.0; Stationary; 2.5 events/s/layer; Complexity 1.0; coupling offPitch span .62 oct; mean duration .17 s
Converging Layer Field14 s; base 100 Hz; 4 layers; Geometric 1.75; Converging; 4 events/s/layer; Complexity 1.20; coupling onPitch span .58 oct; mean duration .18 s; coupling .42; motion depth .82
Diverging Layer Field14 s; base 95 Hz; 4 layers; Geometric 1.48; Diverging; 2.8 events/s/layer; Complexity .85; coupling onPitch span .68 oct; mean duration .19 s; coupling .30; motion depth .75

The presets do not redefine every advanced field. Unlisted advanced settings keep their common defaults. Sample rate, Spatial mode, Peak protection, Draw visualization, Play result, and Random seed remain user-controlled.

Spatial modes

Mono

One-channel output. Every event is mixed into the mono master.

Layer Spread

Stereo output. Each layer has a fixed pan position distributed from .05 at the first layer to .95 at the last. With one layer the position is center.

Rotating Layers

Stereo output. Each layer receives a different phase offset around a shared sinusoidal pan trajectory:

pan = 0.5 + 0.46 × sin( 2π × RotationRate × eventTime + layerPhase)

Panning is evaluated once per event, so this mode creates event-by-event spatial motion. It does not continuously move one sounding event across the stereo field after that event has begun.

Both stereo modes use equal-power gains sqrt(1-pan) and sqrt(pan). There is no binaural/HRTF processing.

Output and level

PropertyBehavior
InputNo selected Sound is required.
DurationExactly the requested Duration.
Sample rateExactly the selected 8–192 kHz rate.
ChannelsMono for Mono mode; stereo for Layer Spread and Rotating Layers.
Edge fadeOne common linear fade-in and fade-out. The requested fade is capped at 20% of Duration.
Overlap compensationEvent gain is reduced only when summed event-duration load exceeds one complete Duration.
Peak protectionIf enabled and the mixed peak exceeds .92, the complete output is scaled down once to .92.
NormalizationNo upward normalization. If peak ≤ .92, the generated level is preserved.
Object nameLayered_Markov_<preset name>, with spaces replaced by underscores.

Visualization and QC

The current visualization is a mechanism-oriented four-panel analysis of the actual realization.

PanelWhat it shows
A — Realized Markov StatesNormalized emitted state position inside a separate lane for each layer. For very large realizations, events are sampled for display density rather than drawing every point.
B — Actual Event FieldEvent onset, rendered duration, and fundamental frequency on a logarithmic frequency axis. Color identifies the layer.
C — Layer TransitionsExpected mobility for each layer versus the empirical fraction of transitions that actually changed state.
D — Model → MeasurementMeasured spectrogram of a representative output channel with sampled realized event-fundamental guides.

For stereo output, Panel D analyzes whichever complete output channel has the higher RMS. Its frequency range extends far enough to include the event second harmonic where sampling headroom permits.

The bottom QC block reports expected versus actual event count, realized event rate, overlap load, Complexity, whether coupling is active, mean normalized state disagreement, actual fundamental-frequency range, layer layout and motion, common frequency scale, pre-protection peak/RMS, final peak, and whether down-only protection was applied.