## Native instrument and timeline reference

Reference documentation © 2026 Nenad Micic. SPDX-License-Identifier: Apache-2.0

This section describes the implemented timeline reader, not proposed engine families. Text examples below are fragments to combine with the enclosing session header and voice/events shown here. Preserve a generated record with its engine identity and replay hash after validating a composition.

The approved composition build is `SINE_BITS=12 EXP_BITS=10 PHASE64=1 ENV64=1`, with `FM_FB_AVG=1` and `FM_CTL=64`. These are the Makefile defaults. Work at 48000 or 44100 Hz unless deliberately testing another supported rate. The record's `engine` line must exactly match the executable, including its table hash; obtain it from that build's emitted record or the composer, never invent it. Source: Makefile (source checkout: `Makefile`), reader and CLI (source checkout: `src/host/harness.c`).

### Units and session skeleton

All numbers are decimal integers except the explicitly named 16-character lowercase hexadecimal hashes. Signed fields accept an optional minus, not a leading plus. `#` starts a comment. Names are 1–31 ASCII letters, digits, `_`, `-` or `.`. There is no quoted-string syntax.

Native TL schedules events in nanoseconds; it contains no authored BPM, meter,
bar or beat map. Musical-time score clocks compile those choices into event
times. Keep the editable score when revising in beats or bars; a TL alone does
not uniquely recover the original tempo/meter. Optional catalog tempo labels
are descriptive metadata, not native timing declarations.

| Unit | Meaning |
|---|---|
| `MILLIHZ` | 1000 = 1 Hz; A4 = 440000 |
| `DB10` in level/sustain/threshold | Positive attenuation: 60 = 6 dB below the reference; 0 is loudest. Shape drive, compressor makeup and signed master gain are exceptions explicitly identified below. |
| `RATIO_Q16` | 65536 = 1:1; 131072 = 2:1 |
| index / feedback `Q10` | 1024 = 1 radian of phase modulation |
| send / vector / table position / modulation `Q15` | 32768 = 1; signed controls span −32768..32768. Note velocity's effective maximum is 32767. Spatial coordinates instead use mm. |
| `PHASE_U16` | 65536 units per turn; 16384 is a quarter turn |
| `Q_MILLI` | 1000 = resonance Q of 1 |
| `PERMILLE` | 1000 = 1 |
| `NS`, `MS`, `US` | Nanoseconds, milliseconds, microseconds; do not exchange them. |

A complete one-file session has this shape (`ENGINE_ID_FROM_CURRENT_BUILD` is a placeholder, not accepted text):

```text
timeline draft1
engine ENGINE_ID_FROM_CURRENT_BUILD
fs 48000
length_ns 2000000000
streams lead
patch tone 0 65536 180 0 0 256 5 300 120 300
patch tone 1 131072 0 2048 0 256 5 300 180 300
voice 0 tone
0 lead 0 on 440000 32767
1200000000 lead 0 off
```

Without `route`, operator 0 is the carrier and operator 1 modulates it. The example's carrier attenuation is 18 dB; it leaves useful mixing headroom. Operator 1's level and operator 0's index/feedback are unused on this fixed path. `length_ns` includes the desired release/effect tail; the renderer cuts at that duration. `hash HEX` is optional for a new composition and is a replay assertion when present.

Headers may be in `session.tl` with events in stream files, or combined in one file. Read all files as one pool: headers are resolved before events. Limits are 17 input files, 16 stream names, 32 patches, 64 voices, 24 tokens per line, and a 1024-byte input-line buffer. Voice indices must be contiguous from 0; every referenced patch/operator/bank must exist. Duplicate singleton headers, duplicate operator/slot definitions, unknown keywords, and unsupported combinations are errors.

`fs` accepts 1..4294967295, subject to the feature-specific limits below. The duration must fit checked unsigned multiplication, produce 1..4294967295 frames, and obey tighter channel-count limits. An ordinary stereo render is limited to 2147483647 frames; field routes require `frames × channels <= 4294967295`.

Events sort by **nanosecond timestamp, declared stream order, then input file/line order**. Conversion to a sample uses `floor(T_NS × fs / 1e9)`; every event must precede the final frame. At equal timestamps, author the intended order explicitly: an off before its replacement on, and a control latch before an on when the new note must capture that value. Do not indiscriminately reorder `ctl` events. Stream names do not reserve voices.

### Operator patches, waves and routing

```text
patch NAME OP RATIO_Q16 LEVEL_DB10 INDEX_Q10 FEEDBACK_Q10 VEL_SENS_Q8 ATTACK_MS DECAY_MS SUSTAIN_DB10 RELEASE_MS [KS_BREAK_MILLIHZ KS_SLOPE_DB10 [WAVE [RATE_SCALE [FIXED_MILLIHZ [PHASE_U16 [FREE]]]]]]
route PATCH OPS CARRIERS [FROM>TO:WEIGHT[:pm|am|ring|sync] ...]
noise PATCH OP SHIFT
```

The nine basic values are required. Extras are positional: write both key-scaling fields before `WAVE`, and fill earlier optional positions with zero to reach a later field. There are 9 or 11–16 values after `OP`, never 10. Omitted extras are zero.

