animader-cli 0.1.1 → 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,373 @@
1
+ ; The hosted `midi/` tier — the Standard MIDI File vocabulary, CORE TIER
2
+ ; ONLY (P99, plan 02; the midi set's 02, "The file document, core tier").
3
+ ;
4
+ ; One `(smf …)` header, one `(mtrk …)` per track in file order, and one
5
+ ; form per event, named as RP-001 names it in kebab-case. A `.mid` dumped
6
+ ; into a timeline document is the midi set's dump, form for form, so a
7
+ ; tool that reads one reads the other.
8
+ ;
9
+ ; What is NOT here, deliberately: midivia's LIVE tier — the `note` verb
10
+ ; and the `midi-input` / `midi-output` / `midi-clock` map forms. `note` is
11
+ ; the head tempura's timeline event already claims (plan 02, "The `note`
12
+ ; collision with midivia"), and the maps describe a running session rather
13
+ ; than a file. A `(midi/smf …)` written by hand here uses `note-on` /
14
+ ; `note-off`, and `(note …)` inside a `(lane …)` is the sugar.
15
+ ;
16
+ ; Every event head is a SLOT-LOCAL of `(mtrk …)`: an event exists only
17
+ ; inside a track, so `marker`, `lyric` and `meta` are not global heads
18
+ ; anyone else has to avoid. The two global heads are `smf` and `mtrk`.
19
+ ; Both spellings work — `(mtrk (marker …))` bare, and `(midi/mtrk
20
+ ; (marker …))` with the root qualified, which is how a dump rides inside a
21
+ ; timeline document.
22
+ ;
23
+ ; Owner of record: this manifest restates the midi set's, whose repo
24
+ ; (midivia) does not exist yet; when it does, one owner is picked per
25
+ ; manifest (plan 01, "Two sibling repos, one owner per file") and this
26
+ ; copy either becomes the copy or is replaced by the sibling's.
27
+ ;
28
+ ; No `:version`, for the reason `schema/tempura.sjon` declares none.
29
+
30
+ (plugin :name midi
31
+ :description "A Standard MIDI File as a document: the header, the tracks in file order, and one form per event with RP-001's own names. Core tier only — midivia's live tier (the `note` verb and the port maps) is not hosted here."
32
+
33
+ ; =====================================================================
34
+ ; Value kinds
35
+ ; =====================================================================
36
+
37
+ (value-kind :name smf-format
38
+ :description "SMF format: 0 = one track holding everything, 1 = several tracks played together, 2 = independent sequences."
39
+ :underlying number
40
+ :numeric (numeric-bounds :min 0 :max 2 :integer true)
41
+ :unit (unit-shape :reject true))
42
+
43
+ (value-kind :name smf-division
44
+ :description "Pulses per quarter note, 1..32767. A file read with SMPTE division dumps with the converted PPQ and a comment saying what it was."
45
+ :underlying number
46
+ :numeric (numeric-bounds :min 1 :max 32767 :integer true)
47
+ :unit (unit-shape :reject true))
48
+
49
+ (value-kind :name smf-tick
50
+ :description "An ABSOLUTE tick within the track, never a delta — the writer re-derives deltas. Non-decreasing in document order (at_not_monotone)."
51
+ :underlying number
52
+ :numeric (numeric-bounds :min 0 :integer true)
53
+ :unit (unit-shape :reject true))
54
+
55
+ (value-kind :name smf-channel
56
+ :description "A MIDI channel, 1..16 in text as every display counts them (0..15 on the wire)."
57
+ :underlying number
58
+ :numeric (numeric-bounds :min 1 :max 16 :integer true)
59
+ :unit (unit-shape :reject true))
60
+
61
+ (value-kind :name data7
62
+ :description "A 7-bit data byte, 0..127 — a key, a velocity, a controller number or value."
63
+ :underlying number
64
+ :numeric (numeric-bounds :min 0 :max 127 :integer true)
65
+ :unit (unit-shape :reject true))
66
+
67
+ (value-kind :name bend14
68
+ :description "A pitch-bend value, 0..16383, centre 8192."
69
+ :underlying number
70
+ :numeric (numeric-bounds :min 0 :max 16383 :integer true)
71
+ :unit (unit-shape :reject true))
72
+
73
+ (value-kind :name tempo-us
74
+ :description "Microseconds per quarter note, the FF 51 payload as a u24. Zero has no meaning and is refused."
75
+ :underlying number
76
+ :numeric (numeric-bounds :min 1 :max 16777215 :integer true)
77
+ :unit (unit-shape :reject true))
78
+
79
+ (value-kind :name byte-field
80
+ :description "One unsigned byte of a fixed-layout meta payload, 0..255."
81
+ :underlying number
82
+ :numeric (numeric-bounds :min 0 :max 255 :integer true)
83
+ :unit (unit-shape :reject true))
84
+
85
+ (value-kind :name word-field
86
+ :description "One unsigned 16-bit big-endian field, 0..65535."
87
+ :underlying number
88
+ :numeric (numeric-bounds :min 0 :max 65535 :integer true)
89
+ :unit (unit-shape :reject true))
90
+
91
+ (value-kind :name meta-type
92
+ :description "A meta-event type byte for a type this vocabulary does not name, 0..127."
93
+ :underlying number
94
+ :numeric (numeric-bounds :min 0 :max 127 :integer true)
95
+ :unit (unit-shape :reject true))
96
+
97
+ (value-kind :name sig-numerator
98
+ :description "A time signature's numerator (nn), 1..255."
99
+ :underlying number
100
+ :numeric (numeric-bounds :min 1 :max 255 :integer true)
101
+ :unit (unit-shape :reject true))
102
+
103
+ (value-kind :name sig-denominator
104
+ :description "A time signature's denominator written as the number it is (4, 8, 16), not as RP-001's power-of-two exponent. A value that is not a power of two has no dd byte and is a diagnostic at build."
105
+ :underlying number
106
+ :numeric (numeric-bounds :min 1 :max 128 :integer true)
107
+ :unit (unit-shape :reject true))
108
+
109
+ (value-kind :name key-accidentals
110
+ :description "A key signature's sf byte: -7 (seven flats) to 7 (seven sharps)."
111
+ :underlying number
112
+ :numeric (numeric-bounds :min -7 :max 7 :integer true)
113
+ :unit (unit-shape :reject true))
114
+
115
+ (value-kind :name key-mode
116
+ :description "A key signature's mi byte: 0 major, 1 minor."
117
+ :underlying number
118
+ :numeric (numeric-bounds :min 0 :max 1 :integer true)
119
+ :unit (unit-shape :reject true))
120
+
121
+ (value-kind :name hex-bytes
122
+ :description "A byte payload as hex, two digits per byte, spaces optional: \"F0 7E 7F 09 01 F7\". Carried verbatim so rung 1 of the round-trip ladder holds without a rewriter."
123
+ :underlying string)
124
+
125
+ (value-kind :name meta-text
126
+ :description "A text payload's bytes read as UTF-8. When the bytes are not valid UTF-8 the event says :bytes instead, and the two are exclusive."
127
+ :underlying string)
128
+
129
+ (value-kind :name ease-lane
130
+ :description "Which controller surface an easing hint applies to."
131
+ :underlying symbol
132
+ :members (member-set
133
+ (member :name cc :description "A 7-bit controller — :num says which.")
134
+ (member :name cc14 :description "A 14-bit controller pair — :num says which MSB.")
135
+ (member :name bend :description "Pitch bend.")
136
+ (member :name pressure :description "Channel pressure.")))
137
+
138
+ ; The hint carries a NAME or one PARAMETERISED form, spelled as pacer's
139
+ ; score spells it, and never a (seq …) or a (chain …): the payload is 25
140
+ ; bytes and builds back byte-exact, which a nested combinator cannot do.
141
+ ; The name half is pacer's OWN member set — a cross-plugin kind
142
+ ; reference — so the two vocabularies cannot drift.
143
+ (value-kind :name hint-ease-form
144
+ :description "A parameterised easing form, as pacer declares it: (steps …), (cubic-bezier …) or (spring …). The combinators (seq …) and (chain …) are not hintable — the payload is fixed-width."
145
+ :underlying form
146
+ :heads (head-set :names [steps cubic-bezier spring]))
147
+
148
+ (value-kind :name hint-ease
149
+ :description "An easing hint: a pacer easing name, or one parameterised pacer easing form."
150
+ :underlying union
151
+ :union (union-shape :alternatives [pacer/ease-name hint-ease-form]))
152
+
153
+ (value-kind :name event-section
154
+ :description "The events a track may hold: the RP-001 channel messages, the system-exclusive pair, every named meta event, `meta` for a type this vocabulary does not name, and midivia's `ease-hint`. Each body is slot-local to (mtrk …), so none of these heads exists outside a track."
155
+ :underlying form
156
+ :heads (head-set :names [
157
+ note-on note-off poly-pressure control-change program-change
158
+ channel-pressure pitch-bend
159
+ sysex escape
160
+ sequence-number text-event copyright-notice sequence-name
161
+ instrument-name lyric marker cue-point program-name device-name
162
+ midi-channel-prefix midi-port end-of-track set-tempo smpte-offset
163
+ time-signature key-signature sequencer-specific meta
164
+ ease-hint]))
165
+
166
+ ; =====================================================================
167
+ ; Forms
168
+ ; =====================================================================
169
+
170
+ (form :name smf
171
+ :description "A Standard MIDI File's header chunk. Once, first; the tracks follow as (mtrk …) roots in file order."
172
+ (key :name format :type smf-format
173
+ :description "0, 1 or 2. The timeline derivation accepts 0 and 1 and refuses 2 (smf_format2): a format 2 file's tracks are not simultaneous.")
174
+ (key :name division :type smf-division
175
+ :description "Pulses per quarter note. SMPTE division is converted on read and never written."))
176
+
177
+ (form :name mtrk
178
+ :description "One track: events in file order, positional children only. Absolute ticks are non-decreasing within a track, and the last event must be an (end-of-track …)."
179
+ :positional event-section
180
+
181
+ ; ---- channel messages ------------------------------------------
182
+ (form :name note-on
183
+ :description "9n — a note starts. Velocity 0 is a note off on the wire and is stored as written; the bridge's note pairing interprets it."
184
+ (key :name at :type smf-tick :description "Absolute tick.")
185
+ (key :name ch :type smf-channel :description "Channel, 1..16.")
186
+ (key :name key :type data7 :description "Key number, 0..127.")
187
+ (key :name vel :type data7 :description "Velocity, 0..127."))
188
+
189
+ (form :name note-off
190
+ :description "8n — a note ends."
191
+ (key :name at :type smf-tick :description "Absolute tick.")
192
+ (key :name ch :type smf-channel :description "Channel, 1..16.")
193
+ (key :name key :type data7 :description "Key number, 0..127.")
194
+ (key :name vel :type data7 :description "Release velocity, 0..127."))
195
+
196
+ (form :name poly-pressure
197
+ :description "An — polyphonic key pressure: aftertouch on one key."
198
+ (key :name at :type smf-tick :description "Absolute tick.")
199
+ (key :name ch :type smf-channel :description "Channel, 1..16.")
200
+ (key :name key :type data7 :description "Key number, 0..127.")
201
+ (key :name val :type data7 :description "Pressure, 0..127."))
202
+
203
+ (form :name control-change
204
+ :description "Bn — control change. Controllers 0..119 are continuous; 120..127 are the channel mode messages and are stored the same way."
205
+ (key :name at :type smf-tick :description "Absolute tick.")
206
+ (key :name ch :type smf-channel :description "Channel, 1..16.")
207
+ (key :name num :type data7 :description "Controller number, 0..127.")
208
+ (key :name val :type data7 :description "Controller value, 0..127."))
209
+
210
+ (form :name program-change
211
+ :description "Cn — program change."
212
+ (key :name at :type smf-tick :description "Absolute tick.")
213
+ (key :name ch :type smf-channel :description "Channel, 1..16.")
214
+ (key :name num :type data7 :description "Program number, 0..127."))
215
+
216
+ (form :name channel-pressure
217
+ :description "Dn — channel pressure: aftertouch across the channel."
218
+ (key :name at :type smf-tick :description "Absolute tick.")
219
+ (key :name ch :type smf-channel :description "Channel, 1..16.")
220
+ (key :name val :type data7 :description "Pressure, 0..127."))
221
+
222
+ (form :name pitch-bend
223
+ :description "En — pitch bend, 14 bits, LSB first on the wire, centre 8192."
224
+ (key :name at :type smf-tick :description "Absolute tick.")
225
+ (key :name ch :type smf-channel :description "Channel, 1..16.")
226
+ (key :name val :type bend14 :description "Bend value, 0..16383."))
227
+
228
+ ; ---- system exclusive ------------------------------------------
229
+ (form :name sysex
230
+ :description "F0 — a system-exclusive message. The bytes normally end with F7; a message may be split across escape continuations."
231
+ (key :name at :type smf-tick :description "Absolute tick.")
232
+ (key :name data :type hex-bytes :description "The payload, verbatim, as hex."))
233
+
234
+ (form :name escape
235
+ :description "F7 — an escape / continuation event: arbitrary bytes embedded in the file."
236
+ (key :name at :type smf-tick :description "Absolute tick.")
237
+ (key :name data :type hex-bytes :description "The payload, verbatim, as hex."))
238
+
239
+ ; ---- meta events ------------------------------------------------
240
+ (form :name sequence-number
241
+ :description "FF 00 — the sequence number, at tick 0."
242
+ (key :name at :type smf-tick :description "Absolute tick.")
243
+ (key :name num :type word-field :description "Sequence number, 0..65535."))
244
+
245
+ (form :name text-event
246
+ :description "FF 01 — free text. Named `text-event` rather than `text`, which a sibling curve vocabulary is likely to claim."
247
+ (key :name at :type smf-tick :description "Absolute tick.")
248
+ (key :name text :type meta-text :optional true :description "The payload as UTF-8. Exclusive with :bytes.")
249
+ (key :name bytes :type hex-bytes :optional true :description "The payload as hex, when the bytes are not valid UTF-8. Exclusive with :text.")
250
+ (exclusive-group :cardinality exactly-one (alt :keys [text]) (alt :keys [bytes])))
251
+
252
+ (form :name copyright-notice
253
+ :description "FF 02 — the copyright notice, conventionally first in the first track."
254
+ (key :name at :type smf-tick :description "Absolute tick.")
255
+ (key :name text :type meta-text :optional true :description "The payload as UTF-8. Exclusive with :bytes.")
256
+ (key :name bytes :type hex-bytes :optional true :description "The payload as hex. Exclusive with :text.")
257
+ (exclusive-group :cardinality exactly-one (alt :keys [text]) (alt :keys [bytes])))
258
+
259
+ (form :name sequence-name
260
+ :description "FF 03 — the sequence or track name. A bound lane's default label."
261
+ (key :name at :type smf-tick :description "Absolute tick.")
262
+ (key :name text :type meta-text :optional true :description "The payload as UTF-8. Exclusive with :bytes.")
263
+ (key :name bytes :type hex-bytes :optional true :description "The payload as hex. Exclusive with :text.")
264
+ (exclusive-group :cardinality exactly-one (alt :keys [text]) (alt :keys [bytes])))
265
+
266
+ (form :name instrument-name
267
+ :description "FF 04 — the instrument name."
268
+ (key :name at :type smf-tick :description "Absolute tick.")
269
+ (key :name text :type meta-text :optional true :description "The payload as UTF-8. Exclusive with :bytes.")
270
+ (key :name bytes :type hex-bytes :optional true :description "The payload as hex. Exclusive with :text.")
271
+ (exclusive-group :cardinality exactly-one (alt :keys [text]) (alt :keys [bytes])))
272
+
273
+ (form :name lyric
274
+ :description "FF 05 — one syllable of lyric."
275
+ (key :name at :type smf-tick :description "Absolute tick.")
276
+ (key :name text :type meta-text :optional true :description "The payload as UTF-8. Exclusive with :bytes.")
277
+ (key :name bytes :type hex-bytes :optional true :description "The payload as hex. Exclusive with :text.")
278
+ (exclusive-group :cardinality exactly-one (alt :keys [text]) (alt :keys [bytes])))
279
+
280
+ (form :name marker
281
+ :description "FF 06 — a marker. Dumps to a timeline (cue …)."
282
+ (key :name at :type smf-tick :description "Absolute tick.")
283
+ (key :name text :type meta-text :optional true :description "The payload as UTF-8. Exclusive with :bytes.")
284
+ (key :name bytes :type hex-bytes :optional true :description "The payload as hex. Exclusive with :text.")
285
+ (exclusive-group :cardinality exactly-one (alt :keys [text]) (alt :keys [bytes])))
286
+
287
+ (form :name cue-point
288
+ :description "FF 07 — a cue point. Dumps to a timeline (cue …)."
289
+ (key :name at :type smf-tick :description "Absolute tick.")
290
+ (key :name text :type meta-text :optional true :description "The payload as UTF-8. Exclusive with :bytes.")
291
+ (key :name bytes :type hex-bytes :optional true :description "The payload as hex. Exclusive with :text.")
292
+ (exclusive-group :cardinality exactly-one (alt :keys [text]) (alt :keys [bytes])))
293
+
294
+ (form :name program-name
295
+ :description "FF 08 — the program name (RP-019)."
296
+ (key :name at :type smf-tick :description "Absolute tick.")
297
+ (key :name text :type meta-text :optional true :description "The payload as UTF-8. Exclusive with :bytes.")
298
+ (key :name bytes :type hex-bytes :optional true :description "The payload as hex. Exclusive with :text.")
299
+ (exclusive-group :cardinality exactly-one (alt :keys [text]) (alt :keys [bytes])))
300
+
301
+ (form :name device-name
302
+ :description "FF 09 — the device name (RP-019)."
303
+ (key :name at :type smf-tick :description "Absolute tick.")
304
+ (key :name text :type meta-text :optional true :description "The payload as UTF-8. Exclusive with :bytes.")
305
+ (key :name bytes :type hex-bytes :optional true :description "The payload as hex. Exclusive with :text.")
306
+ (exclusive-group :cardinality exactly-one (alt :keys [text]) (alt :keys [bytes])))
307
+
308
+ (form :name midi-channel-prefix
309
+ :description "FF 20 — the channel subsequent meta events apply to."
310
+ (key :name at :type smf-tick :description "Absolute tick.")
311
+ (key :name ch :type smf-channel :description "Channel, 1..16."))
312
+
313
+ (form :name midi-port
314
+ :description "FF 21 — the port subsequent events go to. Widespread, not in RP-001; read and written."
315
+ (key :name at :type smf-tick :description "Absolute tick.")
316
+ (key :name port :type byte-field :description "Port number, 0..255."))
317
+
318
+ (form :name end-of-track
319
+ :description "FF 2F — required as the last event of every track. A missing one is end_of_track_missing; the writer always emits it."
320
+ (key :name at :type smf-tick :description "Absolute tick."))
321
+
322
+ (form :name set-tempo
323
+ :description "FF 51 — a tempo change. The SMF conductor's segment boundary."
324
+ (key :name at :type smf-tick :description "Absolute tick.")
325
+ (key :name us :type tempo-us :description "Microseconds per quarter note."))
326
+
327
+ (form :name smpte-offset
328
+ :description "FF 54 — the SMPTE time the track starts at. Stored and written back; nothing reads it."
329
+ (key :name at :type smf-tick :description "Absolute tick.")
330
+ (key :name hr :type byte-field :description "Hours byte, frame rate in its top bits.")
331
+ (key :name mn :type byte-field :description "Minutes.")
332
+ (key :name se :type byte-field :description "Seconds.")
333
+ (key :name fr :type byte-field :description "Frames.")
334
+ (key :name ff :type byte-field :description "Fractional frames, 1/100th."))
335
+
336
+ (form :name time-signature
337
+ :description "FF 58 — a time signature. The SMF conductor's meter."
338
+ (key :name at :type smf-tick :description "Absolute tick.")
339
+ (key :name num :type sig-numerator :description "Beats per bar (nn).")
340
+ (key :name denom :type sig-denominator :description "Note value, written as the number it is: 4, 8, 16.")
341
+ (key :name clocks :type byte-field :optional true :default 24 :description "MIDI clocks per metronome click.")
342
+ (key :name thirty-seconds :type byte-field :optional true :default 8 :description "Notated 32nd notes per MIDI quarter note."))
343
+
344
+ (form :name key-signature
345
+ :description "FF 59 — a key signature."
346
+ (key :name at :type smf-tick :description "Absolute tick.")
347
+ (key :name sf :type key-accidentals :description "Sharps (positive) or flats (negative), -7..7.")
348
+ (key :name mi :type key-mode :optional true :default 0 :description "0 major, 1 minor."))
349
+
350
+ (form :name sequencer-specific
351
+ :description "FF 7F — a vendor payload, stored verbatim. Two families are parsed instead of hexed: tempura's residue records and midivia's easing hint, which dumps as (ease-hint …)."
352
+ (key :name at :type smf-tick :description "Absolute tick.")
353
+ (key :name data :type hex-bytes :description "The payload, verbatim, as hex."))
354
+
355
+ (form :name meta
356
+ :description "A meta event of a type this vocabulary does not name. Round-tripped verbatim."
357
+ (key :name at :type smf-tick :description "Absolute tick.")
358
+ (key :name type :type meta-type :description "The type byte, 0..127.")
359
+ (key :name data :type hex-bytes :description "The payload, verbatim, as hex."))
360
+
361
+ ; ---- the one typed sequencer-specific payload --------------------
362
+ (form :name ease-hint
363
+ :description "midivia's easing hint: the curve shape a controller lane was authored with, so a sampled automation lane reads back as a named easing instead of as steps. Builds back to its fixed-width payload byte-exact."
364
+ :discriminant lane
365
+ (key :name at :type smf-tick :description "Absolute tick.")
366
+ (key :name ch :type smf-channel :description "Channel, 1..16.")
367
+ (key :name lane :type ease-lane
368
+ :description "Which controller surface the hint applies to, and the discriminant that decides whether :num exists. Write it BEFORE :num.")
369
+ (key :name ease :type hint-ease
370
+ :description "The easing: a pacer easing name, or one parameterised pacer easing form.")
371
+ (variant :when [cc cc14]
372
+ (key :name num :type data7
373
+ :description "Which controller (the MSB, for a 14-bit pair). Only a cc or cc14 hint has one.")))))