Formula Markov Synthesis — User Guide

A finite-state, first-order Markov event synthesizer. A transition matrix chooses the state of each stochastic event, while an independent Poisson process determines event onsets. Each state maps to pitch, duration, and a mild amplitude tilt; events can overlap and may be spatialized individually.

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

What this does

Formula Markov Synthesis separates two stochastic mechanisms that are easy to confuse:

  1. Poisson timing determines when events occur.
  2. Markov transitions determine which state is assigned to each event.
Process:
transition matrix → Markov state sequence
+ independent Poisson onset process
→ state pitch / duration / amplitude
→ optional 3-harmonic event source
→ event envelope
→ optional event-level stereo positioning
→ measured output

This is a genuine first-order finite-state Markov model: the probability distribution for the next state depends on the current state through one row of an explicit transition matrix. Event timing itself is not Markov-derived; it is generated independently.

Events and density

Event density is an expected rate in events per second. Inter-onset intervals are exponentially distributed:

IOI ~ Exponential(Event density)

Therefore the expected number of events is:

expected events = Event density × Duration

The actual realization is stochastic and normally differs from that expectation. Event duration is independent of the next onset, so events may overlap naturally.

Increasing Event density does not force events to become shorter. Instead, the script applies approximate expected-overlap compensation to event amplitude, so a denser texture does not automatically become proportionally louder.

The script refuses settings whose expected event count exceeds 8000 and also has a hard realization guard at 10,000 events.

Transition models

Each Markov type first defines a structural transition matrix P0. The single Transition randomness control is then applied in the same way to all four models:

P = (1 - r) × P0 + r × Uniform(N)

So r = 0 gives the pure structural model, while r = 1 makes every next state uniformly distributed across all N states, independent of the structural kernel.

ModelStructural kernel P0 at r = 0Boundary behavior
Neighbor Persistence0.50 stay; 0.25 step down; 0.25 step up.Steps reflect back into the state range rather than being clamped.
Circular AdvanceDeterministic +1 state with wraparound.N → 1.
Local Random WalkSteps −2, −1, 0, +1, +2 with probabilities 0.10, 0.25, 0.30, 0.25, 0.10.Out-of-range steps reflect back into the state range.
Center GravityOutside center: 0.70 toward center, 0.20 stay, 0.10 away. At center: 0.55 stay, 0.225 to each neighbor.Away moves at outer boundaries reflect inward.
Circular Advance is deterministic only when Transition randomness = 0. Any positive randomness mixes its one-step cycle with uniform jumps.

Every transition row is checked for normalization before synthesis. The Info window also reports mean normalized row entropy and, after generation, the mean absolute error between the theoretical matrix and the empirical transition matrix observed in the realized event sequence.

State-to-sound mapping

The script supports 2–16 states. State identity is represented primarily by pitch and duration, with a smaller amplitude tilt.

Pitch ladder

State frequency spans the requested number of octaves exactly from the first to the last state:

position = (state - 1) / (N - 1) state frequency = Base frequency × pitchScale × 2^(Pitch span octaves × position)

The first state is the scaled Base frequency; the highest state reaches the requested octave endpoint exactly.

Duration

Nominal state duration moves linearly from Min event duration at state 1 to Max event duration at state N. Each realized event then receives ±18% random variation around its state's nominal duration.

Amplitude

The state amplitude factor rises gently from 0.75 at state 1 to 1.0 at state N. Each realized event receives an additional random factor from 0.88 to 1.12.

The current version has no state bandwidth parameter. The older guide's state-bandwidth description and post-synthesis spectral filtering no longer apply.

Frequency jitter and sampling headroom

Each event receives uniform frequency jitter around its state center. Before generating the state ladder, the script computes a single common pitchScale so that the highest requested state, maximum jitter, and enabled harmonics remain below the practical limit of 0.45 × sample rate.

This scales the entire state ladder together rather than clipping individual high states. If that common scale would push the lowest state below 20 Hz, the script stops and asks for safer settings.

Presets

Presets override state count, density, base frequency, Markov model, transition randomness, pitch span, event-duration range, and frequency jitter. Sparse Neighbor Texture also sets Duration to 20 seconds. Sample rate, Spatial mode, Hann-envelope choice, harmonic-source choice, Random seed, normalization, visualization, and playback are not preset-specific.