| Field | Accepted text / effective behavior |
|---|---|
| OP | 0..3; fixed path requires 0 and 1, routed path requires every 0..OPS−1 exactly once |
| RATIO_Q16, KS_BREAK_MILLIHZ, FIXED_MILLIHZ | 0..4294967295 |
| LEVEL_DB10, SUSTAIN_DB10 | Text 0..65535; effective attenuation clamps at 1200 (120 dB) |
| INDEX_Q10, FEEDBACK_Q10 | 0..65535 |
| VEL_SENS_Q8 | Text 0..65535; effective 0..256, with 0 ignoring velocity and 256 fully tracking |
| ATTACK_MS, DECAY_MS, RELEASE_MS | 0..65535; rounded sample counts have at least one sample, so zero is not a zero-sample operator segment |
| KS_SLOPE_DB10 | Text 0..65535; effective attenuation is bounded at 1200. Right-side dB per octave above the break; zero disables it. |
| WAVE | 0 sine; 1 half-sine; 2 absolute-sine; 3 quarter-sine; 4 white noise; 5 alternating sine; 6 camel; 7 square; 8 eight-octave log-saw; 9 pink noise; 10 low-pass noise; 11 high-pass noise |
| RATE_SCALE | 0..7. Segment durations shorten with the note's pitch; 0 disables scaling. Pitch events do not recalculate these captured durations. |
| FIXED_MILLIHZ | Zero follows the note; nonzero is the frequency **before the ratio**. Pitch events, PEG/LFO pitch and matrix pitch do not bend a fixed operator; key/rate scaling still use the note. |
| PHASE_U16 | 0..65535 at initialization / key-synced start |
| FREE | 0 key sync; 1 preserve phase/noise but freeze while idle; 2 continue through rendered idle time. Retriggers preserve operator phase in all three modes. |
| noise SHIFT | 1..15, default 4; only legal on waves 10/11. One-pole coefficient is `2^-SHIFT`, not a frequency in Hz. |

Attack is linear in amplitude; decay/release are linear in attenuation. Release time is the peak-to−96 dB slope, so releasing from a quieter level finishes sooner. A retrigger in an ongoing attack retains its attack slope; do not assume every on resets the waveform or every envelope to zero. Ratio/frequency paths ultimately apply their native frequency clamps. Noise waveforms ignore incoming PM and self-feedback, but their outputs can still modulate other operators. The non-sine waves, hard sync and nonlinear shaping are not a blanket alias-free oscillator promise.

Noise waves 4/9/10/11 draw new random values when their natural operator phase
crosses a half-turn, not at every sample. Note frequency and ratio therefore
change the noise clock; FIXED_MILLIHZ holds its base frequency across notes.
Incoming PM/self-feedback does not clock it. `noise PATCH OP SHIFT` only shapes
waves 10/11; it neither selects a waveform nor changes white/pink noise.

`LEVEL_DB10` is source attenuation: nominal linear gain is
`10^(-min(LEVEL_DB10,1200)/200)`, implemented with fixed-point tables. It does
not specify final dBFS or LUFS. The output depends on oscillator shape and
modulation, envelope, velocity, carrier summing, voice processing, placement,
sends/returns and master processing. Voices sum without automatic normalization.
For one dry centered ordinary-stereo sine, placement adds about −3.01 dB per
channel and sine RMS is another −3.01 dB below sample peak. Lower frequencies,
brief envelopes and pauses change measured loudness independently of LEVEL.

Velocity multiplies both output level and modulation index, with approximate
gain `1 - min(VEL_SENS_Q8,256)/256 * (1 - min(velocity,32767)/32767)`.
Integer rounding applies. Half velocity is about −6.02 dB for sensitivity 256,
or −3.25 dB for 160; the latter's zero-velocity gain is 0.375 (−8.52 dB).
These describe that multiplier, not a guarantee about whole-patch loudness
when modulation also changes the spectrum.

A reproducible level calibration uses fs 48000, two seconds, `space stereo`,
`block 64`, `near 100`, no FX or other voices, and these declarations/events
with the selected renderer's engine header and `streams p`:

```text
patch s 0 65536 100 0 0 0 1 1 0 100
patch s 1 65536 0 0 0 0 1 1 0 100
voice 0 s
0 p 0 pos 0 1000 0
0 p 0 on 1000000 32767
```

For the current engine, the 0.1..1.9-second interval measures approximately
−13.01 dBFS sample peak and −16.02 dBFS RMS per channel, and −13.00 integrated
LUFS over the stereo pair with the supplied analysis meter. Moving to
`(1000,0,0)` gives silence left and about −10.00 dBFS peak right; moving to
`(0,2000,0)` gives about −19.03 dBFS peak per channel. This calibration is
not a loudness target for compositions; measure the actual mix and time span.

`route` permits 2..4 operators and a nonzero carrier bitmask 1..`(1<<OPS)-1` (bit 0 is operator 0). Zero edges is valid additive mixing. Each ordered pair occurs once; self-edges are refused because `FEEDBACK_Q10` controls self-feedback. Edge weights are Q8.8: 256 = unity. PM allows 1..1024; AM/ring 1..256; sync requires exactly 256. Omitted kind means PM.

Operators evaluate from the highest index down. A higher-index source affects a lower target this sample; a lower-index back edge uses delayed history (sync uses the delayed natural-wrap flag). PM uses the source's index; AM/ring do not. Source carrier level affects its direct output, not its outgoing modulation. Hard sync resets the target phase on the source's natural wrap and adds neither PM nor gain. Carrier summation has finite saturation headroom; a quieter final int16 mix cannot undo an earlier carrier-sum saturation.

For example, four additive corners need `route pad 4 15` and four operator rows. A two-operator amplitude-modulated carrier uses `route bell 2 1 1>0:192:am`; change `am` to `ring` for bipolar multiplication, or use `1>0:256:sync` for hard sync. Raising an operator that used to be a carrier into a PM source requires a nonzero `INDEX_Q10`.

Source: operator and route contracts (source checkout: `src/host/fm_a1.h`), `tl_header_route`, `tl_header_noise`, `tl_header` in harness (source checkout: `src/host/harness.c`).

### Envelopes, key scaling and feedback variants

```text
eg PATCH OP DELAY_MS DECAY2_MS SUSTAIN2_DB10
egloop PATCH OP
ks PATCH OP LO_SLOPE_DB10
kstype PATCH OP index|level|both -|+ -|+
fbtype PATCH OP classic|pre|square|presquare
amp PATCH ATTACK_MS DECAY_MS SUSTAIN_DB10 RELEASE_MS
peg PATCH L1 T1 L2 T2 L3 T3 L4 T4 [MASK]
fenv PATCH ATTACK_MS DECAY_MS SUSTAIN_PERMILLE RELEASE_MS DEPTH_CENTS TRACK_PERMILLE [REF_MILLIHZ]
```

