@nodetool-ai/protocol 0.8.19 → 0.8.20
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.
- package/dist/.nodetool-build-stamp +1 -1
- package/dist/api-schemas/assets.d.ts +13 -0
- package/dist/api-schemas/assets.d.ts.map +1 -1
- package/dist/api-schemas/assets.js +13 -1
- package/dist/api-schemas/assets.js.map +1 -1
- package/dist/api-schemas/index.d.ts +1 -0
- package/dist/api-schemas/index.d.ts.map +1 -1
- package/dist/api-schemas/index.js +1 -0
- package/dist/api-schemas/index.js.map +1 -1
- package/dist/api-schemas/mcp-config.d.ts +13 -0
- package/dist/api-schemas/mcp-config.d.ts.map +1 -1
- package/dist/api-schemas/mcp-config.js +5 -3
- package/dist/api-schemas/mcp-config.js.map +1 -1
- package/dist/api-schemas/openverse.d.ts +1 -0
- package/dist/api-schemas/openverse.d.ts.map +1 -1
- package/dist/api-schemas/sdk-execution-v1.d.ts +3 -0
- package/dist/api-schemas/sdk-execution-v1.d.ts.map +1 -1
- package/dist/api-schemas/storage.d.ts +42 -1
- package/dist/api-schemas/storage.d.ts.map +1 -1
- package/dist/api-schemas/storage.js +42 -2
- package/dist/api-schemas/storage.js.map +1 -1
- package/dist/api-schemas/timeline-tool-contracts.d.ts +4307 -157
- package/dist/api-schemas/timeline-tool-contracts.d.ts.map +1 -1
- package/dist/api-schemas/timeline-tool-contracts.js +342 -20
- package/dist/api-schemas/timeline-tool-contracts.js.map +1 -1
- package/dist/api-schemas/timeline-tool-params.d.ts +6705 -144
- package/dist/api-schemas/timeline-tool-params.d.ts.map +1 -1
- package/dist/api-schemas/timeline-tool-params.js +1697 -40
- package/dist/api-schemas/timeline-tool-params.js.map +1 -1
- package/dist/api-schemas/timeline.d.ts +8749 -51
- package/dist/api-schemas/timeline.d.ts.map +1 -1
- package/dist/api-schemas/timeline.js +757 -40
- package/dist/api-schemas/timeline.js.map +1 -1
- package/dist/api-schemas/triggers.d.ts +99 -0
- package/dist/api-schemas/triggers.d.ts.map +1 -0
- package/dist/api-schemas/triggers.js +48 -0
- package/dist/api-schemas/triggers.js.map +1 -0
- package/dist/api-schemas/workflows.d.ts +54 -0
- package/dist/api-schemas/workflows.d.ts.map +1 -1
- package/dist/api-schemas/workflows.js +13 -1
- package/dist/api-schemas/workflows.js.map +1 -1
- package/dist/api-types.d.ts +1 -0
- package/dist/api-types.d.ts.map +1 -1
- package/dist/api-types.js +2 -0
- package/dist/api-types.js.map +1 -1
- package/dist/cloud-profile.d.ts.map +1 -1
- package/dist/cloud-profile.js +2 -0
- package/dist/cloud-profile.js.map +1 -1
- package/dist/game-design.d.ts +6 -4
- package/dist/game-design.d.ts.map +1 -1
- package/dist/game-design.js +178 -51
- package/dist/game-design.js.map +1 -1
- package/dist/local-providers.d.ts.map +1 -1
- package/dist/local-providers.js +9 -0
- package/dist/local-providers.js.map +1 -1
- package/dist/markdown-blocks.d.ts.map +1 -1
- package/dist/markdown-blocks.js +31 -4
- package/dist/markdown-blocks.js.map +1 -1
- package/dist/messages.d.ts +30 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js.map +1 -1
- package/dist/missing-runtime-package.d.ts +4 -1
- package/dist/missing-runtime-package.d.ts.map +1 -1
- package/dist/missing-runtime-package.js +17 -0
- package/dist/missing-runtime-package.js.map +1 -1
- package/dist/native-game-templates.d.ts.map +1 -1
- package/dist/native-game-templates.js +18 -4
- package/dist/native-game-templates.js.map +1 -1
- package/dist/processing-messages.schema.json +3 -0
- package/dist/project-directories.d.ts +1 -0
- package/dist/project-directories.d.ts.map +1 -1
- package/dist/project-directories.js +12 -2
- package/dist/project-directories.js.map +1 -1
- package/dist/render-record.d.ts +3 -2
- package/dist/render-record.d.ts.map +1 -1
- package/dist/render-record.js +3 -2
- package/dist/render-record.js.map +1 -1
- package/dist/sandbox-capability.d.ts +9 -2
- package/dist/sandbox-capability.d.ts.map +1 -1
- package/dist/sandbox-capability.js +12 -3
- package/dist/sandbox-capability.js.map +1 -1
- package/dist/ws-commands.d.ts +496 -1
- package/dist/ws-commands.d.ts.map +1 -1
- package/dist/ws-commands.js +262 -3
- package/dist/ws-commands.js.map +1 -1
- package/package.json +1 -1
- package/schema/sdk-v1.execution.schema.json +6 -0
- package/schema/sdk-v1.manifest.json +1 -1
|
@@ -19,6 +19,106 @@ export const CLIP_FADE_SHAPE_TUPLE = [
|
|
|
19
19
|
];
|
|
20
20
|
export const clipFadeShapeEnum = z.enum(CLIP_FADE_SHAPE_TUPLE);
|
|
21
21
|
// ── Shared sub-schemas ───────────────────────────────────────────────────────
|
|
22
|
+
/** Key tonics the music model accepts (MUSIC-MODE.md MF6). */
|
|
23
|
+
export const MUSIC_KEY_TONICS = [
|
|
24
|
+
"C", "C#", "Db", "D", "D#", "Eb", "E", "F", "F#", "Gb", "G", "G#", "Ab",
|
|
25
|
+
"A", "A#", "Bb", "B"
|
|
26
|
+
];
|
|
27
|
+
/** A project key. Stored on the tempo object (MUSIC-MODE.md MD2). */
|
|
28
|
+
export const musicKey = z.object({
|
|
29
|
+
tonic: z.enum(MUSIC_KEY_TONICS),
|
|
30
|
+
mode: z.enum(["major", "minor"])
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* Document-level constant tempo. Milliseconds stay the stored master clock —
|
|
34
|
+
* ticks are read against `bpm` — so changing the tempo rescales every midi
|
|
35
|
+
* clip's timing around `offsetMs` and leaves every other clip where it is.
|
|
36
|
+
*/
|
|
37
|
+
export const timelineTempo = z.object({
|
|
38
|
+
bpm: z.number().positive(),
|
|
39
|
+
/** Where beat one sits on the timeline, in ms. */
|
|
40
|
+
offsetMs: z.number().min(0),
|
|
41
|
+
timeSignature: z.object({
|
|
42
|
+
beatsPerBar: z.number().int().positive(),
|
|
43
|
+
beatUnit: z.number().int().positive()
|
|
44
|
+
}),
|
|
45
|
+
/** Project key for music generation. Absent lets the model pick one. */
|
|
46
|
+
key: musicKey.optional()
|
|
47
|
+
});
|
|
48
|
+
/** The twelve ACE-Step track names a music track can carry (MUSIC-MODE.md MD4). */
|
|
49
|
+
export const MUSIC_ROLES = [
|
|
50
|
+
"vocals", "backing_vocals", "drums", "bass", "guitar", "keyboard",
|
|
51
|
+
"percussion", "strings", "synth", "fx", "brass", "woodwinds"
|
|
52
|
+
];
|
|
53
|
+
export const musicRole = z.enum(MUSIC_ROLES);
|
|
54
|
+
/** The three music generation tasks of the first release. */
|
|
55
|
+
export const MUSIC_TASKS = ["text2music", "repaint", "lego"];
|
|
56
|
+
export const musicTask = z.enum(MUSIC_TASKS);
|
|
57
|
+
/** Most prompts one sequence keeps in its music prompt history (MD3). */
|
|
58
|
+
export const MAX_MUSIC_PROMPT_HISTORY = 50;
|
|
59
|
+
/** Marks a music project and holds its prompt history (MUSIC-MODE.md MD3). */
|
|
60
|
+
export const timelineMusic = z.object({
|
|
61
|
+
/** Crossfade length in ms for touching audio clips on one track (CE7). Default 10, 0 turns it off. */
|
|
62
|
+
autoCrossfadeMs: z.number().min(0).max(1000).optional(),
|
|
63
|
+
promptHistory: z.array(z.string()).max(MAX_MUSIC_PROMPT_HISTORY).optional()
|
|
64
|
+
});
|
|
65
|
+
const frameIndex = z.number().int().min(0);
|
|
66
|
+
/**
|
|
67
|
+
* The generation record of one music take (MUSIC-MODE.md MD5, TK-3). Every
|
|
68
|
+
* frame value counts 48 kHz frames. `ClipVersion` already holds the provider,
|
|
69
|
+
* DiT model, caption, request id and duration.
|
|
70
|
+
*/
|
|
71
|
+
export const musicGenerationRecord = z.object({
|
|
72
|
+
task: musicTask,
|
|
73
|
+
/** Backend and pinned commit, e.g. "acestep.cpp@07abf07". */
|
|
74
|
+
backend: z.string(),
|
|
75
|
+
lmModel: z.string().optional(),
|
|
76
|
+
steps: z.number().int().min(0),
|
|
77
|
+
/** Only for a backend that takes an instruction string. */
|
|
78
|
+
instruction: z.string().optional(),
|
|
79
|
+
trackRole: musicRole.optional(),
|
|
80
|
+
bpm: z.number().positive(),
|
|
81
|
+
key: musicKey.optional(),
|
|
82
|
+
beatsPerBar: z.number().int().positive(),
|
|
83
|
+
beatUnit: z.number().int().positive(),
|
|
84
|
+
seed: z.number().int(),
|
|
85
|
+
/** Language model output. A replay with these codes skips the language model. */
|
|
86
|
+
audioCodes: z.string().optional(),
|
|
87
|
+
candidateIndex: z.number().int().min(0),
|
|
88
|
+
segmentIndex: z.number().int().min(0),
|
|
89
|
+
/** Timeline position at 48 kHz. */
|
|
90
|
+
targetStartFrame: frameIndex,
|
|
91
|
+
targetEndFrame: frameIndex,
|
|
92
|
+
contextAssetId: z.string().optional(),
|
|
93
|
+
/** Timeline position at 48 kHz. */
|
|
94
|
+
contextStartFrame: frameIndex.optional(),
|
|
95
|
+
contextEndFrame: frameIndex.optional(),
|
|
96
|
+
/** Length asked of the model. */
|
|
97
|
+
requestFrames: z.number().int().positive(),
|
|
98
|
+
splice: z
|
|
99
|
+
.object({
|
|
100
|
+
parentAssetId: z.string(),
|
|
101
|
+
/** In the parent asset. */
|
|
102
|
+
startFrame: frameIndex,
|
|
103
|
+
endFrame: frameIndex,
|
|
104
|
+
crossfadeFrames: z.number().int().min(0),
|
|
105
|
+
/** Set when the parent was not 48 kHz stereo and was resampled once. */
|
|
106
|
+
parentResampled: z.boolean().optional()
|
|
107
|
+
})
|
|
108
|
+
.optional(),
|
|
109
|
+
alignment: z
|
|
110
|
+
.object({
|
|
111
|
+
offsetFrames: z.number().int(),
|
|
112
|
+
corrected: z.boolean(),
|
|
113
|
+
confidence: z.number().min(0),
|
|
114
|
+
/** Measured tempo divided by project tempo. */
|
|
115
|
+
tempoRatio: z.number().positive(),
|
|
116
|
+
lastBeatErrorMs: z.number().min(0),
|
|
117
|
+
drifting: z.boolean().optional()
|
|
118
|
+
})
|
|
119
|
+
.optional(),
|
|
120
|
+
gainDb: z.number().optional()
|
|
121
|
+
});
|
|
22
122
|
export const clipVersion = z.object({
|
|
23
123
|
id: z.string(),
|
|
24
124
|
createdAt: z.string(),
|
|
@@ -128,7 +228,9 @@ export const clipVersion = z.object({
|
|
|
128
228
|
strength: z.number().optional(),
|
|
129
229
|
resolution: z.string().optional()
|
|
130
230
|
})
|
|
131
|
-
.optional()
|
|
231
|
+
.optional(),
|
|
232
|
+
/** Generation record of a music take. */
|
|
233
|
+
musicGeneration: musicGenerationRecord.optional()
|
|
132
234
|
});
|
|
133
235
|
export const timelineMarker = z.object({
|
|
134
236
|
id: z.string(),
|
|
@@ -281,12 +383,34 @@ export const trackChromaKeyEffect = z.object({
|
|
|
281
383
|
softness: z.number(),
|
|
282
384
|
spill: z.number()
|
|
283
385
|
});
|
|
386
|
+
/** Plug-in format reported by the host scan (`vst3` on all platforms, `au` on macOS). */
|
|
387
|
+
export const vstPluginFormat = z.enum(["vst3", "au"]);
|
|
388
|
+
/** `VstPluginRef` in `@nodetool-ai/timeline`: the VST3/AU plug-in a track or insert loads. */
|
|
389
|
+
export const vstPluginRef = z.object({
|
|
390
|
+
uid: z.string().min(1).max(512),
|
|
391
|
+
name: z.string().max(256),
|
|
392
|
+
vendor: z.string().max(256),
|
|
393
|
+
path: z.string().min(1).max(4096),
|
|
394
|
+
format: vstPluginFormat.optional()
|
|
395
|
+
});
|
|
396
|
+
/** Base64 plug-in state above this is refused, so one track cannot bloat the document. */
|
|
397
|
+
export const VST_STATE_MAX_CHARS = 8_000_000;
|
|
398
|
+
/** `TrackVstEffect` in `@nodetool-ai/timeline`: a third-party VST3/AU insert effect. */
|
|
399
|
+
export const trackVstEffect = z.object({
|
|
400
|
+
id: z.string(),
|
|
401
|
+
type: z.literal("vst"),
|
|
402
|
+
enabled: z.boolean(),
|
|
403
|
+
plugin: vstPluginRef.nullable(),
|
|
404
|
+
state: z.string().max(VST_STATE_MAX_CHARS).nullable(),
|
|
405
|
+
wet: z.number().min(0).max(1)
|
|
406
|
+
});
|
|
284
407
|
export const trackEffect = z.discriminatedUnion("type", [
|
|
285
408
|
trackGainEffect,
|
|
286
409
|
trackEq3Effect,
|
|
287
410
|
trackFilterEffect,
|
|
288
411
|
trackCompressorEffect,
|
|
289
412
|
trackFableEffect,
|
|
413
|
+
trackVstEffect,
|
|
290
414
|
trackColorCorrectionEffect,
|
|
291
415
|
trackVideoBlurEffect,
|
|
292
416
|
trackSharpenEffect,
|
|
@@ -338,6 +462,45 @@ export const clipAudioEffect = z.discriminatedUnion("type", [
|
|
|
338
462
|
* and it is checked here so the limit is the same on every surface.
|
|
339
463
|
*/
|
|
340
464
|
export const MIDI_MAX_NOTES_PER_CLIP = 4096;
|
|
465
|
+
/** Most points one expression curve of one note may carry. */
|
|
466
|
+
export const MIDI_MAX_EXPRESSION_POINTS_PER_NOTE = 256;
|
|
467
|
+
/** Most controller lanes one midi clip may carry. */
|
|
468
|
+
export const MIDI_MAX_CONTROLLER_LANES_PER_CLIP = 32;
|
|
469
|
+
/** Most points one controller lane may carry. */
|
|
470
|
+
export const MIDI_MAX_POINTS_PER_LANE = 4096;
|
|
471
|
+
/** The pitch-bend range of the built-in synth, in semitones. */
|
|
472
|
+
export const MIDI_PITCH_BEND_RANGE_SEMITONES = 2;
|
|
473
|
+
/** One point of a per-note expression curve. `tick` counts from the note's start. */
|
|
474
|
+
export const midiExpressionPoint = z.object({
|
|
475
|
+
tick: z.number().int().min(0),
|
|
476
|
+
value: z.number().finite()
|
|
477
|
+
});
|
|
478
|
+
const expressionCurve = (min, max) => z
|
|
479
|
+
.array(midiExpressionPoint)
|
|
480
|
+
.max(MIDI_MAX_EXPRESSION_POINTS_PER_NOTE)
|
|
481
|
+
.superRefine((points, ctx) => {
|
|
482
|
+
points.forEach((point, i) => {
|
|
483
|
+
if (point.value < min || point.value > max) {
|
|
484
|
+
ctx.addIssue({
|
|
485
|
+
code: "custom",
|
|
486
|
+
path: [i, "value"],
|
|
487
|
+
message: `value must be within ${min}..${max}.`
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
/**
|
|
493
|
+
* Per-note expression. Before the first point the value is neutral, between
|
|
494
|
+
* points it interpolates linearly, after the last point it holds.
|
|
495
|
+
* Pitch is in semitones (-48..48), volume a linear gain (0..4), pan -1..1 and
|
|
496
|
+
* brightness 0..1 (neutral 0.5).
|
|
497
|
+
*/
|
|
498
|
+
export const midiNoteExpression = z.object({
|
|
499
|
+
pitch: expressionCurve(-48, 48).optional(),
|
|
500
|
+
volume: expressionCurve(0, 4).optional(),
|
|
501
|
+
pan: expressionCurve(-1, 1).optional(),
|
|
502
|
+
brightness: expressionCurve(0, 1).optional()
|
|
503
|
+
});
|
|
341
504
|
/**
|
|
342
505
|
* One note inside a midi clip. `startTick`/`durationTick` are ticks (960 per
|
|
343
506
|
* quarter note, `MIDI_PPQ` in `@nodetool-ai/timeline`) measured from the
|
|
@@ -345,12 +508,139 @@ export const MIDI_MAX_NOTES_PER_CLIP = 4096;
|
|
|
345
508
|
* samples are measured from the head of its source. Trimming the window
|
|
346
509
|
* therefore hides notes rather than deleting them.
|
|
347
510
|
*/
|
|
348
|
-
export const midiNote = z
|
|
511
|
+
export const midiNote = z
|
|
512
|
+
.object({
|
|
349
513
|
id: z.string(),
|
|
350
514
|
pitch: z.number().int().min(0).max(127),
|
|
351
515
|
velocity: z.number().int().min(1).max(127),
|
|
352
516
|
startTick: z.number().int().min(0),
|
|
353
|
-
durationTick: z.number().int().positive()
|
|
517
|
+
durationTick: z.number().int().positive(),
|
|
518
|
+
/** A muted note is not played and emits no events. It stays in the
|
|
519
|
+
* document and can still be edited. */
|
|
520
|
+
muted: z.boolean().optional(),
|
|
521
|
+
/** MIDI channel 0..15. Absent means 0. The built-in synth ignores it. */
|
|
522
|
+
channel: z.number().int().min(0).max(15).optional(),
|
|
523
|
+
/** The note-off velocity, 0..127. Absent keeps the existing output. */
|
|
524
|
+
releaseVelocity: z.number().int().min(0).max(127).optional(),
|
|
525
|
+
/** Per-note expression curves, with ticks measured from the note's start. */
|
|
526
|
+
expression: midiNoteExpression.optional()
|
|
527
|
+
})
|
|
528
|
+
.superRefine((note, ctx) => {
|
|
529
|
+
if (!note.expression)
|
|
530
|
+
return;
|
|
531
|
+
for (const [name, points] of Object.entries(note.expression)) {
|
|
532
|
+
if (!points)
|
|
533
|
+
continue;
|
|
534
|
+
for (let i = 0; i < points.length; i++) {
|
|
535
|
+
if (points[i].tick > note.durationTick) {
|
|
536
|
+
ctx.addIssue({
|
|
537
|
+
code: "custom",
|
|
538
|
+
path: ["expression", name, i, "tick"],
|
|
539
|
+
message: `tick must be <= the note's durationTick (${note.durationTick}).`
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
if (i > 0 && points[i].tick < points[i - 1].tick) {
|
|
543
|
+
ctx.addIssue({
|
|
544
|
+
code: "custom",
|
|
545
|
+
path: ["expression", name, i, "tick"],
|
|
546
|
+
message: "points must be sorted by non-decreasing tick."
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
/** One point of a controller lane. `tick` is a clip content tick, like a note's startTick. */
|
|
553
|
+
export const midiControllerPoint = z.object({
|
|
554
|
+
id: z.string(),
|
|
555
|
+
tick: z.number().int().min(0),
|
|
556
|
+
value: z.number().int()
|
|
557
|
+
});
|
|
558
|
+
export const midiControllerKind = z.enum([
|
|
559
|
+
"cc",
|
|
560
|
+
"pitchBend",
|
|
561
|
+
"channelPressure",
|
|
562
|
+
"polyPressure"
|
|
563
|
+
]);
|
|
564
|
+
/**
|
|
565
|
+
* A controller lane of a midi clip: CC, pitch bend, channel pressure or poly
|
|
566
|
+
* pressure. Values are 0..127 except pitch bend, which is -8192..8191.
|
|
567
|
+
*/
|
|
568
|
+
export const midiControllerLane = z
|
|
569
|
+
.object({
|
|
570
|
+
id: z.string(),
|
|
571
|
+
kind: midiControllerKind,
|
|
572
|
+
cc: z.number().int().min(0).max(127).optional(),
|
|
573
|
+
pitch: z.number().int().min(0).max(127).optional(),
|
|
574
|
+
channel: z.number().int().min(0).max(15).optional(),
|
|
575
|
+
interpolation: z.enum(["linear", "step"]).optional(),
|
|
576
|
+
points: z.array(midiControllerPoint).max(MIDI_MAX_POINTS_PER_LANE)
|
|
577
|
+
})
|
|
578
|
+
.superRefine((lane, ctx) => {
|
|
579
|
+
if (lane.kind === "cc" && lane.cc === undefined) {
|
|
580
|
+
ctx.addIssue({ code: "custom", path: ["cc"], message: "cc is required for a cc lane." });
|
|
581
|
+
}
|
|
582
|
+
if (lane.kind !== "cc" && lane.cc !== undefined) {
|
|
583
|
+
ctx.addIssue({ code: "custom", path: ["cc"], message: "cc is only allowed on a cc lane." });
|
|
584
|
+
}
|
|
585
|
+
if (lane.kind === "polyPressure" && lane.pitch === undefined) {
|
|
586
|
+
ctx.addIssue({ code: "custom", path: ["pitch"], message: "pitch is required for a polyPressure lane." });
|
|
587
|
+
}
|
|
588
|
+
if (lane.kind !== "polyPressure" && lane.pitch !== undefined) {
|
|
589
|
+
ctx.addIssue({ code: "custom", path: ["pitch"], message: "pitch is only allowed on a polyPressure lane." });
|
|
590
|
+
}
|
|
591
|
+
const [min, max] = lane.kind === "pitchBend" ? [-8192, 8191] : [0, 127];
|
|
592
|
+
const ids = new Set();
|
|
593
|
+
lane.points.forEach((point, i) => {
|
|
594
|
+
if (point.value < min || point.value > max) {
|
|
595
|
+
ctx.addIssue({
|
|
596
|
+
code: "custom",
|
|
597
|
+
path: ["points", i, "value"],
|
|
598
|
+
message: `value must be within ${min}..${max}.`
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
if (i > 0 && point.tick < lane.points[i - 1].tick) {
|
|
602
|
+
ctx.addIssue({
|
|
603
|
+
code: "custom",
|
|
604
|
+
path: ["points", i, "tick"],
|
|
605
|
+
message: "points must be sorted by non-decreasing tick."
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
if (ids.has(point.id)) {
|
|
609
|
+
ctx.addIssue({
|
|
610
|
+
code: "custom",
|
|
611
|
+
path: ["points", i, "id"],
|
|
612
|
+
message: `duplicate point id "${point.id}".`
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
ids.add(point.id);
|
|
616
|
+
});
|
|
617
|
+
});
|
|
618
|
+
/** The controller lanes of one midi clip: at most 32, one per identity. */
|
|
619
|
+
export const midiControllerLanes = z
|
|
620
|
+
.array(midiControllerLane)
|
|
621
|
+
.max(MIDI_MAX_CONTROLLER_LANES_PER_CLIP)
|
|
622
|
+
.superRefine((lanes, ctx) => {
|
|
623
|
+
const seen = new Set();
|
|
624
|
+
const ids = new Set();
|
|
625
|
+
lanes.forEach((lane, i) => {
|
|
626
|
+
if (ids.has(lane.id)) {
|
|
627
|
+
ctx.addIssue({
|
|
628
|
+
code: "custom",
|
|
629
|
+
path: [i, "id"],
|
|
630
|
+
message: `duplicate lane id "${lane.id}".`
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
ids.add(lane.id);
|
|
634
|
+
const key = `${lane.kind}|${lane.cc ?? ""}|${lane.pitch ?? ""}|${lane.channel ?? 0}`;
|
|
635
|
+
if (seen.has(key)) {
|
|
636
|
+
ctx.addIssue({
|
|
637
|
+
code: "custom",
|
|
638
|
+
path: [i],
|
|
639
|
+
message: "two lanes share the same (kind, cc, pitch, channel)."
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
seen.add(key);
|
|
643
|
+
});
|
|
354
644
|
});
|
|
355
645
|
/** An ADSR envelope, in milliseconds with a 0..1 sustain level. */
|
|
356
646
|
export const midiEnvelope = z.object({
|
|
@@ -360,7 +650,7 @@ export const midiEnvelope = z.object({
|
|
|
360
650
|
releaseMs: z.number().min(0)
|
|
361
651
|
});
|
|
362
652
|
/** The filter shapes the FableSynth-derived voices offer. */
|
|
363
|
-
export const midiFilterType = z.enum(["lp12", "lp24", "bp12", "hp12", "notch"]);
|
|
653
|
+
export const midiFilterType = z.enum(["lp12", "lp24", "bp12", "hp12", "notch", "hp24", "bp24", "none"]);
|
|
364
654
|
/** The tonal wavetables WT-1 and BL-1 play. */
|
|
365
655
|
export const midiWavetableName = z.enum([
|
|
366
656
|
"prime",
|
|
@@ -374,6 +664,11 @@ export const midiWavetableName = z.enum([
|
|
|
374
664
|
export const midiDrumTableName = z.enum(["thud", "crack", "tine", "grit"]);
|
|
375
665
|
/** One of WT-1's two wavetable oscillators. */
|
|
376
666
|
export const wavetableOscillator = z.object({
|
|
667
|
+
on: z.boolean().optional(),
|
|
668
|
+
octave: z.number().int().min(-3).max(3).optional(),
|
|
669
|
+
spread: z.number().min(0).max(1).optional(),
|
|
670
|
+
blend: z.number().min(0).max(1).optional(),
|
|
671
|
+
pan: z.number().min(-1).max(1).optional(),
|
|
377
672
|
table: midiWavetableName,
|
|
378
673
|
/** Morph position across the table's frames, 0..1. */
|
|
379
674
|
position: z.number().min(0).max(1),
|
|
@@ -381,8 +676,8 @@ export const wavetableOscillator = z.object({
|
|
|
381
676
|
semitones: z.number(),
|
|
382
677
|
/** Further offset in cents. */
|
|
383
678
|
fine: z.number(),
|
|
384
|
-
/** Output level, 0..1. */
|
|
385
|
-
level: z.number().min(0).max(1),
|
|
679
|
+
/** Output level, 0..1.2. */
|
|
680
|
+
level: z.number().min(0).max(1.2),
|
|
386
681
|
/** Detuned copies of the oscillator, 1..7. */
|
|
387
682
|
unison: z.number().int().min(1).max(7),
|
|
388
683
|
/** How far the copies spread, 0..1 (1 = ±50 cents). */
|
|
@@ -390,6 +685,10 @@ export const wavetableOscillator = z.object({
|
|
|
390
685
|
});
|
|
391
686
|
/** One DR-1 pad: a tuned one-shot with its own envelope and filter. */
|
|
392
687
|
export const drumPad = z.object({
|
|
688
|
+
pan: z.number().min(-1).max(1).optional(),
|
|
689
|
+
tune: z.number().min(-48).max(48).optional(),
|
|
690
|
+
chokeGroup: z.number().int().min(0).max(4).optional(),
|
|
691
|
+
choke: z.number().int().min(0).max(4).optional(),
|
|
393
692
|
name: z.string(),
|
|
394
693
|
table: z.union([midiWavetableName, midiDrumTableName]),
|
|
395
694
|
position: z.number().min(0).max(1),
|
|
@@ -418,47 +717,76 @@ export const drumPad = z.object({
|
|
|
418
717
|
resonance: z.number().min(0).max(1)
|
|
419
718
|
})
|
|
420
719
|
.nullable(),
|
|
421
|
-
level: z.number().min(0).max(1),
|
|
720
|
+
level: z.number().min(0).max(1.2),
|
|
422
721
|
/** How much velocity scales the level, 0..1. */
|
|
423
722
|
velocityToLevel: z.number().min(0).max(1)
|
|
424
723
|
});
|
|
425
724
|
/**
|
|
426
725
|
* The voice a midi track plays.
|
|
427
726
|
*
|
|
428
|
-
* `subtractive` is the built-in synth.
|
|
727
|
+
* `subtractive` is the built-in synth. Wavetable, bass and drum are ports of the
|
|
429
728
|
* FableSynth instruments (github.com/georgi/fablesynth): WT-1 the wavetable
|
|
430
729
|
* synth, BL-1 the acid bassline, DR-1 the drum machine. `vst` is a VST3
|
|
431
730
|
* instrument the desktop app hosts.
|
|
432
731
|
*/
|
|
732
|
+
export const samplerLoopMode = z.enum(["oneShot", "sustain"]);
|
|
433
733
|
export const samplerZone = z.object({
|
|
434
734
|
id: z.string().min(1),
|
|
435
735
|
name: z.string(),
|
|
436
|
-
assetId: z.string().regex(
|
|
736
|
+
assetId: z.string().regex(/^$|^[a-f0-9]{32}$/, "Use a full audio asset id"),
|
|
737
|
+
mediaPath: z.string().min(1).optional(),
|
|
437
738
|
rootNote: z.number().int().min(0).max(127),
|
|
438
739
|
lowNote: z.number().int().min(0).max(127),
|
|
439
740
|
highNote: z.number().int().min(0).max(127),
|
|
440
|
-
|
|
741
|
+
lowVelocity: z.number().int().min(0).max(127).optional(),
|
|
742
|
+
highVelocity: z.number().int().min(0).max(127).optional(),
|
|
743
|
+
gainDb: z.number().min(-60).max(12),
|
|
744
|
+
pan: z.number().min(-1).max(1).optional(),
|
|
745
|
+
tuneCents: z.number().min(-100).max(100).optional(),
|
|
746
|
+
loopMode: samplerLoopMode.optional(),
|
|
747
|
+
loopStart: z.number().min(0).max(1).optional(),
|
|
748
|
+
loopEnd: z.number().min(0).max(1).optional(),
|
|
749
|
+
loopCrossfadeMs: z.number().min(0).max(500).optional(),
|
|
750
|
+
releaseAssetId: z.string().regex(/^$|^[a-f0-9]{32}$/, "Use a full audio asset id").optional(),
|
|
751
|
+
releaseMediaPath: z.string().min(1).optional(),
|
|
752
|
+
releaseGainDb: z.number().min(-60).max(12).optional()
|
|
441
753
|
}).refine(zone => zone.lowNote <= zone.highNote, {
|
|
442
754
|
message: "The lowest key must not exceed the highest key"
|
|
755
|
+
}).refine(zone => (zone.lowVelocity ?? 0) <= (zone.highVelocity ?? 127), {
|
|
756
|
+
message: "The lowest velocity must not exceed the highest velocity"
|
|
757
|
+
}).refine(zone => (zone.loopStart ?? 0) <= (zone.loopEnd ?? 1), {
|
|
758
|
+
message: "The loop start must not exceed the loop end"
|
|
759
|
+
}).refine(zone => zone.assetId.length > 0 || Boolean(zone.mediaPath), {
|
|
760
|
+
message: "A sampler zone needs an assetId or a mediaPath"
|
|
443
761
|
});
|
|
444
762
|
export const samplerMidiInstrument = z.object({
|
|
445
763
|
type: z.literal("sampler"),
|
|
446
|
-
zones: z.array(samplerZone).max(
|
|
764
|
+
zones: z.array(samplerZone).max(64),
|
|
447
765
|
oneShot: z.boolean(),
|
|
448
766
|
attackMs: z.number().min(0).max(10000),
|
|
767
|
+
decayMs: z.number().min(0).max(10000).optional(),
|
|
768
|
+
sustain: z.number().min(0).max(1).optional(),
|
|
449
769
|
releaseMs: z.number().min(0).max(30000),
|
|
770
|
+
velocityCurve: z.number().min(-1).max(1).optional(),
|
|
771
|
+
glideMs: z.number().min(0).max(2000).optional(),
|
|
772
|
+
voiceLimit: z.number().int().min(1).max(64).optional(),
|
|
773
|
+
pitchBendRange: z.number().min(1).max(24).optional(),
|
|
450
774
|
gainDb: z.number().min(-60).max(12)
|
|
451
775
|
});
|
|
452
|
-
/**
|
|
453
|
-
export const
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
776
|
+
/** Native JUCE devices shipped by the desktop instrument registry. */
|
|
777
|
+
export const JUCE_DEVICE_IDS = [
|
|
778
|
+
"prophetx", "rhodex", "hammondx", "grainy", "dxxx", "dreadx",
|
|
779
|
+
"junox", "guitarx", "choirx", "moogx", "bassx", "drumx", "impactx",
|
|
780
|
+
"physix", "worldx", "physix-piano", "physix-strings", "physix-brass",
|
|
781
|
+
"physix-percussion", "physix-plucked"
|
|
782
|
+
];
|
|
783
|
+
export const juceMidiInstrument = z.object({
|
|
784
|
+
type: z.literal("juce"),
|
|
785
|
+
device: z.enum(JUCE_DEVICE_IDS, { error: "Unknown JUCE device. Choose a shipped JUCE device id." }),
|
|
786
|
+
state: z.string().max(VST_STATE_MAX_CHARS).regex(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/, "JUCE state must be base64"),
|
|
787
|
+
gainDb: z.number().min(-120).max(24)
|
|
458
788
|
});
|
|
459
|
-
/**
|
|
460
|
-
export const VST_STATE_MAX_CHARS = 8_000_000;
|
|
461
|
-
/** A VST3 instrument hosted by the desktop app. Silent wherever no host runs. */
|
|
789
|
+
/** A VST3/AU instrument hosted by the desktop app. Silent wherever no host runs. */
|
|
462
790
|
export const vstMidiInstrument = z.object({
|
|
463
791
|
type: z.literal("vst"),
|
|
464
792
|
plugin: vstPluginRef.nullable(),
|
|
@@ -470,8 +798,101 @@ export const vstMidiInstrument = z.object({
|
|
|
470
798
|
* id. The live device plays them; the server render reads only the core.
|
|
471
799
|
*/
|
|
472
800
|
const fableParams = z.record(z.string(), z.number());
|
|
801
|
+
/** Physically modeled percussion/mallet instrument schema (ported from RipplerX, MOD1). */
|
|
802
|
+
export const modalModelEnum = z.enum([
|
|
803
|
+
"string", "beam", "squared", "membrane", "plate", "drumhead",
|
|
804
|
+
"marimba", "openTube", "closedTube", "marimba2", "bell", "djembe"
|
|
805
|
+
]);
|
|
806
|
+
export const modalCouplingEnum = z.enum(["parallel", "serial"]);
|
|
807
|
+
export const modalNoiseFilterModeEnum = z.enum(["lp", "bp", "hp"]);
|
|
808
|
+
export const modalPresetIdEnum = z.enum([
|
|
809
|
+
"modal-marimba", "modal-concert-marimba", "modal-vibes", "modal-tubular-bells",
|
|
810
|
+
"modal-church-bell", "modal-kalimba", "modal-steel-drum", "modal-concert-tom",
|
|
811
|
+
"modal-djembe", "modal-plucked-harp", "modal-crystal-glass", "modal-wood-block",
|
|
812
|
+
"modal-open-tube", "modal-closed-tube"
|
|
813
|
+
]);
|
|
814
|
+
export const modalMidiInstrument = z.object({
|
|
815
|
+
type: z.literal("modal"),
|
|
816
|
+
preset: modalPresetIdEnum.optional(),
|
|
817
|
+
malletMix: z.number().min(0).max(1).optional(),
|
|
818
|
+
malletRes: z.number().min(0).max(1).optional(),
|
|
819
|
+
malletStiff: z.number().min(100).max(5000).optional(),
|
|
820
|
+
velMalletMix: z.number().min(-1).max(1).optional(),
|
|
821
|
+
velMalletRes: z.number().min(-1).max(1).optional(),
|
|
822
|
+
velMalletStiff: z.number().min(-1).max(1).optional(),
|
|
823
|
+
noiseOsc: z.number().min(0).max(1).optional(),
|
|
824
|
+
noiseMix: z.number().min(0).max(1).optional(),
|
|
825
|
+
noiseRes: z.number().min(0).max(1).optional(),
|
|
826
|
+
noiseFilterMode: modalNoiseFilterModeEnum.optional(),
|
|
827
|
+
noiseFilterFreq: z.number().min(20).max(20000).optional(),
|
|
828
|
+
noiseFilterQ: z.number().min(0.707).max(4).optional(),
|
|
829
|
+
noiseAttackMs: z.number().min(1).max(20000).optional(),
|
|
830
|
+
noiseDecayMs: z.number().min(1).max(20000).optional(),
|
|
831
|
+
noiseSustain: z.number().min(0).max(1).optional(),
|
|
832
|
+
noiseReleaseMs: z.number().min(1).max(20000).optional(),
|
|
833
|
+
noiseAttackTension: z.number().min(-1).max(1).optional(),
|
|
834
|
+
noiseDecayTension: z.number().min(-1).max(1).optional(),
|
|
835
|
+
noiseReleaseTension: z.number().min(-1).max(1).optional(),
|
|
836
|
+
velNoiseMix: z.number().min(-1).max(1).optional(),
|
|
837
|
+
velNoiseRes: z.number().min(-1).max(1).optional(),
|
|
838
|
+
velNoiseFreq: z.number().min(-1).max(1).optional(),
|
|
839
|
+
velNoiseQ: z.number().min(-1).max(1).optional(),
|
|
840
|
+
velNoiseAttack: z.number().min(-1).max(1).optional(),
|
|
841
|
+
velNoiseDecay: z.number().min(-1).max(1).optional(),
|
|
842
|
+
velNoiseSustain: z.number().min(-1).max(1).optional(),
|
|
843
|
+
velNoiseRelease: z.number().min(-1).max(1).optional(),
|
|
844
|
+
aOn: z.boolean().optional(),
|
|
845
|
+
aModel: modalModelEnum.optional(),
|
|
846
|
+
aPartials: z.number().int().min(1).max(64).optional(),
|
|
847
|
+
aDecay: z.number().min(0.01).max(100).optional(),
|
|
848
|
+
aDamp: z.number().min(-1).max(1).optional(),
|
|
849
|
+
aTone: z.number().min(-1).max(1).optional(),
|
|
850
|
+
aHit: z.number().min(0.02).max(0.5).optional(),
|
|
851
|
+
aRelease: z.number().min(0.001).max(1).optional(),
|
|
852
|
+
aInharm: z.number().min(0).max(1).optional(),
|
|
853
|
+
aRatio: z.number().min(0.1).max(10).optional(),
|
|
854
|
+
aCut: z.number().min(-1).max(1).optional(),
|
|
855
|
+
aRadius: z.number().min(0).max(1).optional(),
|
|
856
|
+
aCoarse: z.number().min(-48).max(48).optional(),
|
|
857
|
+
aFine: z.number().min(-99).max(99).optional(),
|
|
858
|
+
velADecay: z.number().min(-1).max(1).optional(),
|
|
859
|
+
velAHit: z.number().min(-1).max(1).optional(),
|
|
860
|
+
velAInharm: z.number().min(-1).max(1).optional(),
|
|
861
|
+
velADamp: z.number().min(-1).max(1).optional(),
|
|
862
|
+
velATone: z.number().min(-1).max(1).optional(),
|
|
863
|
+
bOn: z.boolean().optional(),
|
|
864
|
+
bModel: modalModelEnum.optional(),
|
|
865
|
+
bPartials: z.number().int().min(1).max(64).optional(),
|
|
866
|
+
bDecay: z.number().min(0.01).max(100).optional(),
|
|
867
|
+
bDamp: z.number().min(-1).max(1).optional(),
|
|
868
|
+
bTone: z.number().min(-1).max(1).optional(),
|
|
869
|
+
bHit: z.number().min(0.02).max(0.5).optional(),
|
|
870
|
+
bRelease: z.number().min(0.001).max(1).optional(),
|
|
871
|
+
bInharm: z.number().min(0).max(1).optional(),
|
|
872
|
+
bRatio: z.number().min(0.1).max(10).optional(),
|
|
873
|
+
bCut: z.number().min(-1).max(1).optional(),
|
|
874
|
+
bRadius: z.number().min(0).max(1).optional(),
|
|
875
|
+
bCoarse: z.number().min(-48).max(48).optional(),
|
|
876
|
+
bFine: z.number().min(-99).max(99).optional(),
|
|
877
|
+
velBDecay: z.number().min(-1).max(1).optional(),
|
|
878
|
+
velBHit: z.number().min(-1).max(1).optional(),
|
|
879
|
+
velBInharm: z.number().min(-1).max(1).optional(),
|
|
880
|
+
velBDamp: z.number().min(-1).max(1).optional(),
|
|
881
|
+
velBTone: z.number().min(-1).max(1).optional(),
|
|
882
|
+
coupling: modalCouplingEnum.optional(),
|
|
883
|
+
abMix: z.number().min(0).max(1).optional(),
|
|
884
|
+
abSplit: z.number().min(0.01).max(1).optional(),
|
|
885
|
+
gainDb: z.number().min(-24).max(24).optional(),
|
|
886
|
+
pitchBendRange: z.number().int().min(1).max(24).optional(),
|
|
887
|
+
stereoizer: z.boolean().optional(),
|
|
888
|
+
polyphony: z.number().int().min(1).max(16).optional(),
|
|
889
|
+
reuseVoices: z.boolean().optional(),
|
|
890
|
+
fadeoutRepeats: z.boolean().optional()
|
|
891
|
+
});
|
|
473
892
|
export const midiInstrument = z.discriminatedUnion("type", [
|
|
893
|
+
juceMidiInstrument,
|
|
474
894
|
samplerMidiInstrument,
|
|
895
|
+
modalMidiInstrument,
|
|
475
896
|
vstMidiInstrument,
|
|
476
897
|
z.object({
|
|
477
898
|
type: z.literal("subtractive"),
|
|
@@ -493,13 +914,39 @@ export const midiInstrument = z.discriminatedUnion("type", [
|
|
|
493
914
|
}),
|
|
494
915
|
z.object({
|
|
495
916
|
type: z.literal("wavetable"),
|
|
917
|
+
preset: z.string().optional(),
|
|
918
|
+
subOn: z.boolean().optional(),
|
|
919
|
+
subShape: z.enum(["sine", "square"]).optional(),
|
|
920
|
+
noiseOn: z.boolean().optional(),
|
|
921
|
+
noiseType: z.enum(["white", "pink"]).optional(),
|
|
922
|
+
filterOn: z.boolean().optional(),
|
|
923
|
+
velToAmp: z.number().min(0).max(1).optional(),
|
|
924
|
+
velToCutoff: z.number().min(-1).max(1).optional(),
|
|
925
|
+
mono: z.boolean().optional(),
|
|
926
|
+
legato: z.boolean().optional(),
|
|
927
|
+
glideMs: z.number().min(0).max(2000).optional(),
|
|
928
|
+
pitchBendRange: z.number().min(0).max(24).optional(),
|
|
929
|
+
modWheel: z.number().min(0).max(1).optional(),
|
|
930
|
+
masterVolume: z.number().min(0).max(1.5).optional(),
|
|
931
|
+
lfo: z.object({
|
|
932
|
+
shape: z.enum(["sine", "tri", "saw", "square", "sh"]).optional(),
|
|
933
|
+
rateHz: z.number().positive().optional(),
|
|
934
|
+
tempoSync: z.boolean().optional(),
|
|
935
|
+
syncDiv: z.number().int().min(0).optional(),
|
|
936
|
+
riseSec: z.number().min(0).optional(),
|
|
937
|
+
phase: z.number().min(0).max(1).optional(),
|
|
938
|
+
retrig: z.boolean().optional(),
|
|
939
|
+
toPitch: z.number().min(-1).max(1).optional(),
|
|
940
|
+
toPos: z.number().min(-1).max(1).optional(),
|
|
941
|
+
toCutoff: z.number().min(-1).max(1).optional()
|
|
942
|
+
}).optional(),
|
|
496
943
|
fableParams: fableParams.optional(),
|
|
497
944
|
oscA: wavetableOscillator,
|
|
498
945
|
oscB: wavetableOscillator,
|
|
499
946
|
/** Sine sub-oscillator level, 0..1. */
|
|
500
947
|
subLevel: z.number().min(0).max(1),
|
|
501
|
-
/** Sub octave below the note: -1 or
|
|
502
|
-
subOctave: z.number().int().min(-2).max(
|
|
948
|
+
/** Sub octave below the note: -2, -1, or 0. */
|
|
949
|
+
subOctave: z.number().int().min(-2).max(0),
|
|
503
950
|
/** White noise level, 0..1. */
|
|
504
951
|
noiseLevel: z.number().min(0).max(1),
|
|
505
952
|
filterType: midiFilterType,
|
|
@@ -518,6 +965,18 @@ export const midiInstrument = z.discriminatedUnion("type", [
|
|
|
518
965
|
}),
|
|
519
966
|
z.object({
|
|
520
967
|
type: z.literal("bass"),
|
|
968
|
+
preset: z.string().optional(),
|
|
969
|
+
waveform: z.enum(["saw", "square", "triangle", "sine"]).optional(),
|
|
970
|
+
pulseWidth: z.number().optional(),
|
|
971
|
+
fine: z.number().optional(),
|
|
972
|
+
oscLevel: z.number().optional(),
|
|
973
|
+
hardSync: z.boolean().optional(),
|
|
974
|
+
syncSemitones: z.number().optional(),
|
|
975
|
+
analogDrift: z.number().optional(),
|
|
976
|
+
filterSustain: z.number().min(0).max(1).optional(),
|
|
977
|
+
filterReleaseMs: z.number().min(0).optional(),
|
|
978
|
+
retrigger: z.boolean().optional(),
|
|
979
|
+
saturation: z.number().optional(),
|
|
521
980
|
fableParams: fableParams.optional(),
|
|
522
981
|
table: midiWavetableName,
|
|
523
982
|
position: z.number().min(0).max(1),
|
|
@@ -547,6 +1006,10 @@ export const midiInstrument = z.discriminatedUnion("type", [
|
|
|
547
1006
|
}),
|
|
548
1007
|
z.object({
|
|
549
1008
|
type: z.literal("drum"),
|
|
1009
|
+
kit: z.enum(["808", "uzu"]).optional(),
|
|
1010
|
+
preset: z.string().optional(),
|
|
1011
|
+
noteMap: z.enum(["gm", "sequential", "dr1"]).optional(),
|
|
1012
|
+
voiceLimit: z.number().int().positive().optional(),
|
|
550
1013
|
fableParams: fableParams.optional(),
|
|
551
1014
|
/** The MIDI note pad 0 answers to. Pads run `baseNote`..`baseNote + 15`. */
|
|
552
1015
|
baseNote: z.number().int().min(0).max(127),
|
|
@@ -554,20 +1017,6 @@ export const midiInstrument = z.discriminatedUnion("type", [
|
|
|
554
1017
|
gainDb: z.number()
|
|
555
1018
|
})
|
|
556
1019
|
]);
|
|
557
|
-
/**
|
|
558
|
-
* Document-level constant tempo. Milliseconds stay the stored master clock —
|
|
559
|
-
* ticks are read against `bpm` — so changing the tempo rescales every midi
|
|
560
|
-
* clip's timing around `offsetMs` and leaves every other clip where it is.
|
|
561
|
-
*/
|
|
562
|
-
export const timelineTempo = z.object({
|
|
563
|
-
bpm: z.number().positive(),
|
|
564
|
-
/** Where beat one sits on the timeline, in ms. */
|
|
565
|
-
offsetMs: z.number().min(0),
|
|
566
|
-
timeSignature: z.object({
|
|
567
|
-
beatsPerBar: z.number().int().positive(),
|
|
568
|
-
beatUnit: z.number().int().positive()
|
|
569
|
-
})
|
|
570
|
-
});
|
|
571
1020
|
/** `ChordQuality` in `@nodetool-ai/timeline`: the FableSynth chord qualities. */
|
|
572
1021
|
export const chordQuality = z.enum([
|
|
573
1022
|
"maj", "min", "dim", "aug", "sus2", "sus4", "five", "six", "m6", "dom7",
|
|
@@ -614,6 +1063,226 @@ export const clipHarmony = z.object({
|
|
|
614
1063
|
.optional(),
|
|
615
1064
|
scaleKey: z.number().int().min(0).max(11).optional()
|
|
616
1065
|
});
|
|
1066
|
+
// ── Step Sequencer (SQ) ─────────────────────────────────────────────────────
|
|
1067
|
+
export const STEP_PATTERN_MAX_ROWS = 128;
|
|
1068
|
+
export const STEP_PATTERN_MAX_STEPS = 64;
|
|
1069
|
+
export const STEP_RATE_VALUES = [
|
|
1070
|
+
"4", "2", "1", "1/2", "1/4", "1/8", "1/16", "1/32", "1/64",
|
|
1071
|
+
"1T", "2T", "4T", "8T", "16T", "32T",
|
|
1072
|
+
"1D", "2D", "4D", "8D", "16D", "32D", "64D"
|
|
1073
|
+
];
|
|
1074
|
+
export const stepRate = z.enum(STEP_RATE_VALUES);
|
|
1075
|
+
export const STEP_PLAYBACK_MODES = [
|
|
1076
|
+
"forward",
|
|
1077
|
+
"backward",
|
|
1078
|
+
"pingPong",
|
|
1079
|
+
"pendulum",
|
|
1080
|
+
"wander",
|
|
1081
|
+
"shuffle",
|
|
1082
|
+
"random"
|
|
1083
|
+
];
|
|
1084
|
+
export const stepPlaybackMode = z.enum(STEP_PLAYBACK_MODES);
|
|
1085
|
+
export const STEP_EDIT_MODES = [
|
|
1086
|
+
"onOff",
|
|
1087
|
+
"velocity",
|
|
1088
|
+
"value",
|
|
1089
|
+
"gate",
|
|
1090
|
+
"tie",
|
|
1091
|
+
"note",
|
|
1092
|
+
"octave",
|
|
1093
|
+
"repeat",
|
|
1094
|
+
"chance",
|
|
1095
|
+
"offset",
|
|
1096
|
+
"stepRate",
|
|
1097
|
+
"skip",
|
|
1098
|
+
"loop"
|
|
1099
|
+
];
|
|
1100
|
+
export const stepEditMode = z.enum(STEP_EDIT_MODES);
|
|
1101
|
+
export const stepAutomationMode = z.enum(["latch", "slide"]);
|
|
1102
|
+
export const stepSwingDivision = z.enum(["1/8", "1/16"]);
|
|
1103
|
+
export const stepPitchSource = z.enum(["off", "key", "chords"]);
|
|
1104
|
+
export const STEP_ROW_SORTS = [
|
|
1105
|
+
"none",
|
|
1106
|
+
"typeAsc",
|
|
1107
|
+
"typeDesc",
|
|
1108
|
+
"typeAndNoteAsc",
|
|
1109
|
+
"typeAndNoteDesc",
|
|
1110
|
+
"typeAndNameAsc",
|
|
1111
|
+
"typeAndNameDesc",
|
|
1112
|
+
"typeAndKitPadAsc",
|
|
1113
|
+
"typeAndKitPadDesc"
|
|
1114
|
+
];
|
|
1115
|
+
export const stepRowSort = z.enum(STEP_ROW_SORTS);
|
|
1116
|
+
export const STEP_SCALE_IDS = [
|
|
1117
|
+
"chromatic", "major", "minor", "dorian", "mixolydian", "phrygian", "lydian",
|
|
1118
|
+
"locrian", "harmMinor", "melMinor", "phrygDom", "lydDom", "locrian2",
|
|
1119
|
+
"altered", "wholeTone", "dimHW", "dimWH", "majPent", "minPent", "blues"
|
|
1120
|
+
];
|
|
1121
|
+
export const stepScaleId = z.enum(STEP_SCALE_IDS);
|
|
1122
|
+
export const stepKey = z.object({
|
|
1123
|
+
tonic: z.number().int().min(0).max(11),
|
|
1124
|
+
mode: z.enum(["major", "minor"])
|
|
1125
|
+
});
|
|
1126
|
+
export const STEP_DEGREES = [
|
|
1127
|
+
"root", "2nd", "3rd", "4th", "5th", "6th", "7th"
|
|
1128
|
+
];
|
|
1129
|
+
export const stepDegree = z.enum(STEP_DEGREES);
|
|
1130
|
+
export const stepAutomationTarget = z.discriminatedUnion("kind", [
|
|
1131
|
+
z.object({ kind: z.literal("cc"), cc: z.number().int().min(0).max(127) }),
|
|
1132
|
+
z.object({ kind: z.literal("pitchBend") }),
|
|
1133
|
+
z.object({ kind: z.literal("channelPressure") }),
|
|
1134
|
+
z.object({ kind: z.literal("device"), deviceId: z.string().min(1), param: z.string().min(1) })
|
|
1135
|
+
]);
|
|
1136
|
+
export const stepRowAssignment = z.discriminatedUnion("type", [
|
|
1137
|
+
z.object({ type: z.literal("note"), pitch: z.number().int().min(0).max(127) }),
|
|
1138
|
+
z.object({ type: z.literal("melodic"), pitch: z.number().int().min(0).max(127) }),
|
|
1139
|
+
z.object({ type: z.literal("kit"), pad: z.number().int().min(0).max(15) }),
|
|
1140
|
+
z.object({ type: z.literal("degree"), degree: stepDegree, octave: z.number().int().min(-2).max(8) }),
|
|
1141
|
+
z.object({ type: z.literal("automation"), target: stepAutomationTarget })
|
|
1142
|
+
]);
|
|
1143
|
+
export const stepCondition = z.discriminatedUnion("type", [
|
|
1144
|
+
z.object({ type: z.literal("always") }),
|
|
1145
|
+
z
|
|
1146
|
+
.object({
|
|
1147
|
+
type: z.literal("recurrence"),
|
|
1148
|
+
iteration: z.number().int().min(1).max(16),
|
|
1149
|
+
cycles: z.number().int().min(2).max(16)
|
|
1150
|
+
})
|
|
1151
|
+
.refine((c) => c.iteration <= c.cycles, {
|
|
1152
|
+
message: "iteration must be <= cycles."
|
|
1153
|
+
}),
|
|
1154
|
+
z.object({ type: z.literal("first") }),
|
|
1155
|
+
z.object({ type: z.literal("last") })
|
|
1156
|
+
]);
|
|
1157
|
+
export const stepCell = z.object({
|
|
1158
|
+
on: z.boolean().optional(),
|
|
1159
|
+
velocity: z.number().int().min(1).max(127).optional(),
|
|
1160
|
+
gate: z.number().int().min(1).max(100).optional(),
|
|
1161
|
+
tie: z.boolean().optional(),
|
|
1162
|
+
note: z.number().int().min(-12).max(12).optional(),
|
|
1163
|
+
octave: z.number().int().min(-2).max(8).optional(),
|
|
1164
|
+
repeat: z.number().int().min(1).max(16).optional(),
|
|
1165
|
+
chance: z.number().int().min(0).max(100).optional(),
|
|
1166
|
+
offset: z.number().int().min(-50).max(50).optional(),
|
|
1167
|
+
stepRate: stepRate.optional(),
|
|
1168
|
+
skip: z.boolean().optional(),
|
|
1169
|
+
value: z.number().finite().optional(),
|
|
1170
|
+
condition: stepCondition.optional(),
|
|
1171
|
+
midiChannel: z.number().int().min(1).max(16).optional(),
|
|
1172
|
+
articulation: z.number().int().min(0).max(255).optional(),
|
|
1173
|
+
velocityRamp: z.number().int().min(-100).max(100).optional(),
|
|
1174
|
+
velocityCurve: z.number().int().min(-100).max(100).optional(),
|
|
1175
|
+
distribution: z.number().int().min(-100).max(100).optional()
|
|
1176
|
+
});
|
|
1177
|
+
export const stepRow = z
|
|
1178
|
+
.object({
|
|
1179
|
+
id: z.string().min(1),
|
|
1180
|
+
assignment: stepRowAssignment,
|
|
1181
|
+
name: z.string().optional(),
|
|
1182
|
+
color: z.string().optional(),
|
|
1183
|
+
mute: z.boolean(),
|
|
1184
|
+
solo: z.boolean(),
|
|
1185
|
+
lengthSteps: z.number().int().min(1).max(STEP_PATTERN_MAX_STEPS),
|
|
1186
|
+
loopStart: z.number().int().min(0).max(STEP_PATTERN_MAX_STEPS - 1),
|
|
1187
|
+
loopEnd: z.number().int().min(1).max(STEP_PATTERN_MAX_STEPS),
|
|
1188
|
+
stepRate,
|
|
1189
|
+
playback: stepPlaybackMode,
|
|
1190
|
+
midiChannel: z.number().int().min(1).max(16),
|
|
1191
|
+
automationMode: stepAutomationMode,
|
|
1192
|
+
subrows: z.array(stepEditMode),
|
|
1193
|
+
subrowsExpanded: z.boolean().optional(),
|
|
1194
|
+
steps: z.array(stepCell).min(1).max(STEP_PATTERN_MAX_STEPS)
|
|
1195
|
+
})
|
|
1196
|
+
.superRefine((row, ctx) => {
|
|
1197
|
+
if (row.steps.length !== row.lengthSteps) {
|
|
1198
|
+
ctx.addIssue({
|
|
1199
|
+
code: "custom",
|
|
1200
|
+
path: ["steps"],
|
|
1201
|
+
message: `steps length (${row.steps.length}) must equal lengthSteps (${row.lengthSteps}).`
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
if (row.loopStart >= row.loopEnd || row.loopEnd > row.lengthSteps) {
|
|
1205
|
+
ctx.addIssue({
|
|
1206
|
+
code: "custom",
|
|
1207
|
+
path: ["loopEnd"],
|
|
1208
|
+
message: `loop range [${row.loopStart}, ${row.loopEnd}) is outside 0..${row.lengthSteps}.`
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
if (new Set(row.subrows).size !== row.subrows.length) {
|
|
1212
|
+
ctx.addIssue({
|
|
1213
|
+
code: "custom",
|
|
1214
|
+
path: ["subrows"],
|
|
1215
|
+
message: "Two subrows of one row cannot share a mode."
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
export const stepPattern = z.object({
|
|
1220
|
+
version: z.literal(1),
|
|
1221
|
+
seed: z.number().int().min(0).max(0xffffffff),
|
|
1222
|
+
lengthSteps: z.number().int().min(1).max(STEP_PATTERN_MAX_STEPS),
|
|
1223
|
+
stepRate,
|
|
1224
|
+
playback: stepPlaybackMode,
|
|
1225
|
+
legato: z.boolean(),
|
|
1226
|
+
swing: z.number().int().min(0).max(100),
|
|
1227
|
+
swingDivision: stepSwingDivision,
|
|
1228
|
+
pitchSource: stepPitchSource,
|
|
1229
|
+
key: stepKey.optional(),
|
|
1230
|
+
scale: stepScaleId,
|
|
1231
|
+
noTranspose: z.boolean(),
|
|
1232
|
+
scaleQuantize: z.boolean(),
|
|
1233
|
+
midiChannel: z.number().int().min(1).max(16),
|
|
1234
|
+
automationMode: stepAutomationMode,
|
|
1235
|
+
mono: z.boolean(),
|
|
1236
|
+
name: z.string(),
|
|
1237
|
+
rowSort: stepRowSort.optional(),
|
|
1238
|
+
rows: z.array(stepRow).max(STEP_PATTERN_MAX_ROWS)
|
|
1239
|
+
});
|
|
1240
|
+
/**
|
|
1241
|
+
* Stored JSON envelope for a user-saved Step Sequencer pattern or template
|
|
1242
|
+
* asset (`application/x-nodetool-step-pattern`, SQ43, SQ44, D92).
|
|
1243
|
+
*/
|
|
1244
|
+
export const stepPatternAssetEnvelope = z.object({
|
|
1245
|
+
version: z.literal(1),
|
|
1246
|
+
name: z.string().min(1),
|
|
1247
|
+
kind: z.enum(["pattern", "template"]),
|
|
1248
|
+
category: z.string().optional(),
|
|
1249
|
+
tags: z.array(z.string()).optional(),
|
|
1250
|
+
folder: z.string().optional(),
|
|
1251
|
+
pattern: stepPattern,
|
|
1252
|
+
instrument: midiInstrument.optional(),
|
|
1253
|
+
instrumentPreset: z.string().min(1).optional()
|
|
1254
|
+
});
|
|
1255
|
+
export const stepPatternMoveSummary = z.object({
|
|
1256
|
+
id: z.string(),
|
|
1257
|
+
name: z.string(),
|
|
1258
|
+
folder: z.string()
|
|
1259
|
+
});
|
|
1260
|
+
export const renameStepPatternFolderInput = z.object({
|
|
1261
|
+
folder: z.string().min(1),
|
|
1262
|
+
newName: z.string().min(1),
|
|
1263
|
+
kind: z.enum(["pattern", "template"]).optional()
|
|
1264
|
+
});
|
|
1265
|
+
export const renameStepPatternFolderOutput = z.object({
|
|
1266
|
+
id: z.string().optional(),
|
|
1267
|
+
name: z.string(),
|
|
1268
|
+
kind: z.enum(["pattern", "template"]),
|
|
1269
|
+
previousFolder: z.string(),
|
|
1270
|
+
folder: z.string(),
|
|
1271
|
+
parentFolder: z.string(),
|
|
1272
|
+
movedPatternCount: z.number().int().nonnegative(),
|
|
1273
|
+
movedPatterns: z.array(stepPatternMoveSummary)
|
|
1274
|
+
});
|
|
1275
|
+
export const deleteStepPatternFolderInput = z.object({
|
|
1276
|
+
folder: z.string().min(1),
|
|
1277
|
+
kind: z.enum(["pattern", "template"]).optional()
|
|
1278
|
+
});
|
|
1279
|
+
export const deleteStepPatternFolderOutput = z.object({
|
|
1280
|
+
kind: z.enum(["pattern", "template"]),
|
|
1281
|
+
deletedFolder: z.string(),
|
|
1282
|
+
parentFolder: z.string(),
|
|
1283
|
+
movedPatternCount: z.number().int().nonnegative(),
|
|
1284
|
+
movedPatterns: z.array(stepPatternMoveSummary)
|
|
1285
|
+
});
|
|
617
1286
|
/** How many lanes one track may hold, and points one lane. */
|
|
618
1287
|
export const MAX_AUTOMATION_LANES_PER_TRACK = 256;
|
|
619
1288
|
export const MAX_AUTOMATION_POINTS_PER_LANE = 10000;
|
|
@@ -658,12 +1327,20 @@ export const timelineTrack = z.object({
|
|
|
658
1327
|
* every PATCH, so the progression disappears after one save. */
|
|
659
1328
|
chords: z.array(timelineChord).max(MAX_CHORDS_PER_TRACK).optional(),
|
|
660
1329
|
/** Automation lanes. Without this field Zod strips them on every PATCH. */
|
|
661
|
-
automation: z.array(automationLane).max(MAX_AUTOMATION_LANES_PER_TRACK).optional()
|
|
1330
|
+
automation: z.array(automationLane).max(MAX_AUTOMATION_LANES_PER_TRACK).optional(),
|
|
1331
|
+
/** Automation mode. Without this field Zod strips it on every PATCH. */
|
|
1332
|
+
automationMode: z.enum(["off", "read", "touch", "latch", "write"]).optional(),
|
|
1333
|
+
/** The stem this track holds in a music project. */
|
|
1334
|
+
musicRole: musicRole.optional(),
|
|
1335
|
+
/** Default Step Sequencer template for new pattern regions on this track (SQ45). */
|
|
1336
|
+
stepTemplate: stepPattern.optional()
|
|
662
1337
|
});
|
|
663
1338
|
/** `TimelineMasterChannel` in `@nodetool-ai/timeline`. */
|
|
664
1339
|
export const timelineMasterChannel = z.object({
|
|
665
1340
|
volumeDb: z.number().min(-120).max(24),
|
|
666
|
-
|
|
1341
|
+
pan: z.number().min(-1).max(1).optional(),
|
|
1342
|
+
effects: z.array(trackEffect).optional(),
|
|
1343
|
+
limiter: z.boolean().optional()
|
|
667
1344
|
});
|
|
668
1345
|
export const timelineTrackFolder = z.object({
|
|
669
1346
|
id: z.string(),
|
|
@@ -1580,7 +2257,8 @@ export const clipModel3DStyle = z.object({
|
|
|
1580
2257
|
.object({
|
|
1581
2258
|
assetId: z.string(),
|
|
1582
2259
|
dependencyHash: z.string(),
|
|
1583
|
-
pass: z.enum(["clay", "depth", "normal"])
|
|
2260
|
+
pass: z.enum(["clay", "depth", "normal"]),
|
|
2261
|
+
assetRevision: z.string().optional()
|
|
1584
2262
|
})
|
|
1585
2263
|
.optional()
|
|
1586
2264
|
});
|
|
@@ -1765,6 +2443,17 @@ export const timelineClip = z.object({
|
|
|
1765
2443
|
durationMs: z.number(),
|
|
1766
2444
|
inPointMs: z.number().optional(),
|
|
1767
2445
|
outPointMs: z.number().optional(),
|
|
2446
|
+
/** Region loop: the window `[inPointMs, inPointMs + loopLengthMs)` repeats until `durationMs`. */
|
|
2447
|
+
loopLengthMs: z.number().positive().optional(),
|
|
2448
|
+
/** Non-destructive midi region parameters (CE6). */
|
|
2449
|
+
transpose: z.number().int().min(-48).max(48).optional(),
|
|
2450
|
+
velocityOffset: z.number().int().min(-127).max(127).optional(),
|
|
2451
|
+
quantize: z
|
|
2452
|
+
.object({
|
|
2453
|
+
grid: z.enum(["1/4", "1/8", "1/16", "1/32", "1/8T", "1/16T"]),
|
|
2454
|
+
strength: z.number().min(0).max(100)
|
|
2455
|
+
})
|
|
2456
|
+
.optional(),
|
|
1768
2457
|
/** `"group"` carries no media: it is a transform parent children name with
|
|
1769
2458
|
* `parentId`. `"adjustment"` carries none either: its effects treat the
|
|
1770
2459
|
* composite of the layers drawn beneath it. Without them here Zod fails a
|
|
@@ -1963,9 +2652,32 @@ export const timelineClip = z.object({
|
|
|
1963
2652
|
/** Notes carried inline by a `midi` clip, in content ticks. Without this
|
|
1964
2653
|
* field Zod strips it on every PATCH, so autosave erases the performance. */
|
|
1965
2654
|
notes: z.array(midiNote).max(MIDI_MAX_NOTES_PER_CLIP).optional(),
|
|
2655
|
+
/** Controller lanes of a `midi` clip. Stripped on PATCH without this field. */
|
|
2656
|
+
controllers: midiControllerLanes.optional(),
|
|
1966
2657
|
/** Arp, chord comping or scale snapping of a `midi` clip. Without this
|
|
1967
2658
|
* field Zod strips it on every PATCH. */
|
|
1968
|
-
harmony: clipHarmony.optional()
|
|
2659
|
+
harmony: clipHarmony.optional(),
|
|
2660
|
+
/** Step Sequencer pattern (SQ1, D71). Mutually exclusive with stored `notes`. */
|
|
2661
|
+
pattern: stepPattern.optional(),
|
|
2662
|
+
/** Phase offset in content ticks for split/left-trimmed pattern regions (D87). */
|
|
2663
|
+
patternPhaseTicks: z.number().int().min(0).optional(),
|
|
2664
|
+
/** Per-row cycle state preserved across unrolled loop repeats (SQ13, SQ25). */
|
|
2665
|
+
patternRowCycles: z
|
|
2666
|
+
.record(z.string(), z.object({
|
|
2667
|
+
cycleOffset: z.number().int().min(0),
|
|
2668
|
+
lastCycle: z.number().int().min(0).optional(),
|
|
2669
|
+
wanderPos: z.number().int().min(0).optional()
|
|
2670
|
+
}))
|
|
2671
|
+
.optional()
|
|
2672
|
+
}).superRefine((clip, ctx) => {
|
|
2673
|
+
if (clip.pattern !== undefined && clip.notes !== undefined) {
|
|
2674
|
+
const label = clip.name || clip.id;
|
|
2675
|
+
ctx.addIssue({
|
|
2676
|
+
code: "custom",
|
|
2677
|
+
path: ["notes"],
|
|
2678
|
+
message: `Clip "${label}" (${clip.id}) cannot hold both \`pattern\` and stored \`notes\`.`
|
|
2679
|
+
});
|
|
2680
|
+
}
|
|
1969
2681
|
});
|
|
1970
2682
|
// ── Guided setup (PRD § 8.5) ─────────────────────────────────────────────────
|
|
1971
2683
|
/**
|
|
@@ -2100,6 +2812,9 @@ export const timelineDocument = z.object({
|
|
|
2100
2812
|
/** The mix bus. Without this field Zod strips it on every PATCH, so the
|
|
2101
2813
|
* master fader and its effects reset on the first save. */
|
|
2102
2814
|
master: timelineMasterChannel.optional(),
|
|
2815
|
+
/** Marks a music project. Without this field Zod strips it on every PATCH,
|
|
2816
|
+
* so the sequence reopens without its music layout and prompt history. */
|
|
2817
|
+
music: timelineMusic.optional(),
|
|
2103
2818
|
/** Guided-setup state. Absent on every sequence not built through the flow. */
|
|
2104
2819
|
setup: timelineSetup.optional(),
|
|
2105
2820
|
/** Sequence this one was retargeted from. Without this field Zod strips it
|
|
@@ -2166,6 +2881,8 @@ export const timelineSequenceResponse = z.object({
|
|
|
2166
2881
|
tempo: timelineTempo.optional(),
|
|
2167
2882
|
/** The master channel, mirroring the document's. */
|
|
2168
2883
|
master: timelineMasterChannel.optional(),
|
|
2884
|
+
/** Music project marker, mirroring the document's. */
|
|
2885
|
+
music: timelineMusic.optional(),
|
|
2169
2886
|
setup: timelineSetup.optional(),
|
|
2170
2887
|
/** Sequence this one was retargeted from, mirroring the document's. */
|
|
2171
2888
|
templateId: z.string().nullable().optional(),
|