PresetStatesDensityBase / spanModel / randomnessEvent durationJitter
Neighbor Melodic Walk124/s220 Hz / 1.0 octNeighbor Persistence / 0.20110–280 ms1.5%
Low Center-Gravity States52/s60 Hz / 0.55 octCenter Gravity / 0.08450–1100 ms0.8%
Fast Circular Pulse68/s150 Hz / 0.70 octCircular Advance / 0.0355–130 ms1.0%
Circular Ascending Cycle105/s80 Hz / 1.5 octCircular Advance / 0.05120–260 ms1.2%
Broad Random Walk86/s120 Hz / 1.2 octLocal Random Walk / 0.6590–240 ms4.0%
Center-Biased Walk94/s180 Hz / 0.85 octCenter Gravity / 0.22160–360 ms2.0%
Sparse Neighbor Texture61.5/s200 Hz / 0.90 octNeighbor Persistence / 0.15250–650 ms2.0%
Dense Random-Walk Cluster512/s100 Hz / 0.45 octLocal Random Walk / 0.5065–150 ms5.0%

Event waveform and envelope

Harmonic source

With Enable 3-harmonic source on, each event uses:

fundamental + 0.5 × second harmonic + 0.25 × third harmonic

The source is energy-normalized and uses one random starting phase; the second and third harmonics use 2× and 3× that phase. Harmonics are truncated safely if a particular event approaches the practical Nyquist limit.

With harmonics disabled, the event contains only its fundamental sinusoid.

Event envelope

With Enable Hann event envelopes on, every event uses a full Hann window:

0.5 - 0.5 × cos(2π × eventAge / eventDuration)

With Hann envelopes off, the event is otherwise flat but still receives short raised-cosine edges of up to 4 ms. Therefore “off” means flat body with click-safe edges, not an abrupt rectangular event.

Random seed

A positive seed reproduces event timing, initial state, Markov choices, frequency/duration/amplitude variation, phases, and all other random decisions. Seed 0 uses an unpredictable random state. After synthesis, Praat's unpredictable random initialization is restored.

Spatial modes

Stereo position is assigned at the event level and converted to equal-power gains:

left = sqrt(1 - pan) right = sqrt(pan)
ModeEvent panResult
MonoNot spatialized.One-channel output.
State-Based PanStates are distributed from pan 0.05 to 0.95 from lowest to highest state.State identity is also represented spatially.
Rotating Events0.5 + 0.46 × sin(2π × 0.10 × onsetTime).Each event samples a 0.10-Hz left/right trajectory at its onset.
In Rotating Events, an individual event does not pan continuously during its own duration. Its position is fixed from the rotation trajectory at the event onset.

The current version does not use complementary left/right spectral filtering.

Rendering and output

The script no longer builds one enormous formula for the entire sound. It creates an empty mono or stereo Sound at the final duration and sample rate, then adds event formulas with chronological Formula (part) passes in windows of at most 0.5 seconds.

An event crossing a 0.5-second render boundary retains the same global onset, age, phase, duration, frequency, and envelope on both sides. The chunks are therefore an implementation detail, not a segmentation of the event itself.

If more than 160 overlapping event terms would need to be rendered in one 0.5-second chunk, the script stops explicitly instead of silently omitting events.

PropertyBehavior
DurationRequested duration, 0–120 s. Events near the end are shortened to remain inside it.
Sample rateDirect synthesis at the selected 8–192 kHz sample rate.
ChannelsMono in Mono mode; stereo in the two spatial modes.
Outer edge fadeLinear fade-in/out using Edge fade, capped at 20% of total duration.
Normalize outputIf enabled, every non-zero result receives target peak normalization to 0.90.
Output namemarkov_<preset name> with spaces replaced by underscores.

There is no post-synthesis Hann band-pass filter in v0.4.1.

Visualization and QC

PanelWhat it actually shows
A — Transition MatrixThe theoretical transition matrix P beside the empirical matrix measured from the realized state sequence. The panel also reports empirical matrix MAE.
B — Realized Markov TrajectoryThe actual state selected at each Poisson event time.
C — State → SoundActual event frequency and duration on a log-frequency axis; colour follows state identity.
D — Model → MeasurementMeasured spectrogram of a representative final-output channel with sampled actual event-fundamental guides overlaid.

For stereo output, the representative channel is whichever channel has the higher whole-file RMS.

The QC strip reports transition-matrix row error, empirical matrix MAE, normalized transition entropy, expected/actual event count, realized event density, seed state, state-frequency range, pitch-ladder scaling, and final level measurements.

Further Reading