- `eg`: delay and second-decay times 0..60000 ms, sustain2 0..1200 dB10. An active second decay must end at attenuation at least the first sustain's effective attenuation. Delay emits exact zero while oscillator/control clocks still advance. `egloop` repeats attack/decay/second-decay while held; it does not repeat the initial delay and stops looping after note-off.
- `ks`: left-side slope 0..1200 dB10/octave below the patch's break. `kstype` specifies target then **right sign, left sign**; `-` attenuates and `+` boosts. Default `index - -` normalizes away. These are linear-in-octave laws, not additional exponential-curve options.
- `fbtype`: `classic` uses the ordinary post-envelope feedback history; `pre` uses pre-envelope history; `square` squares the ordinary feedback source; `presquare` combines both. Default `classic` normalizes away.
- `amp`: an optional final voice envelope, separate from the operators. All four text fields accept 0..65535; sustain clamps at 1200. Omission bypasses it; an all-zero row still enables it. **Enabled non-IDLE amps keep the voice active through release .** Keep rendering while active even when carriers are silent. Retrigger retains the amp's current gain; this is not a fresh-voice reset or an audibility predicate. Existing end thresholds are unchanged.
- `peg`: levels −4800..4800 cents; each time 0..60000 ms. From silence it starts at **L4**, goes to L1, L2, L3, holds L3, and after off returns to L4. Times round to control ticks; zero can jump. Explicit mask is 1..15 and may only name present operators; omitted mask covers all. All-zero levels disable the envelope. Example downward drum sweep: `peg kick 0 45 0 0 0 0 2400 0 1` starts two octaves high and falls over 45 ms.
- `fenv`: times 0..60000 ms, sustain 0..1000 permille, depth −9600..9600 cents, key track 0..2000 permille, optional reference 1..4294967295 mHz (default 261626). Requires `filter`; depth and track both zero make it inactive. Tracking captures the note at on, not each subsequent pitch event.

A slow operator repeat can be authored with basic A/D/S/R = `100 250 180 200`, `eg pad 0 0 500 360`, and `egloop pad 0`. Add `ks pad 0 60` plus `kstype pad 0 both - +` only when that left-side boost and both-target scaling are intended.

Source: `tl_header_eg`, `tl_header_egloop`, `tl_header_ks`, `tl_header_kstype`, `tl_header_fbtype`, `tl_header_amp`, `tl_header_peg`, `tl_header_fenv` in harness (source checkout: `src/host/harness.c`); engine public contracts (source checkout: `src/host/fm_a1.h`).

### Filter, shaper, PD, formants, vector, wavetable and plucked strings

| Statement | Units, constraints and default |
|---|---|
| `filter PATCH lp\|bp\|hp\|notch CUTOFF_MILLIHZ Q_MILLI [x2]` | Text cutoff 0..4294967295, Q 0..65535; effective cutoff `fs/2400`..`0.45*fs` Hz and Q 500..16000. Omit row to bypass. `x2` cascades two identical stages; absent is one. Note-on restores patch cutoff/Q; runtime filter events last until the next on. |
| `shape PATCH DRIVE_DB10 hard\|cubic\|fold\|asym [pre]` | Positive drive 0..240 dB10. Zero drive still applies the selected curve; omission alone bypasses. Default after the formant/filter path; `pre` before it. |
| `pd PATCH OP KNEE_Q15` | 1..32767; 16384 is exact identity. Requires sine WAVE 0, and excludes WT/KS on that operator. |
| `formant PATCH SLOT CENTER_MILLIHZ Q_MILLI LEVEL_DB10` | SLOT 0..2, center 1..4294967295 with native cutoff clamp, Q 500..16000, attenuation 0..1200. Up to three parallel BP formants before the final voice filter. |
| `vector PATCH X_Q15 Y_Q15` | Each 0..32768. Requires `route PATCH 4 15`; bilinear blend of four post-amplitude/output corners, not a fifth oscillator. X blends corners 0/1 and 2/3, then Y blends those rows. |
| `ksource PATCH OP LOSS_Q15 SEED BUFFER_SAMPLES` | Loss 0..32767, seed 0..4294967295, power-of-two buffer 64..8192. Requires sine WAVE 0 and no PD, WT, feedback or incoming route edges. Fixed-path carrier KS also requires operator 1 INDEX=0. A KS source cannot drive sync. |

Karplus–Strong source memory belongs to each voice/operator and is bound by the renderer; larger buffers permit lower pitches. Its source is not an arbitrary PCM sample player. For a pluck, use the base two-op tone with modulator index zero, then `ksource tone 0 32600 7 2048`; the operator's envelope still shapes it.

`LOSS_Q15/32768` is retained loop gain, so a larger value generally extends
the pluck. Every note-on refills the bound buffer with xorshift noise. A start
from silence seeds the PRNG using the patch seed xor the operator salt;
retriggering a sounding voice continues its PRNG state and refills the buffer.
`pitch` retunes its delay without refilling. FREE does not preserve a KS buffer
across note-ons. Preserve the preceding performance when comparing retriggers.

A vowel-like patch can add:

```text
formant tone 0 700000 3000 60
formant tone 1 1200000 5000 120
formant tone 2 2500000 6000 180
filter tone lp 6000000 707 x2
shape tone 60 asym pre
mod tone 0 ctl0 formant_center1 500000 3
```

The control moves the second formant by up to ±500 Hz. Alternatively, on a sine patch without WT/KS, `pd tone 0 8192` plus `mod tone 0 ctl0 pd_knee0 12000 3` creates a moving PD timbre. These are alternative fragments if their mod slot numbers collide.

Wavetables and additive banks use:

```text
wtbank BANK FRAMES LENGTH 12
harmonic BANK FRAME NUMBER LEVEL_DB10 PHASE_U16
wtdata BANK BAND FRAME START SAMPLE [SAMPLE ...]
wthash BANK HEX
wtuse PATCH OP BANK POSITION_Q15
```

