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.
What this does
Formula Markov Synthesis separates two stochastic mechanisms that are easy to confuse:
- Poisson timing determines when events occur.
- Markov transitions determine which state is assigned to each event.
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:
Therefore the expected number of events is:
The actual realization is stochastic and normally differs from that expectation. Event duration is independent of the next onset, so events may overlap naturally.
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:
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.
| Model | Structural kernel P0 at r = 0 | Boundary behavior |
|---|---|---|
| Neighbor Persistence | 0.50 stay; 0.25 step down; 0.25 step up. | Steps reflect back into the state range rather than being clamped. |
| Circular Advance | Deterministic +1 state with wraparound. | N → 1. |
| Local Random Walk | Steps −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 Gravity | Outside 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. |
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:
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.
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.
| Preset | States | Density | Base / span | Model / randomness | Event duration | Jitter |
|---|---|---|---|---|---|---|
| Neighbor Melodic Walk | 12 | 4/s | 220 Hz / 1.0 oct | Neighbor Persistence / 0.20 | 110–280 ms | 1.5% |
| Low Center-Gravity States | 5 | 2/s | 60 Hz / 0.55 oct | Center Gravity / 0.08 | 450–1100 ms | 0.8% |
| Fast Circular Pulse | 6 | 8/s | 150 Hz / 0.70 oct | Circular Advance / 0.03 | 55–130 ms | 1.0% |
| Circular Ascending Cycle | 10 | 5/s | 80 Hz / 1.5 oct | Circular Advance / 0.05 | 120–260 ms | 1.2% |
| Broad Random Walk | 8 | 6/s | 120 Hz / 1.2 oct | Local Random Walk / 0.65 | 90–240 ms | 4.0% |
| Center-Biased Walk | 9 | 4/s | 180 Hz / 0.85 oct | Center Gravity / 0.22 | 160–360 ms | 2.0% |
| Sparse Neighbor Texture | 6 | 1.5/s | 200 Hz / 0.90 oct | Neighbor Persistence / 0.15 | 250–650 ms | 2.0% |
| Dense Random-Walk Cluster | 5 | 12/s | 100 Hz / 0.45 oct | Local Random Walk / 0.50 | 65–150 ms | 5.0% |
Event waveform and envelope
Harmonic source
With Enable 3-harmonic source on, each event uses:
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:
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:
| Mode | Event pan | Result |
|---|---|---|
| Mono | Not spatialized. | One-channel output. |
| State-Based Pan | States are distributed from pan 0.05 to 0.95 from lowest to highest state. | State identity is also represented spatially. |
| Rotating Events | 0.5 + 0.46 × sin(2π × 0.10 × onsetTime). | Each event samples a 0.10-Hz left/right trajectory at its 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.
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.
| Property | Behavior |
|---|---|
| Duration | Requested duration, 0–120 s. Events near the end are shortened to remain inside it. |
| Sample rate | Direct synthesis at the selected 8–192 kHz sample rate. |
| Channels | Mono in Mono mode; stereo in the two spatial modes. |
| Outer edge fade | Linear fade-in/out using Edge fade, capped at 20% of total duration. |
| Normalize output | If enabled, every non-zero result receives target peak normalization to 0.90. |
| Output name | markov_<preset name> with spaces replaced by underscores. |
There is no post-synthesis Hann band-pass filter in v0.4.1.
Visualization and QC
| Panel | What it actually shows |
|---|---|
| A — Transition Matrix | The theoretical transition matrix P beside the empirical matrix measured from the realized state sequence. The panel also reports empirical matrix MAE. |
| B — Realized Markov Trajectory | The actual state selected at each Poisson event time. |
| C — State → Sound | Actual event frequency and duration on a log-frequency axis; colour follows state identity. |
| D — Model → Measurement | Measured 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
- Ames, C. (1989). “The Markov Process as a Compositional Model: A Survey and Tutorial.” Leonardo, 22(2), 175–187. DOI: 10.2307/1575226. A direct survey/tutorial on Markov processes as compositional models.