animader-cli 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,519 @@
1
+ ; tempura timeline schema — the `(timeline …)` vocabulary (P99, plan 02).
2
+ ;
3
+ ; The eight global heads (`timeline`, `anchor`, `tempo-point`,
4
+ ; `meter-point`, `section`, `cue`, `lane`, `phrase`) and the three
5
+ ; slot-locals under `(lane …)` (`note`, `keyframe`, `clip`). This is the
6
+ ; only ORIGINAL vocabulary in tempura's schema directory: `midi.sjon` and
7
+ ; `it.sjon` host the sibling sets' file vocabularies under their own
8
+ ; namespaces, and `pacer.sjon` is a verbatim copy of pacer's score
9
+ ; manifest — which is what lets a keyframe's `:ease` be typed by pacer's
10
+ ; own `pacer/ease-spec` and never drift from it (a cross-plugin kind
11
+ ; reference, `SJON/docs/LANGUAGE.md` §6.7).
12
+ ;
13
+ ; The four share no head (plan 02, "Collisions, checked"), so one
14
+ ; `sjon-project.sjon` composes them and every bare head resolves.
15
+ ;
16
+ ; Embedded through the `tempura_schema` build import and PRELOADED once
17
+ ; per host by `src/Schema.zig`, which hands the bundle to every
18
+ ; `validateDocument` through `HostOptions.preloaded`. So a timeline
19
+ ; document is validated with no filesystem (wasm32-freestanding included)
20
+ ; and every diagnostic span is a document coordinate by construction.
21
+ ;
22
+ ; What is HERE and what is a HOST check: this manifest says everything one
23
+ ; form can say about itself — types, ranges, units, required keys, which
24
+ ; keys a `:kind` admits, how many of a set may be present. Every rule that
25
+ ; is a relation BETWEEN forms stays in tempura's own diagnostics with its
26
+ ; own span: `timeline_duplicate`, `tempo_map_invalid`, `meter_map_invalid`,
27
+ ; `meter_off_bar`, `conductor_conflict`, `passthrough_conducts`,
28
+ ; `anchor_missing`, `anchor_dump_duplicate`, `anchor_conflict`,
29
+ ; `anchor_mismatch`, `address_invalid`, `bound_kind_invalid`,
30
+ ; `bound_lane_has_content`, `note_overlap`, `clip_lane_missing`,
31
+ ; `phrase_lane_bound`, `clip_nested`, `scene_duplicate`,
32
+ ; `position_negative`. A schema counts and types; it does not know about
33
+ ; document order, about which root follows which, or about the file an
34
+ ; anchor names. Each of those codes is named in the description of the
35
+ ; form whose rule it is, so the generated page says where a rule lives.
36
+ ;
37
+ ; Positions are plan 03's: a number with a REQUIRED unit, so a position
38
+ ; reads as music (`16bar`, `2.5q`, `40960t`) and a bare number is a
39
+ ; validation error with a span rather than a silently guessed unit
40
+ ; (pacer's `time-pos` spelling, `schema/pacer.sjon`).
41
+ ;
42
+ ; No `:version` key, for pacer's reason: it exists to be pinned by a
43
+ ; `(use-plugin …)` a timeline document never writes — the schema is
44
+ ; preloaded, not resolved by name — and tempura's version lives in
45
+ ; `build.zig.zon` and `src/root.zig`, kept in lockstep by test.
46
+
47
+ (plugin :name tempura
48
+ :description "The timeline tier: one SJON document holding a piece's arrangement in musical time — its tempo and meter, its sections and cues, and the lanes that carry notes, curves, patterns and formulas, either natively or bound to a `.mid` / `.it` anchor."
49
+
50
+ ; =====================================================================
51
+ ; Positions and durations (plan 03, "Positions")
52
+ ; =====================================================================
53
+
54
+ (value-kind :name position
55
+ :description "A position or duration on the tick grid: a number carrying a REQUIRED unit — q (quarter notes), t (tempura ticks, TPQ = 46126080 per quarter), bar and b (bars and beats, counted from 0 through the meter map), s (seconds, through the tempo map), or f (frames, through the document's declared :fps rate and the tempo map). A bare number is unit_required, never a guess. A duration (:dur, :length, :offset) is measured from its own form's :at, so an s or f duration resolves at that anchor. Negative positions are a tempura position_negative diagnostic, not a bound here."
56
+ :underlying number
57
+ :unit (unit-shape :required true :allowed [q t bar b s f]))
58
+
59
+ (value-kind :name grid-position
60
+ :description "A position on the tempo and meter maps themselves: q, t, bar or b, never s. Seconds are derived FROM these maps, so a seconds position on the form that defines them is circular — pacer refuses it on (tempo :at …) for the same reason. Never f either — frames are counted through the tempo map, which these forms define."
61
+ :underlying number
62
+ :unit (unit-shape :required true :allowed [q t bar b]))
63
+
64
+ ; =====================================================================
65
+ ; The timeline header
66
+ ; =====================================================================
67
+
68
+ (value-kind :name timeline-end
69
+ :description "What the playhead does past :length. Spelled and meant exactly as pacer's end-behavior, which is what the exported transport carries."
70
+ :underlying symbol
71
+ :members (member-set
72
+ (member :name loop :description "Wrap the playhead back to 0; seconds wrap first, then convert.")
73
+ (member :name hold :description "Clamp at :length; every lane holds its final value.")))
74
+
75
+ ; =====================================================================
76
+ ; Anchors — the files a document is arranged around
77
+ ; =====================================================================
78
+
79
+ (value-kind :name anchor-id
80
+ :description "An anchor's identifier, and the cross-ref target a :conductor or a bound lane's :from names. Unique per document."
81
+ :underlying symbol)
82
+
83
+ (value-kind :name anchor-ref
84
+ :description "Names an (anchor :id …) declared in this document. A name no anchor declares is not_cross_ref, naming the form it had to be declared by."
85
+ :underlying symbol
86
+ :cross-ref (cross-ref :target anchor :name-key id))
87
+
88
+ (value-kind :name anchor-kind
89
+ :description "Which file format an anchor points at. The kind decides which address keys a bound lane may carry — checked host-side as address_invalid, since the schema sees the lane and the anchor one at a time."
90
+ :underlying symbol
91
+ :members (member-set
92
+ (member :name smf :description "A Standard MIDI File: tracks of events on a PPQ grid.")
93
+ (member :name it :description "An Impulse Tracker module: an order list of patterns of rows.")))
94
+
95
+ (value-kind :name byte-size
96
+ :description "A file's length in bytes, as the anchor recorded it. Verified against the file with :sha256 before any (bin …) offset or bound lane is honoured (anchor_mismatch) — never a silent re-read."
97
+ :underlying number
98
+ :numeric (numeric-bounds :min 0 :integer true)
99
+ :unit (unit-shape :reject true))
100
+
101
+ ; =====================================================================
102
+ ; Tempo and meter (plan 03, "Tempo" and "Meter")
103
+ ; =====================================================================
104
+
105
+ (value-kind :name us-per-quarter
106
+ :description "Microseconds per quarter note — the SMF set-tempo field, kept in its own spelling so a document imported from a .mid stays exact in text."
107
+ :underlying number
108
+ :numeric (numeric-bounds :min 1 :max 16777215 :integer true)
109
+ :unit (unit-shape :reject true))
110
+
111
+ (value-kind :name qpm-value
112
+ :description "Quarter notes per minute. Fractional tempi are legal; the IT Txx range (32..255) sits inside this one, so a document imported from a .it says :qpm and stays exact."
113
+ :underlying number
114
+ :numeric (numeric-bounds :min 1 :max 1000)
115
+ :unit (unit-shape :reject true))
116
+
117
+ (value-kind :name sig-component
118
+ :description "One component of a time signature, integer 1..64. The numerator's real ceiling is 64 and the denominator's is the power-of-two set {1 2 4 8 16 32} — a vector types both its elements alike, so the denominator's shape is a tempura meter_map_invalid with the form's span."
119
+ :underlying number
120
+ :numeric (numeric-bounds :min 1 :max 64 :integer true)
121
+ :unit (unit-shape :reject true))
122
+
123
+ (value-kind :name meter-sig
124
+ :description "A time signature as [beats-per-bar note-value], e.g. [4 4] or [7 8]. A bar is (4 n / d) quarters."
125
+ :underlying vector
126
+ :vector (vector-shape :len 2 :element sig-component))
127
+
128
+ (value-kind :name frame-rate-scalar
129
+ :description "A frame rate as whole frames per second, e.g. 25 — the rates film and video count in. Bounded like us-per-quarter, to catch typos; the f unit's arithmetic cannot overflow at any bound."
130
+ :underlying number
131
+ :numeric (numeric-bounds :min 1 :max 16777215 :integer true)
132
+ :unit (unit-shape :reject true))
133
+
134
+ (value-kind :name frame-rate-pair
135
+ :description "A frame rate as an exact [num den] rational, e.g. [30000 1001] for NTSC or [24000 1001] for 23.976 film. Never a bare decimal: 29.97 would mean 2997/100, and NTSC does not."
136
+ :underlying vector
137
+ :vector (vector-shape :len 2 :element frame-rate-scalar))
138
+
139
+ (value-kind :name timeline-frame-rate
140
+ :description "The document's frame rate for the f position unit (plan 03): an integer or an exact [num den] rational."
141
+ :underlying union
142
+ :union (union-shape :alternatives [frame-rate-scalar frame-rate-pair]))
143
+
144
+ ; =====================================================================
145
+ ; Names
146
+ ; =====================================================================
147
+
148
+ (value-kind :name section-name
149
+ :description "A section's identifier: the window's name, unique per document, and the name of the pacer (scene …) it exports to."
150
+ :underlying symbol)
151
+
152
+ (value-kind :name lane-name
153
+ :description "A lane's identifier, unique across the timeline's lanes. A clip places the phrase's lane of the same :name as the placing lane."
154
+ :underlying symbol)
155
+
156
+ (value-kind :name lane-target
157
+ :description "The pacer name this lane drives at export, resolved there against the host registries exactly as a pacer track's :target is. Defaults to the lane's own :name — a default this manifest cannot declare, since it copies another key."
158
+ :underlying symbol)
159
+
160
+ (value-kind :name phrase-name
161
+ :description "A phrase's identifier, and the cross-ref target a clip's :phrase names."
162
+ :underlying symbol)
163
+
164
+ (value-kind :name phrase-ref
165
+ :description "Names a (phrase :name …) declared in this document. A name no phrase declares is not_cross_ref."
166
+ :underlying symbol
167
+ :cross-ref (cross-ref :target phrase :name-key name))
168
+
169
+ ; =====================================================================
170
+ ; Lane kinds and the binding address
171
+ ; =====================================================================
172
+
173
+ (value-kind :name lane-kind
174
+ :description "The discriminant: which keys a lane has, and what its content means. Write it BEFORE the keys it enables — a variant key ahead of its discriminant is unknown_key."
175
+ :underlying symbol
176
+ :members (member-set
177
+ (member :name notes :description "Note events: (note …) and (clip …) children, or a binding to an anchor's notes.")
178
+ (member :name curve :description "A value over time: (keyframe …) children, or a binding to a controller lane or a tracker column.")
179
+ (member :name query :description "A SJON PatternQuery, one cycle per bar.")
180
+ (member :name formula :description "A pacer expression, evaluated at export in pacer's own environment.")))
181
+
182
+ (value-kind :name track-index
183
+ :description "Which track of a bound SMF anchor this lane reads, 1-based in file order."
184
+ :underlying number
185
+ :numeric (numeric-bounds :min 1 :integer true)
186
+ :unit (unit-shape :reject true))
187
+
188
+ (value-kind :name midi-channel
189
+ :description "A MIDI channel, 1..16 as every display counts them (0..15 on the wire)."
190
+ :underlying number
191
+ :numeric (numeric-bounds :min 1 :max 16 :integer true)
192
+ :unit (unit-shape :reject true))
193
+
194
+ (value-kind :name it-channel
195
+ :description "An Impulse Tracker channel, 1..64."
196
+ :underlying number
197
+ :numeric (numeric-bounds :min 1 :max 64 :integer true)
198
+ :unit (unit-shape :reject true))
199
+
200
+ (value-kind :name cc-number
201
+ :description "A MIDI controller number, 0..127."
202
+ :underlying number
203
+ :numeric (numeric-bounds :min 0 :max 127 :integer true)
204
+ :unit (unit-shape :reject true))
205
+
206
+ (value-kind :name cc-pair
207
+ :description "A 14-bit controller as [msb lsb] — two controller numbers read as one value."
208
+ :underlying vector
209
+ :vector (vector-shape :len 2 :element cc-number))
210
+
211
+ (value-kind :name cc-address
212
+ :description "A controller address: one number for a 7-bit controller, or an [msb lsb] pair for a 14-bit one."
213
+ :underlying union
214
+ :union (union-shape :alternatives [cc-number cc-pair]))
215
+
216
+ (value-kind :name midi-channel-set
217
+ :description "Several MIDI channels of one track as a vector, [1 2] — each 1..16, and no channel twice (a repeat, or an empty vector, is address_invalid: the manifest bounds the elements and the host checks the set)."
218
+ :underlying vector
219
+ :vector (vector-shape :min-len 1 :max-len 16 :element midi-channel))
220
+
221
+ (value-kind :name midi-channels
222
+ :description "Which MIDI channels of one track a bound lane reads: one midi-channel, or a midi-channel-set of several."
223
+ :underlying union
224
+ :union (union-shape :alternatives [midi-channel midi-channel-set]))
225
+
226
+ (value-kind :name curve-column
227
+ :description "Which Impulse Tracker column a bound curve lane reads."
228
+ :underlying symbol
229
+ :members (member-set
230
+ (member :name vol :description "The volume column, 0..64.")
231
+ (member :name pan :description "The pan column.")
232
+ (member :name fx :description "One effect letter's parameter — which letter is :fx.")))
233
+
234
+ (value-kind :name fx-letter
235
+ :description "An Impulse Tracker effect letter, A..Z — the effect whose parameter a bound :column fx lane reads."
236
+ :underlying string
237
+ :string-bounds (string-bounds :min-len 1 :max-len 1))
238
+
239
+ ; =====================================================================
240
+ ; Values
241
+ ; =====================================================================
242
+
243
+ (value-kind :name range-bound
244
+ :description "One end of a bound curve's output range. Narrowed to f32 at export, so it must fit that range."
245
+ :underlying number
246
+ :unit (unit-shape :reject true)
247
+ :repr (repr-shape :type f32))
248
+
249
+ (value-kind :name value-range
250
+ :description "The [lo hi] a bound curve's normalised value is scaled into at export."
251
+ :underlying vector
252
+ :vector (vector-shape :len 2 :element range-bound))
253
+
254
+ (value-kind :name key-scalar
255
+ :description "A unitless keyframe value. Narrowed to f32 at export, pacer's determinism seam, so it must fit that range."
256
+ :underlying number
257
+ :unit (unit-shape :reject true)
258
+ :repr (repr-shape :type f32))
259
+
260
+ (value-kind :name key-vector
261
+ :description "A 1-4 component keyframe value (vec2 / vec3 / vec4 targets). Arity is joined against the resolved target at export."
262
+ :underlying vector
263
+ :vector (vector-shape :min-len 1 :max-len 4 :element key-scalar))
264
+
265
+ (value-kind :name keyframe-value
266
+ :description "A keyframe's value: a scalar or a 1-4 component vector — pacer's own key-value shape."
267
+ :underlying union
268
+ :union (union-shape :alternatives [key-scalar key-vector]))
269
+
270
+ (value-kind :name note-key-number
271
+ :description "A MIDI key number, 0..127 (60 is middle C)."
272
+ :underlying number
273
+ :numeric (numeric-bounds :min 0 :max 127 :integer true)
274
+ :unit (unit-shape :reject true))
275
+
276
+ (value-kind :name note-key-name
277
+ :description "A note name: \"C4\" is 60, sharps spelled # and flats b, the midi set's middle-C-is-C4 convention. The spelling is checked host-side so a typo names the octave it could not read."
278
+ :underlying string)
279
+
280
+ (value-kind :name note-key
281
+ :description "A key: the MIDI number, or the note name that reads better."
282
+ :underlying union
283
+ :union (union-shape :alternatives [note-key-number note-key-name]))
284
+
285
+ (value-kind :name velocity
286
+ :description "A note's on-velocity, 1..127. Zero is a note-off on the wire and is never written here. Reaches an f32 lane at export."
287
+ :underlying number
288
+ :numeric (numeric-bounds :min 1 :max 127 :integer true)
289
+ :unit (unit-shape :reject true)
290
+ :repr (repr-shape :type f32))
291
+
292
+ (value-kind :name release-velocity
293
+ :description "A note's off-velocity, 0..127. MIDI rendering only — nothing else reads it."
294
+ :underlying number
295
+ :numeric (numeric-bounds :min 0 :max 127 :integer true)
296
+ :unit (unit-shape :reject true))
297
+
298
+ (value-kind :name repeat-count
299
+ :description "How many times a clip plays its phrase, at least once."
300
+ :underlying number
301
+ :numeric (numeric-bounds :min 1 :integer true)
302
+ :unit (unit-shape :reject true))
303
+
304
+ (value-kind :name transpose-semitones
305
+ :description "Semitones a clip shifts the phrase's notes by; ten octaves each way is well past any key range. Notes only — a curve clip ignores it."
306
+ :underlying number
307
+ :numeric (numeric-bounds :min -120 :max 120 :integer true)
308
+ :unit (unit-shape :reject true))
309
+
310
+ ; =====================================================================
311
+ ; Positional slots
312
+ ; =====================================================================
313
+
314
+ (value-kind :name lane-content
315
+ :description "A lane's children: note events, keyframes, and clips of a phrase. Each body is declared LOCAL to (lane …), so none of these three heads exists anywhere else — which is what lets `note` be tempura's timeline event while midivia's `note` verb keeps its own meaning in its own set."
316
+ :underlying form
317
+ :heads (head-set :names [note keyframe clip]))
318
+
319
+ (value-kind :name phrase-section
320
+ :description "A phrase's children: one or more (lane …) forms with content only. A phrase with no lane places nothing."
321
+ :underlying form
322
+ :heads (head-set
323
+ (head :name lane :min 1 :description "A lane of the phrase, matched to the placing lane by :name.")))
324
+
325
+ ; =====================================================================
326
+ ; Forms
327
+ ; =====================================================================
328
+
329
+ (form :name timeline
330
+ :description "The document's header: what the piece is called, how long it is, what happens at the end, and which anchor conducts it. One per document, first — a second is a tempura timeline_duplicate with its own span, since a head-set counts a form's children and not a document's roots."
331
+ (key :name title :type string :optional true
332
+ :description "The piece's title. Prose, not an identifier.")
333
+ (key :name length :type position :optional true
334
+ :description "The piece's length. Omitted, it is the end of the last event or clip rounded up to a bar.")
335
+ (key :name fps :type timeline-frame-rate :optional true
336
+ :description "The document's frame rate, for the `f` position unit (plan 03): frames per second as an integer (`:fps 25`) or an exact rational (`:fps [30000 1001]`). Never a bare decimal — 29.97 would mean 2997/100, and NTSC is 30000/1001. A rate alone changes no position's spelling; the header keeps `:fps`. An `f` position without this key is a tempura frame_rate_missing.")
337
+ (key :name end :type timeline-end :optional true :default hold
338
+ :description "What the playhead does past :length. Exported as pacer's transport :end.")
339
+ (key :name conductor :type anchor-ref :optional true
340
+ :description "The anchor whose tempo and meter conduct this document (plan 03, \"Three conductors\"). With one, the document's own (tempo-point …) and (meter-point …) forms are a conductor_conflict; without one, a tempo point and a meter point at tick 0 are required."))
341
+
342
+ (form :name anchor
343
+ :description "A file this document is arranged around — the it set's (source …) generalised to both formats. An anchor is BY REFERENCE when the document holds no dump for it and INLINE when a (midi/smf …) or (it/module …) root follows it. The pairing is POSITIONAL and one dump per anchor, which is document order and therefore not a shape this form can carry: a dump with no anchor before it is anchor_missing, a second dump for one anchor is anchor_dump_duplicate, and a hosted (it/source …) inside an inline module that disagrees with the anchor is anchor_conflict."
344
+ (key :name id :type anchor-id
345
+ :description "This anchor's name, referenced by :conductor and by a bound lane's :from.")
346
+ (key :name kind :type anchor-kind
347
+ :description "Which format the file is.")
348
+ (key :name file :type string
349
+ :description "Path to the file, resolved relative to this document.")
350
+ (key :name size :type byte-size :optional true
351
+ :description "The file's length in bytes. Checked with :sha256 before any offset into the file is honoured; a disagreement is anchor_mismatch, never a silent re-read.")
352
+ (key :name sha256 :type string :optional true
353
+ :description "Hex digest of the file's bytes, checked with :size."))
354
+
355
+ (form :name tempo-point
356
+ :description "A tempo change: from :at onward the piece runs at this tempo, until the next tempo point or the end. Tempo is a step function — a source that slides yields one point per tick and coalescing happens at export. Strictly ascending in document order (tempo_map_invalid), and one at tick 0 is required when the document has no :conductor. This form is the ONLY way a timeline document says tempo: a pass-through pacer (transport …) or (tempo …) is passthrough_conducts, because tempura emits those itself at export."
357
+ (key :name at :type grid-position
358
+ :description "Where the segment starts. Never in seconds: seconds are what this map defines.")
359
+ (key :name us :type us-per-quarter :optional true
360
+ :description "Microseconds per quarter note — an SMF file's own field. Exclusive with :qpm.")
361
+ (key :name qpm :type qpm-value :optional true
362
+ :description "Quarter notes per minute. Exclusive with :us.")
363
+ ; One tempo, spelled one way. The authored spelling is preserved by the
364
+ ; printer, so a document imported from a .mid stays in :us and one from
365
+ ; a .it stays in :qpm, and neither is round-tripped through the other.
366
+ (exclusive-group :cardinality exactly-one
367
+ (alt :keys [us])
368
+ (alt :keys [qpm])))
369
+
370
+ (form :name meter-point
371
+ :description "A meter change. Each must sit on a bar line of the meter before it (meter_off_bar) — a meter change mid-bar is not a thing in any source format — and one at tick 0 is required when the document has no :conductor."
372
+ (key :name at :type grid-position
373
+ :description "Where the meter changes. Never in seconds.")
374
+ (key :name sig :type meter-sig
375
+ :description "The time signature from :at onward, as [n d]."))
376
+
377
+ (form :name section
378
+ :description "A named window on the timeline, exported as a pacer (scene …) of the same name. Sections may overlap; a (scene …) passing through under a name a section also uses is scene_duplicate."
379
+ (key :name name :type section-name
380
+ :description "The window's name, unique per document.")
381
+ (key :name at :type position
382
+ :description "Where the window opens.")
383
+ (key :name dur :type position
384
+ :description "How long the window lasts."))
385
+
386
+ (form :name cue
387
+ :description "A named point in time — never a window. SMF markers and cue points dump to cues; pacer gets a comment, since a point has no scene."
388
+ (key :name name :type string
389
+ :description "What the point is called. Prose: SMF marker text is arbitrary bytes.")
390
+ (key :name at :type position
391
+ :description "Where the point sits."))
392
+
393
+ (form :name lane
394
+ :description "One stream of content driving one pacer target. :kind is the discriminant and decides which keys exist and what the children mean. A lane is NATIVE when it carries content and BOUND when it names an anchor with :from — never both (bound_lane_has_content), and content has one home."
395
+ :discriminant kind
396
+ :positional lane-content
397
+
398
+ ; ---- the three slot-locals ----
399
+ ; Declared here rather than promoted to plugin-global heads: a note, a
400
+ ; keyframe and a clip exist only inside a lane, and `note` in
401
+ ; particular is a head midivia's live tier also claims. The head-set
402
+ ; above narrows the slot to exactly these three (the closed
403
+ ; positional-set recipe, `portable-manifest-v1.md` §5.2).
404
+ (form :name note
405
+ :description "A note event. Two notes on one key overlapping in one lane are note_overlap."
406
+ (key :name at :type position
407
+ :description "The onset.")
408
+ (key :name dur :type position
409
+ :description "How long the note sounds, measured from :at.")
410
+ (key :name key :type note-key
411
+ :description "Which key: the MIDI number, or the note name.")
412
+ (key :name vel :type velocity :optional true :default 100
413
+ :description "On-velocity.")
414
+ (key :name ch :type midi-channel :optional true
415
+ :description "MIDI channel for rendering. Defaults to 1. A lane's own :ch is a BINDING key — which channels of a bound anchor the lane reads — and says nothing about the notes a native lane carries, so it is not the default here (a ruling `doc/fromSjon.zig` records at `default_note_ch`).")
416
+ (key :name off-vel :type release-velocity :optional true
417
+ :description "Off-velocity. MIDI rendering only."))
418
+
419
+ (form :name keyframe
420
+ :description "A value reached exactly at :at, with the easing that shaped the segment ENDING here. Before the first keyframe the lane holds its first value; after the last, its last. A curve is NAMED, never drawn — pacer's rule, so there are no Theatre-style handles."
421
+ (key :name at :type position
422
+ :description "Where the value lands.")
423
+ (key :name value :type keyframe-value
424
+ :description "The value reached at :at: a scalar or a 1-4 component vector.")
425
+ (key :name ease :type pacer/ease-spec :optional true :default linear
426
+ :description "The easing over the segment ending at this keyframe: a pacer easing name (in-cubic, hold, …) or a pacer easing form ((spring …), (steps …), (cubic-bezier …), (seq …), (chain …)). Typed by pacer's OWN kind, so the two vocabularies cannot drift."))
427
+
428
+ (form :name clip
429
+ :description "A phrase placed on this lane. It places the phrase's lane of the same :name as this lane; a phrase with no such lane is clip_lane_missing."
430
+ (key :name at :type position
431
+ :description "Where the phrase starts.")
432
+ (key :name phrase :type phrase-ref
433
+ :description "Which phrase to place.")
434
+ (key :name repeat :type repeat-count :optional true :default 1
435
+ :description "How many times the phrase plays.")
436
+ (key :name offset :type position :optional true
437
+ :description "Where in the phrase playback begins. Defaults to 0 — a default this manifest cannot declare, because a :default literal is unit-free and dropping the unit off a position would be exactly the silent guess the position kind exists to refuse (pacer says the same of a trigger's :offset).")
438
+ (key :name length :type position :optional true
439
+ :description "The playback window measured from :offset. Defaults to the phrase's length times :repeat minus :offset; content past the window is not placed, which is what a split clip's left half needs.")
440
+ (key :name transpose :type transpose-semitones :optional true :default 0
441
+ :description "Semitones to shift the placed notes by. Notes only."))
442
+
443
+ ; ---- keys every lane has ----
444
+ (key :name name :type lane-name
445
+ :description "This lane's name, unique across the timeline's lanes.")
446
+ (key :name kind :type lane-kind :optional true :default notes
447
+ :description "What this lane carries, and the discriminant that gates the keys below. Write it BEFORE them.")
448
+ (key :name target :type lane-target :optional true
449
+ :description "The pacer name this lane drives at export. Defaults to :name.")
450
+ ; ---- the binding address ----
451
+ ; Common rather than per-variant because a key lives in exactly one
452
+ ; place and these four are shared by the two content kinds. A `query`
453
+ ; or `formula` lane cannot bind at all — that is bound_kind_invalid,
454
+ ; a host check, because it is a relation between :kind and :from
455
+ ; rather than a shape either one has.
456
+ (key :name from :type anchor-ref :optional true
457
+ :description "The anchor this lane reads its content from. A lane with :from is BOUND: its content lives in the file, and children here are bound_lane_has_content. Only a notes or curve lane may bind — a query or formula lane that names one is bound_kind_invalid, which is a relation between :kind and :from and so cannot be a variant gate.")
458
+ (key :name track :type track-index :optional true
459
+ :description "Which track of a bound SMF anchor, 1-based in file order.")
460
+ (key :name ch :type midi-channels :optional true
461
+ :description "Which MIDI channel of a bound SMF anchor, 1..16 — or which channels, as a vector: `:ch [1 2]` reads both channels of the one :track. The vector is what a dump writes when a native lane whose notes named several channels comes back bound (residue rule 2: the lane binds at its track and at every channel its records name). A native lane's notes carry their own :ch and take none from the lane's (the lane's is a binding key); a vector on a native lane is address_invalid.")
462
+ (key :name channel :type it-channel :optional true
463
+ :description "Which channel of a bound Impulse Tracker anchor, 1..64.")
464
+
465
+ ; ---- notes ----
466
+ (variant :when notes
467
+ (key :name key :type note-key :optional true
468
+ :description "One key to read from a bound SMF anchor — a drum lane. Omitted, the lane takes every key on the address."))
469
+
470
+ ; ---- curve ----
471
+ (variant :when curve
472
+ (key :name range :type value-range :optional true
473
+ :description "The [lo hi] a bound curve's normalised value is scaled into at export.")
474
+ (key :name cc :type cc-address :optional true
475
+ :description "The lane's MIDI controller: one number, or [msb lsb] for a 14-bit pair. Bound with :from, the controller of the SMF anchor the lane reads. Native, the controller a .mid build renders the keyframes onto — one number only: a pair is kept but not written (render_cc_missing says so), and a native lane that names none takes the build's --cc.")
476
+ (key :name bend :type boolean :optional true
477
+ :description "Read the pitch bend of a bound SMF anchor.")
478
+ (key :name pressure :type boolean :optional true
479
+ :description "Read the channel pressure of a bound SMF anchor.")
480
+ (key :name velocity :type boolean :optional true
481
+ :description "Read note velocities of a bound SMF anchor as a curve.")
482
+ (key :name column :type curve-column :optional true
483
+ :description "Which column of a bound Impulse Tracker anchor to read.")
484
+ (key :name fx :type fx-letter :optional true :requires [column]
485
+ :description "Which effect letter's parameter to read. Meaningless without :column fx, hence :requires — an :fx alone is dependent_key_missing rather than a silent no-op.")
486
+ ; At-most-one rather than exactly-one: a NATIVE curve lane carries
487
+ ; keyframes and names at most the controller it renders onto, and a
488
+ ; bound IT lane addresses a column instead. What a count can see is that these four name four
489
+ ; different surfaces on one MIDI channel, and a lane reads one.
490
+ (exclusive-group :cardinality at-most-one
491
+ (alt :keys [cc])
492
+ (alt :keys [bend])
493
+ (alt :keys [pressure])
494
+ (alt :keys [velocity])))
495
+
496
+ ; ---- query ----
497
+ ; :walk-opaque — the validator never descends into the query. Its
498
+ ; interior is SJON's PatternQuery vocabulary (euclid, fastcat, pure,
499
+ ; …), checked by compiling it at build time with spans on failure,
500
+ ; not by this schema.
501
+ (variant :when query
502
+ (key :name query :type any :walk-opaque true
503
+ :description "A SJON PatternQuery, one cycle per bar. Compiled at build; a query that will not compile carries its own span."))
504
+
505
+ ; ---- formula ----
506
+ ; :walk-opaque — same discipline: the interior is pacer's expression
507
+ ; vocabulary, checked against pacer's environment names at build.
508
+ (variant :when formula
509
+ (key :name expr :type any :walk-opaque true
510
+ :description "A pacer expression, evaluated at export with the time environment bound (t, tick, beat, bar, cycle, phase, bpm, dur) plus every (control …) id.")))
511
+
512
+ (form :name phrase
513
+ :description "A reusable fragment: lanes with content, placed by a (clip …). A phrase's lanes carry content only — :from inside one is phrase_lane_bound, a clip inside one is clip_nested, and :target is ignored (the placing lane's target applies)."
514
+ :positional phrase-section
515
+ (key :name name :type phrase-name
516
+ :description "This phrase's name, referenced by a clip's :phrase.")
517
+ (key :name length :type position
518
+ :description "The phrase's length. A clip that repeats places one copy per :length."))
519
+ )