At most 8 banks; FRAMES 1..8; LENGTH a power of two 32..2048; exactly 12 mip bands. A bank uses **either** harmonic rows or complete raw data, never both. Define `wtbank` before its data/hash rows. `wtuse` can precede the bank but must resolve by validation, on sine WAVE 0 without PD/KS. Position is 0..32768 over all frames.

Harmonic NUMBER is 1..1024, level is attenuation 0..1200 dB10, phase 0..65535; each `(FRAME, NUMBER)` occurs once. The host deterministically expands bands. `wthash` is optional for harmonic input and checked if present. Raw `wtdata` has 1..16 samples per row, each −32768..32767; BAND 0..11, valid FRAME/START, no missing/duplicate sample, and a required matching `wthash`. The canonical output includes the verified content hash.

A small two-frame bank and moving binding:

```text
wtbank morph 2 256 12
harmonic morph 0 1 60 0
harmonic morph 1 1 60 0
harmonic morph 1 3 120 0
harmonic morph 1 5 180 0
wtuse tone 0 morph 0
mod tone 0 ctl0 wt_pos0 32768 3
```

Send positive `ctl0` from zero to 32768 to reach the second frame. The host's band-limited saw/square/pulse/triangle/form helpers expand to this native bank representation; there is no native `wtframe` or arbitrary formula statement. Source: `tl_header_wt`, `tl_check_wt`, `tl_check_header` in harness (source checkout: `src/host/harness.c`); asset contracts (source checkout: `src/host/fm_a1.h`).

### LFO and eight-slot modulation matrix

```text
lfo PATCH WAVE RATE_MILLIHZ DELAY_MS FADE_MS PITCH_CENTS LEVEL_DB10 INDEX_Q10 [PHASE_U16 MASK_PITCH MASK_LEVEL MASK_INDEX [FREE]]
mod PATCH SLOT SOURCE TARGET AMOUNT [SHIFT]
```

One LFO per voice. Waves: 0 sine, 1 triangle, 2 saw up, 3 saw down, 4 square, 5 sample-and-hold, 6 smoothed random. Rate 10..50000 mHz; delay/fade 0..60000 ms; pitch depth 0..1200 cents; level attenuation depth 0..1200 dB10; index depth 0..65535 Q10. Optional phase 0..65535 and all three masks must be supplied together; omitted masks cover all present operators, explicit zero masks select none. Masks may not name absent operators. Optional LFO FREE is **0 or 2**, never 1; FREE2 runs phase/grid in idle while delay/fade restart on each on. Omit the LFO row to disable it.

`lfo`, `peg`, `fenv`, `mod` and `ctl` require this timeline build's `FM_CTL=64`. LFO rate must also satisfy the strict control Nyquist inequality `RATE_MILLIHZ * FM_CTL < 500 * fs`; the 50000 mHz ceiling remains in force.

Matrix SLOT is 0..7, at most one row each. Sources are `lfo`, `peg`, `fenv`, `eg0`..`eg3`, `vel`, `note`, `ctl0`..`ctl7`, or `gen.ID.x` / `gen.ID.y`. The generator form requires a declared source; `.y` requires Hénon. Every source uses the engine's normalized Q15 control value; AMOUNT is the target offset at source +32768, with negative amounts reversing direction. `SHIFT` is 0..15, default 3; 0 applies without smoothing. Smoothing begins at zero on a start from silence and persists through retriggers. LFO is bipolar (with its delay/fade); PEG normalizes ±4800 cents to ±32768; FENV and EG gain are 0..32768; velocity is captured and normalized to 0..32768. `note` is the note-on pitch relative to A4, ±9600 cents mapped to ±32768 with a clamp. Ctl and generator caches supply their signed Q15 values.

| Target spelling | AMOUNT range / units | Prerequisite |
|---|---|---|
| `pitchN` | ±4800 cents | Present operator; fixed operators do not bend |
| `levelN` | ±1200 attenuation dB10 | Carrier operator |
| `indexN` | ±65535 Q10 | Operator with an outgoing PM edge (fixed pair: modulator 1) |
| `cutoff` | ±9600 cents | Voice filter |
| `q` | ±15500 Q-milli | Voice filter |
| `lfo_rate` | ±49990 mHz | LFO |
| `lfo_pitch` | ±1200 cents | LFO |
| `lfo_level` | ±1200 dB10 | LFO |
| `lfo_index` | ±65535 Q10 | LFO |
| `wt_posN` | ±32768 Q15 | WT on operator N |
| `pd_kneeN` | ±32767 Q15 | PD on operator N |
| `vector_x`, `vector_y` | ±32768 Q15 | Vector |
| `formant_centerN` | ±2147483647 mHz | Enabled formant N, N=0..2 |
| `formant_gainN` | ±1200 attenuation dB10 | Enabled formant N, N=0..2 |

Other N suffixes mean present operators 0..3. Feature prerequisites are checked even for AMOUNT=0. `peg` source needs nonzero levels; `fenv` source needs an enabled filter envelope/tracking; LFO source needs an LFO. Target sums are applied with the target's native clamp. LFO-target changes take effect on the next tick. All active rate slots together must pass the conservative bound `min(50000, base_rate + sum(abs(amount))) * FM_CTL < 500*fs`.

A controlled low-pass opening:

```text
filter tone lp 800000 1200
mod tone 0 ctl0 cutoff 2400 3
0 lead 0 ctl 0 0
0 lead 0 on 220000 32767
300000000 lead 0 ctl 0 32768
```

A four-corner motion uses `vector pad 16384 16384`, `mod pad 0 ctl0 vector_x 16384 3`, `mod pad 1 ctl1 vector_y 16384 3`; signed controls then cover both axes. Source: compact `TL_MOD_SOURCE`, `TL_MOD_TARGET`, `TL_MOD_LIMIT`, `tl_check_mod` tables in harness (source checkout: `src/host/harness.c`).

### Seeded generator bank and note lanes

The bank is a control/sequencing system, separate from audio oscillators. Its descriptor table is src/gen/params.def (source checkout: `src/gen/params.def`), also emitted by `harness --gen-params`. There are at most 16 sources (IDs 0..15), 8 lanes (IDs 0..7) and 2 text-word sources; expanded words have capacity 16384 symbols.

```text
gen_clock CTL
gen ID KIND SEED DIV SLEW KIND_FIELDS...
gen_axiom ID DEPTH WORD
gen_rule ID SYMBOL WORD_OR_DASH
gen_lane ID VOICE GATE_SOURCE PITCH_SOURCE ACCENT_SOURCE STEP_TICKS BASE_CENTS SPAN_CENTS VELOCITY GATE_TICKS SCALE_MASK
T_NS STREAM gen ID PARAM VALUE
T_NS STREAM lane ID enable 0|1
```

`gen_clock` accepts 1..4096 but must equal the executable's `FM_CTL` (normally 64). It is mandatory for any generator declaration/binding. SEED is 0..4294967295; DIV 1..65535 ticks; SLEW 0..512 Q15 units/tick (0 bypasses slew). Text `gen` requires all kind fields; defaults below describe the authoring API/default configuration, not optional positional text tokens. Sources start enabled. Common runtime PARAM names are `enabled`, `slew`, `reset` (the new seed); DIV, kind and structural dimensions are immutable.

| KIND | Required KIND_FIELDS in order; bounds; defaults | Additional runtime fields |
|---|---|---|
| `white`, `pink` | None | None |
| `brown` | STEP 1..4096, default 16 | `step` |
| `multi` | P 2..65536 (256), K 2..16 (2), OCTAVES 1..8 (6), GAIN_Q15 0..32768 (24576); `P*K^(OCTAVES-1)` must fit uint32 | `gain` |
| `logistic` | R_Q48 0..1125899906842624, default 1123085157075517 | `r` |
| `henon` | A_Q48 0..562949953421312 (394064967394918), B_Q48 −281474976710656..281474976710656 (84442493013197) | `a`, `b` |
| `euclid` | K 0..N (3), N 1..65535 (8), ROT 0..N−1 (0), PARENT `-` or an existing lower source ID | `k`, `n`, `rot` |
| `thue`, `cantor` | LENGTH 1..65535 (256), ROT 0..LENGTH−1 (0) | `length`, `rot` |
| `fibonacci` | DEPTH 0..16 (12), ROT 0..expanded-length−1 (0), at most 16383 | `rot` |
| `lsystem` | ROT 0..expanded-length−1 (0), at most 16383; requires its text definition | `rot` |

Only Euclidean children can have a parent. `gen_axiom` depth 0..16, word 1..32 symbols A–H. `gen_rule` symbol A–H, replacement 0..32 symbols; `-` means empty. Missing rule preserves the symbol. Capacity, duplicate IDs/rules, undefined dependencies and coupled bounds are refused. Runtime coupled changes are validated by the bank, not merely against independent table minima/maxima. Source changes/reset queue until that source's next DIV tick, so order coupled edits to keep the complete pending configuration valid. Disable freezes recurrence and targets zero while slew continues; reset preserves the published slew value and session grid. Lane enable/disable applies at the next bank tick.

Lane source references are `-` or a declared source ID. Lane VOICE must exist and cannot be reserved by another lane. STEP/GATE_TICKS are 1..65535 and GATE_TICKS must not exceed STEP_TICKS; BASE_CENTS −4800..14400 is **absolute MIDI cents** (6900 = A4), SPAN_CENTS 0..9600; velocity 1..32767; SCALE_MASK 0..4095, bit 0 = C, zero disables quantization. The reachable pitch range must remain within −4800..14400 cents: validate `BASE−SPAN−1199` when scaling is enabled (otherwise `BASE−SPAN`) and `BASE+SPAN`. Scale quantization snaps downward. Out-of-range configurations are refused rather than silently clipped. A reserved voice refuses manual `on`, `off` and `pitch`, but can receive appropriate control/spatial/send events.

At a bank boundary: explicit timeline events run first, then the bank ticks, publishes caches, and emits generated offs/ons. Therefore an explicit on at frame zero sees the initial zero generator cache; a generated lane on sees that tick's new cache. Do not flatten a bank into guessed note events when exact cache timing matters. `--gen-events` exposes the actual deterministic schedule; generated event timestamps use checked ceil conversion and refuse a frame with no exact nanosecond representation.

A reproducible sparse note lane, assuming voice 0 and stream `lead` already exist:

```text
gen_clock 64
gen 0 euclid 7 1 0 3 8 0 -
gen 1 brown 9 1 16 16
gen_lane 0 0 0 1 - 188 6000 1200 24000 120 2741
mod tone 0 gen.1.x cutoff 1200 3
1000000000 lead gen 1 step 32
1500000000 lead lane 0 enable 0
```

This also requires `filter tone ...` for the shown target; omit manual note events on voice 0. The scale mask 2741 selects C-major pitch classes. Sources: `tl_header_gen`, `tl_check_gen`, `tl_event_gen` in harness (source checkout: `src/host/harness.c`), [generator contract](instrument.txt#session-generators-and-live-lanes), descriptor table (source checkout: `src/gen/params.def`).

### All ordinary event forms

```text
T_NS STREAM VOICE on FREQ_MILLIHZ VELOCITY_Q15
T_NS STREAM VOICE off
T_NS STREAM VOICE pitch FREQ_MILLIHZ
T_NS STREAM VOICE filter CUTOFF_MILLIHZ Q_MILLI
T_NS STREAM VOICE ctl N VALUE_Q15
T_NS STREAM VOICE send chorus|delay|reverb|duck|flanger LEVEL_Q15
T_NS STREAM VOICE crush BITS RATE_DIV
T_NS STREAM VOICE pos X_MM Y_MM Z_MM
T_NS STREAM VOICE move X_MM Y_MM Z_MM DUR_NS
T_NS STREAM 0 yaw MDEG
```

On/pitch frequency accepts 0..4294967295 mHz; on velocity text 0..65535, effective clamp 32767. Pitch changes relative oscillator frequency without restarting phase/envelopes. Filter event uses the same accepted/effective bounds as its header and requires a filter. Ctl N 0..7, value −32768..32768, latched per voice. Send level 0..32768 requires the bus's FX header. Crush requires the valueless `crush` header, BITS 1..24 and RATE_DIV 1..64; it is a per-voice insert before dry positioning and sends. Spatial events require draft2; their ranges follow below. There are no runtime patch-replacement, route-edit or arbitrary native parameter-name events: host helpers lower supported automation to these events or declare another patch/voice.

Session generator events use `T_NS STREAM gen ID PARAM VALUE` and
`T_NS STREAM lane ID enable VALUE`: `gen`/`lane` replace the voice token.
Their accepted fields and lifecycle are in `Session generators and live lanes`.
For ordinary controller events write `ctl 0 VALUE`, not `ctl0 VALUE`;
`ctl0` belongs in a modulation-source declaration. The native parameter
reference lists each exact event statement, including its word position.

### Effects, sends and decodable profile

These singleton session headers are opt-in; omission disables a stage. Mono (`space off`/draft1) and ordinary stereo accept the current chain at fs 8000..192000. FX also admits binaural and raw amb1/amb3 routes, subject to their own rate/table bounds. Binaural accepts the current master chain; raw amb1/amb3 accepts gain/DC plus source crusher and audible buses, and refuses compressor/duck, limiter, softclip and dither. PANLAW still refuses all FX.

| Exact header form | Bounds, in positional order |
|---|---|
| `dcblock FC_MILLIHZ` | 1..100000 |
| `chorus BASE_US DEPTH_US RATE_MILLIHZ` | 7000..25000; 1000..5000; 100..3000 |
| `flanger BASE_US DEPTH_US RATE_MILLIHZ FEEDBACK_Q15 INVERT` | 100..10000; 100..BASE_US; 0..2000; 0..29491; 0 or 1 |
| `delay TIME_US FEEDBACK_Q15 LOWPASS_HZ` | 50000..1000000; 0..29491; 20..20000 |
| `pingpong TIME_US FEEDBACK_Q15 LOWPASS_HZ HIGHPASS_HZ` | Same first three; HP 0..2000 (0 disables HP); ordinary stereo or field routes; mutually exclusive with delay |
| `reverb ROOM_PERMILLE DAMP_PERMILLE` | Each 0..1000 |
| `compressor THRESHOLD_DB10 RATIO_TENTHS ATTACK_MS RELEASE_MS MAKEUP_DB10` | 0..600 attenuation; 10..200 (40 = 4:1); 0..100; 1..5000; 0..240 positive makeup |
| `limiter THRESHOLD_DB10 RELEASE_MS` | 0..200 attenuation; 1..5000 |
| `softclip` | No values; cubic soft clipping, not an oversampling option |
| `gain GAIN_DB10` | Signed −600..240; positive boosts, negative attenuates |
| `dither SEED` | 1..4294967295; deterministic TPDF |
| `crush` | No values; enables per-voice mask/hold inserts, initially exact 24/1 bypass; runtime `crush BITS RATE_DIV` selects each voice's settings |
| `decodable` | No values; reader admission profile, not an FX stage |

Four audible buses are chorus, delay, reverb, flanger. Duck is a compressor detector with **no audible return**. Ping-pong uses `send delay`, not `send pingpong`. All sends start at zero: declaring a bus alone leaves every voice dry. Events at frame zero set initial levels without a fade; later changes apply from the next block boundary and ramp across that block. Sends are taken before pan; dry source position does not move the fixed wet return image. Flanger rate 0 is a static comb; a positive rate moves its two taps. Feedback remains causal with at least one sample of delay.

Returns join dry audio, followed by master gain → DC blocker → compressor → limiter → softclip/plain rounding with optional dither. Compressor and limiter share one block of lookahead rather than adding two blocks. Makeup applies below threshold too. Neither compression nor a quiet master result proves that no earlier stage saturated.

The limiter bounds sample magnitude at its own output using interpolated safe
gain, rather than hard clipping each sample. `limiter 18 100` means a nominal
−1.8 dBFS threshold and 100 ms release. The fixed-point threshold and final PCM
rounding can differ slightly from the decimal threshold; softclip and dither
follow it. This is not a final true-peak ceiling: intersample reconstruction
can exceed sample peak, and the downstream softclip has small-signal gain.

Canonical header order is serialization order, not processing order. Reordering
headers does not rearrange that chain. Optional dither follows softclip, before
final rounding and saturation.

Without a selected duck send, the compressor detects the largest absolute
signal across channels after returns, gain and DC blocking, before makeup.
A nonzero previous or new duck-send target selects the pre-pan duck sum for
the whole block, replacing program detection. A silent sender still selects
duck; silence does not switch detection back to the mix. The detector takes
the absolute signed sum, so opposing senders can cancel. One shared gain
controls both stereo channels.

Master softclip implements the clamped cubic `1.5x - 0.5x³`: input is limited
to ±1, with output endpoints scaled to ±32767 PCM units using integer products
and final rounding. Its small-signal gain is approximately +3.52 dB, rather
than unity. Since it follows the limiter, it can raise output above the
limiter's selected threshold. The FX `clipped` counter counts final rounded
values exceeding the int16 range; it does not count softclip flattening,
earlier saturation or samples merely equal to an output rail.

| Audible bus | Ordinary-stereo return routing |
|---|---|
| Chorus | Shared mono delay line; right modulation phase is 90° ahead of left. |
| Flanger | Shared mono line with the same 90° phase offset. Only the left tap feeds feedback; `INVERT` negates feedback, not the emitted wet signal. |
| Delay | The same delayed return is added to both channels. |
| Reverb | The same mono input feeds separate left/right networks with different line lengths. |
| Ping-pong | Left tap at T, right at 2T; far-tap feedback recirculates through the filtering loop. |

Mono uses one return channel; ping-pong requires ordinary stereo or a field route. Sustained input and
feedback tails can overlap, so ping-pong need not have exclusively alternating
channel activity. These describe routing, not perceived width or location.

Field FX uses eight dedicated virtual return sources: left/right for chorus,
flanger, delay (plain or ping-pong) and reverb. They stay at world azimuths −30°
and +30°, radius 1 m; voice motion changes the dry source, while listener yaw
rotates dry and wet together. Each return has separate pinna history. Sends
are captured after source crusher and before the sender's pinna. No voice IDs
are consumed by returns. Raw fields process only gain/DC after encoding;
binaural processes its master on wide decoded ears before one final rounding.
These are routing facts, not a perceptual localization guarantee. Custom
binaural tables with FX require `sum(abs(taps)) <= 2^(table_shift+6)-1`,
as checked by `sp_field_attach_fx` in the field API (source checkout: `src/space/field.h`).

For a dry/wet stereo pluck with ducking:

```text
timeline draft2
space stereo
block 64
near 100
pingpong 187500 16000 5000 80
flanger 2000 1000 300 18000 0
compressor 120 40 5 120 0
gain -60
0 lead 0 send delay 8192
0 lead 0 send flanger 4096
0 drums 1 send duck 32768
```

Define `drums` in streams and voice 1 as the kick; retain the regular note events. This shows the header/send pairing, not a whole session. Leave tail time after the last note.

`decodable` refuses limiter, softclip, compressor, chorus, crush even at 24/1, nonzero-rate flanger, **every shape including zero drive**, field routes, every move, and repeated or nonzero-time pos for any voice. At most one pos per voice at exactly 0 ns is allowed; ordinary fixed stereo placement is accepted. Static flanger, delay/ping-pong, reverb, DC, gain and dither are not rejected by this current profile. Admission does **not** prove absence of clipping, invertibility, message recovery or transcription accuracy.

Sources: `tl_header_fx` and `tl_check_decodable` in harness (source checkout: `src/host/harness.c`), FX public configuration (source checkout: `src/fx/fx.h`), FX implementation (source checkout: `src/fx/fx.c`), [FX SPEC](instrument.txt#effects-sends-and-decodable-profile).

### Spatial rendering

```text
timeline draft2
space off|stereo|amb1|amb3|binaural
block 32|64|128
near RADIUS_MM
order 1|3
pinna off|pbnh|rd
pinna D0 D1 D2 D3 D4
yaw MDEG
panlaw WIDTH_Q15
```

`space` defaults off; block defaults 64 and near defaults 100 mm (accepted 1..16777216). `stereo` is the ordinary two-channel distance/pan route; its panning does not add an inter-ear delay. `amb1` and `amb3` produce 4 and 16 AmbiX ACN/SN3D channels. Binaural produces two channels; `order` is legal only there and defaults 3. It needs the compiled decoder table and its 44100/48000 sample rates. The standard Makefile generates the table; an alternative build without it refuses binaural.

For ordinary `stereo` without `panlaw`, the settled dry voice gains approximate:

```text
r = sqrt(x*x + y*y + z*z)              # millimetres
u = x / max(r, near)
g = 1000 / max(r, 1000)
left_gain = g * sqrt((1-u)/2)
right_gain = g * sqrt((1+u)/2)
```

The implementation uses integer square roots, division and Q15 gains. `near`
only limits the pan denominator; distance gain stays unity through 1 m and
falls by about 6.02 dB per radius doubling beyond it. Center gives about
0.707 per channel; `(1000,0,0)` is fully right. `(450,880,0)` has `u≈0.456`,
so its pan is much less extreme. Changing y or z changes both radius and the
ratio of x to radius. Gains ramp per sample between spatial block boundaries.
These formulas are not binaural, AmbiX or PANLAW formulas. Sends are pre-pan;
their return images are listed in the FX table and do not follow voice motion.
Only plain delay has the same mono return in both ordinary-stereo channels.
Actual mix width also depends on voice content, timing and effect history;
coordinates or one source's gains alone do not establish it.

`pinna` and `yaw` headers require amb1/amb3/binaural, not ordinary stereo. Pinna defaults off; custom five D values are each 0..1000. Non-off pinna requires fs<=48000. Yaw defaults 0, range −360000..360000 millidegrees; runtime listener yaw uses voice 0 only. `panlaw` is an alternative stereo field path, width 1..32768 Q15, which also excludes FX.

Binaural and raw amb1/amb3 admit the fixed-return FX described above.
Raw fields admit gain/DC and source crusher but refuse nonlinear masters
and dither; PANLAW rejects every FX header.
Set source levels before rendering and inspect peak/clipping for each route;
the same patch can have different output levels across routes. No automatic
headroom threshold or per-voice localization verdict is supplied.

Coordinate axes are x right, y forward, z up, in millimetres. Each coordinate is −16777216..16777216; initial position is `(0,1000,0)`. Position/move updates follow the spatial block grid. Move starts from the position at its application boundary and reaches the destination at the first boundary at or after `T_NS+DUR_NS`; a move may extend beyond the record and be cut there. Duration is positive and checked so its endpoint remains below 2^32 samples.

For a binaural orbit fragment (no FX headers):

```text
space binaural
order 3
pinna pbnh
yaw 0
0 lead 0 pos -1500 1500 500
500000000 lead 0 move 1500 1500 500 1000000000
1000000000 lead 0 yaw 15000
```

`harness --play --stems WAV ...` can feed an external 16-bit PCM stem per voice through amb1/amb3/binaural/panlaw at the session rate. Short stems are zero-padded and long stems truncated. This is a host spatial test/input facility, not a PCM oscillator in the synth.

Sources: `tl_header_field`, `tl_check_field`, `tl_event_field`, `tl_load_stems` in harness (source checkout: `src/host/harness.c`), space API (source checkout: `src/space/space.h`), field API (source checkout: `src/space/field.h`).

### Discovery, validation and limits of this surface

Existing native commands, using the setup variables above. Substitute the
actual input files in your external working directory:

```sh
"$HARNESS" --params
"$HARNESS" --params-check
"$HARNESS" --gen-params
mkdir -p "$WORK/engine-examples"
"$HARNESS" --emit "$WORK/engine-examples"
"$HARNESS" --play --metrics --wav "$WORK/out.wav" --merged "$WORK/replay.tl" \
  -- "$WORK/session.tl" "$WORK/lead.tl" "$WORK/drums.tl"
"$HARNESS" --play --chunk random -- "$WORK/replay.tl"
"$HARNESS" --gen-events -- "$WORK/session.tl" "$WORK/lead.tl"
"$HARNESS" --fxref -- "$WORK/session.tl" "$WORK/lead.tl"
```

`--emit` emits the engine's fixed test examples; it is not a complete patch-parameter catalog. `--gen-params` is the actual 11-kind/37-field generator descriptor export. `--params` exposes 68 statements/events and 287 fields from the native `src/host/params.def`, with 22 selector forms and a reference to the generator table. Each row supplies physical token positions, native field names, scalar bounds, units, divisor scales, effective clamps and named coupled checks. Human values are raw divided by scale. Nonnumeric bounds are `none`; a scalar bound alone does not validate coupled settings. `--params-check` exercises actual canonical writer coverage. Numeric refusals identify the statement/patch/operator or event context and field; other native refusals retain their text. The stateless MCP adapter serves this same native listing. The compact sources for maintaining this reference are the native parameter inventories, `fm_a1.h` and the complete header/event validators. The sections [Patches, recipes and the synthesis repertoire](instrument.txt#patches-recipes-and-the-synthesis-repertoire), [Shared CLI and MCP](instrument.txt#shared-cli-and-mcp) and [Inspect, revise and hand off](instrument.txt#inspect-revise-and-hand-off) document the host conveniences lowered to this repertoire; they are not extra native statement families.

The served `reference/params.txt` contains whitespace-separated `key=value`
metadata rows, not TL declarations. Decode its row kinds as follows:

| Row | Fields and interpretation |
|---|---|
| `PARAMS` | Opening version/engine identity; closing count/statements/forms summary. |
| `STATEMENT`, `EVENT` | `id name section once min_values max_values word_position`. Counts exclude the keyword and event prefix; −1 means variable maximum. They are outer bounds, not permission for every intervening arity. |
| `PARAM` | `id statement name position type lo hi unit human scale clamp default mutable depends checker choices form`. `statement` joins the statement ID; numeric human value is raw/scale. `lo`/`hi` are accepted outer bounds, distinct from effective clamps and coupled checks. |
| `FORM` | `statement id position match values checker` selects a token layout. Match kinds are `exact`, `prefix`, `count`, `default_or_exact`; values are pipe-separated. `count` uses full-line token count. |
| `FAMILY` | `id path checker` links the separate generator inventory instead of duplicating it. |

`position` counts zero-based tokens in the full TL line: header keyword at 0,
ordinary event keyword at 3, gen/lane keyword at 2. `N+` repeats from N;
`N+.PART` selects a component of a packed route edge; `N.KEY` a key=value
component. `form=all` is unconditional. A named form must match uniquely;
prefix selectors describe canonical stems, not acceptance of arbitrary suffixes.
`default=token:...` applies to an omitted optional token, `statement:...` to
an omitted declaration, and `initial:...` to initial runtime state. These do
not permit skipping operands in a declaration you do write. `required`,
`context` and `external` retain their named meaning. `mutable=1` identifies an
existing timed event; 0 does not describe every live API or modulation path.
The native reader remains the authority for valid names, arities and combinations.

Canonical TL is a semantic serialization, not a text-preserving editor. It
removes authored comments/spacing, orders headers, emits normalized/default
fields and sorts scheduled events by their defined order. Keep the editable
score/source separately. Use native validation or the native descriptor when
editing fields; do not assume a regular expression for an authored row still
matches its canonical form. `listen` can render a hashless draft and return
canonical text containing its computed audio hash; that alone is not an
independent replay check. Verify that returned canonical record separately.

A new record can omit hash, render and canonicalize, then replay the merged record with its asserted hash. Check the command exit status **and** reported hash/chunk/clipping results. Native exit codes are 0 success, 1 bad timeline/block dependence/format limit, 2 CLI or unsupported mode, 3 recorded-hash mismatch, 4 failed reference/gate criterion, and 5 host I/O or allocation failure. A successful PLAY line followed by a failed requested write still exits 5; fix the host/path instead of modifying valid musical input. `--play --ref` is not universal: it refuses unsupported stereo/no-FX-field/generator-without-FX comparisons. Field FX runs an independent extra native/model comparison, with `FIELD_FXREF` reporting completed work; any native field clipping conservatively refuses reference certification with status 2. Completed PLAY output remains available. Valid clipped native playback is still supported. Use the mode's actual acceptance scope rather than interpreting a missing reference comparison as success.

Implemented repertoire includes FM/PM, additive routing/banks, AM/ring/sync, the twelve waves/noises, envelopes/loops/key scaling, PD, formants, vector, wavetable and KS, modulation matrix controls/generator binding, the FX table including per-voice crusher, and all spatial routes above. Drum recipes are synthesized from these sources; they are not sample playback. Do not advertise six-operator chip emulation, arbitrary PCM oscillators, a second LFO, matrix feedback/curve/via targets, EQ or hall as current features. Crusher works in mono, ordinary stereo and field routes before placement and sends. EQ and hall remain unimplemented. Field-route FX uses the fixed returns and master restrictions described above. The final voice amp envelope is implemented; future amp-dependent features need their own acceptance. Acoustic message encoding experiments exist elsewhere, but the WAV decoder/channel-recovery acceptance remains separate. Replay, recoverable messages and approximate transcription are different claims.
