@sudobility/music_types 0.11.30 → 0.11.32

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.
Files changed (251) hide show
  1. package/dist/domain/commands/edit-commands.d.ts +3 -3
  2. package/dist/domain/commands/edit-commands.d.ts.map +1 -1
  3. package/dist/domain/commands/edit-commands.js +25 -25
  4. package/dist/domain/commands/edit-commands.js.map +1 -1
  5. package/dist/domain/commands/history.d.ts +32 -0
  6. package/dist/domain/commands/history.d.ts.map +1 -0
  7. package/dist/domain/commands/history.js +63 -0
  8. package/dist/domain/commands/history.js.map +1 -0
  9. package/dist/domain/commands/note-commands.d.ts +9 -12
  10. package/dist/domain/commands/note-commands.d.ts.map +1 -1
  11. package/dist/domain/commands/note-commands.js +42 -72
  12. package/dist/domain/commands/note-commands.js.map +1 -1
  13. package/dist/domain/commands/note-marks.d.ts +171 -0
  14. package/dist/domain/commands/note-marks.d.ts.map +1 -0
  15. package/dist/domain/commands/note-marks.js +427 -0
  16. package/dist/domain/commands/note-marks.js.map +1 -0
  17. package/dist/domain/commands/reflow.d.ts +1 -1
  18. package/dist/domain/commands/reflow.js +17 -17
  19. package/dist/domain/commands/reflow.js.map +1 -1
  20. package/dist/domain/commands/region-commands.d.ts +4 -4
  21. package/dist/domain/commands/region-commands.d.ts.map +1 -1
  22. package/dist/domain/commands/region-commands.js +7 -7
  23. package/dist/domain/commands/region-commands.js.map +1 -1
  24. package/dist/domain/commands/relocate-commands.d.ts +3 -3
  25. package/dist/domain/commands/relocate-commands.js +15 -15
  26. package/dist/domain/commands/relocate-commands.js.map +1 -1
  27. package/dist/domain/commands/ripple-commands.d.ts +2 -2
  28. package/dist/domain/commands/ripple-commands.js +13 -13
  29. package/dist/domain/commands/ripple-commands.js.map +1 -1
  30. package/dist/domain/commands/snapshot.d.ts +3 -3
  31. package/dist/domain/commands/snapshot.js +5 -5
  32. package/dist/domain/commands/snapshot.js.map +1 -1
  33. package/dist/domain/commands/structure-commands.d.ts +86 -5
  34. package/dist/domain/commands/structure-commands.d.ts.map +1 -1
  35. package/dist/domain/commands/structure-commands.js +272 -36
  36. package/dist/domain/commands/structure-commands.js.map +1 -1
  37. package/dist/domain/commands/track-commands.d.ts +2 -2
  38. package/dist/domain/commands/track-commands.js +7 -7
  39. package/dist/domain/commands/track-commands.js.map +1 -1
  40. package/dist/domain/commands/types.d.ts +2 -2
  41. package/dist/domain/generation/replacement-region.d.ts +32 -0
  42. package/dist/domain/generation/replacement-region.d.ts.map +1 -0
  43. package/dist/domain/generation/replacement-region.js +79 -0
  44. package/dist/domain/generation/replacement-region.js.map +1 -0
  45. package/dist/domain/instruments/gm-icon.d.ts +12 -0
  46. package/dist/domain/instruments/gm-icon.d.ts.map +1 -0
  47. package/dist/domain/instruments/gm-icon.js +327 -0
  48. package/dist/domain/instruments/gm-icon.js.map +1 -0
  49. package/dist/domain/instruments/gm-kit.js +9 -9
  50. package/dist/domain/instruments/gm-kit.js.map +1 -1
  51. package/dist/domain/instruments/gm-percussion.js +48 -48
  52. package/dist/domain/instruments/gm-percussion.js.map +1 -1
  53. package/dist/domain/instruments/gm-polyphony.js +6 -6
  54. package/dist/domain/instruments/gm-range.js +6 -6
  55. package/dist/domain/instruments/gm-transposition.js +1 -1
  56. package/dist/domain/instruments/gm.d.ts +1 -1
  57. package/dist/domain/instruments/gm.js +161 -161
  58. package/dist/domain/instruments/gm.js.map +1 -1
  59. package/dist/domain/instruments/icon-art.d.ts +75 -0
  60. package/dist/domain/instruments/icon-art.d.ts.map +1 -0
  61. package/dist/domain/instruments/icon-art.js +93 -0
  62. package/dist/domain/instruments/icon-art.js.map +1 -0
  63. package/dist/domain/instruments/instrument-fit.d.ts +31 -0
  64. package/dist/domain/instruments/instrument-fit.d.ts.map +1 -0
  65. package/dist/domain/instruments/instrument-fit.js +117 -0
  66. package/dist/domain/instruments/instrument-fit.js.map +1 -0
  67. package/dist/domain/instruments/instrument-options.d.ts +62 -0
  68. package/dist/domain/instruments/instrument-options.d.ts.map +1 -0
  69. package/dist/domain/instruments/instrument-options.js +69 -0
  70. package/dist/domain/instruments/instrument-options.js.map +1 -0
  71. package/dist/domain/instruments/track-instrument.d.ts +80 -0
  72. package/dist/domain/instruments/track-instrument.d.ts.map +1 -0
  73. package/dist/domain/instruments/track-instrument.js +102 -0
  74. package/dist/domain/instruments/track-instrument.js.map +1 -0
  75. package/dist/domain/notation/chord-symbol.d.ts +26 -0
  76. package/dist/domain/notation/chord-symbol.d.ts.map +1 -0
  77. package/dist/domain/notation/chord-symbol.js +32 -0
  78. package/dist/domain/notation/chord-symbol.js.map +1 -0
  79. package/dist/domain/notation/lyric-syllables.d.ts +15 -0
  80. package/dist/domain/notation/lyric-syllables.d.ts.map +1 -0
  81. package/dist/domain/notation/lyric-syllables.js +15 -0
  82. package/dist/domain/notation/lyric-syllables.js.map +1 -0
  83. package/dist/domain/notation/music-vocabulary.d.ts +59 -0
  84. package/dist/domain/notation/music-vocabulary.d.ts.map +1 -0
  85. package/dist/domain/notation/music-vocabulary.js +164 -0
  86. package/dist/domain/notation/music-vocabulary.js.map +1 -0
  87. package/dist/domain/pitch/pitch.d.ts +1 -1
  88. package/dist/domain/pitch/pitch.js +29 -29
  89. package/dist/domain/pitch/transpose.d.ts +1 -1
  90. package/dist/domain/pitch/transpose.js +2 -2
  91. package/dist/domain/quantization/quantize.d.ts +2 -2
  92. package/dist/domain/quantization/quantize.js +9 -9
  93. package/dist/domain/quantization/quantize.js.map +1 -1
  94. package/dist/domain/score/articulation.d.ts +56 -0
  95. package/dist/domain/score/articulation.d.ts.map +1 -0
  96. package/dist/domain/score/articulation.js +56 -0
  97. package/dist/domain/score/articulation.js.map +1 -0
  98. package/dist/domain/score/bar-numbers.d.ts +38 -0
  99. package/dist/domain/score/bar-numbers.d.ts.map +1 -0
  100. package/dist/domain/score/bar-numbers.js +49 -0
  101. package/dist/domain/score/bar-numbers.js.map +1 -0
  102. package/dist/domain/score/collapse-rests.d.ts +23 -0
  103. package/dist/domain/score/collapse-rests.d.ts.map +1 -0
  104. package/dist/domain/score/collapse-rests.js +78 -0
  105. package/dist/domain/score/collapse-rests.js.map +1 -0
  106. package/dist/domain/score/cue-notes.d.ts +24 -0
  107. package/dist/domain/score/cue-notes.d.ts.map +1 -0
  108. package/dist/domain/score/cue-notes.js +105 -0
  109. package/dist/domain/score/cue-notes.js.map +1 -0
  110. package/dist/domain/score/dynamics.d.ts +62 -0
  111. package/dist/domain/score/dynamics.d.ts.map +1 -0
  112. package/dist/domain/score/dynamics.js +142 -0
  113. package/dist/domain/score/dynamics.js.map +1 -0
  114. package/dist/domain/score/effective-clef.d.ts +42 -0
  115. package/dist/domain/score/effective-clef.d.ts.map +1 -0
  116. package/dist/domain/score/effective-clef.js +39 -0
  117. package/dist/domain/score/effective-clef.js.map +1 -0
  118. package/dist/domain/score/extract-part.d.ts +10 -0
  119. package/dist/domain/score/extract-part.d.ts.map +1 -0
  120. package/dist/domain/score/extract-part.js +44 -0
  121. package/dist/domain/score/extract-part.js.map +1 -0
  122. package/dist/domain/score/factory.d.ts +1 -1
  123. package/dist/domain/score/factory.js +12 -12
  124. package/dist/domain/score/factory.js.map +1 -1
  125. package/dist/domain/score/fermata-tempo.d.ts +40 -0
  126. package/dist/domain/score/fermata-tempo.d.ts.map +1 -0
  127. package/dist/domain/score/fermata-tempo.js +95 -0
  128. package/dist/domain/score/fermata-tempo.js.map +1 -0
  129. package/dist/domain/score/flatten.d.ts +32 -0
  130. package/dist/domain/score/flatten.d.ts.map +1 -0
  131. package/dist/domain/score/flatten.js +132 -0
  132. package/dist/domain/score/flatten.js.map +1 -0
  133. package/dist/domain/score/fragment.d.ts +4 -8
  134. package/dist/domain/score/fragment.d.ts.map +1 -1
  135. package/dist/domain/score/fragment.js +8 -8
  136. package/dist/domain/score/fragment.js.map +1 -1
  137. package/dist/domain/score/ids.d.ts +1 -1
  138. package/dist/domain/score/ids.js +6 -6
  139. package/dist/domain/score/ottava.d.ts +41 -0
  140. package/dist/domain/score/ottava.d.ts.map +1 -0
  141. package/dist/domain/score/ottava.js +98 -0
  142. package/dist/domain/score/ottava.js.map +1 -0
  143. package/dist/domain/score/performance-timeline.d.ts +42 -0
  144. package/dist/domain/score/performance-timeline.d.ts.map +1 -0
  145. package/dist/domain/score/performance-timeline.js +78 -0
  146. package/dist/domain/score/performance-timeline.js.map +1 -0
  147. package/dist/domain/score/queries.d.ts +2 -2
  148. package/dist/domain/score/queries.js +7 -7
  149. package/dist/domain/score/queries.js.map +1 -1
  150. package/dist/domain/score/rehearsal-marks.d.ts +30 -0
  151. package/dist/domain/score/rehearsal-marks.d.ts.map +1 -0
  152. package/dist/domain/score/rehearsal-marks.js +126 -0
  153. package/dist/domain/score/rehearsal-marks.js.map +1 -0
  154. package/dist/domain/score/repeat-order.d.ts +21 -0
  155. package/dist/domain/score/repeat-order.d.ts.map +1 -0
  156. package/dist/domain/score/repeat-order.js +123 -0
  157. package/dist/domain/score/repeat-order.js.map +1 -0
  158. package/dist/domain/score/snapshot-tree.d.ts +23 -0
  159. package/dist/domain/score/snapshot-tree.d.ts.map +1 -0
  160. package/dist/domain/score/snapshot-tree.js +45 -0
  161. package/dist/domain/score/snapshot-tree.js.map +1 -0
  162. package/dist/domain/score/ties.d.ts +1 -1
  163. package/dist/domain/score/ties.js +7 -7
  164. package/dist/domain/score/ties.js.map +1 -1
  165. package/dist/domain/score/written-pitch.d.ts +33 -0
  166. package/dist/domain/score/written-pitch.d.ts.map +1 -0
  167. package/dist/domain/score/written-pitch.js +110 -0
  168. package/dist/domain/score/written-pitch.js.map +1 -0
  169. package/dist/domain/selection/range-select.d.ts +13 -0
  170. package/dist/domain/selection/range-select.d.ts.map +1 -0
  171. package/dist/domain/selection/range-select.js +40 -0
  172. package/dist/domain/selection/range-select.js.map +1 -0
  173. package/dist/domain/selection/selection-editing.d.ts +30 -0
  174. package/dist/domain/selection/selection-editing.d.ts.map +1 -0
  175. package/dist/domain/selection/selection-editing.js +31 -0
  176. package/dist/domain/selection/selection-editing.js.map +1 -0
  177. package/dist/domain/selection/selection.d.ts +2 -2
  178. package/dist/domain/selection/selection.js +7 -7
  179. package/dist/domain/selection/selection.js.map +1 -1
  180. package/dist/domain/selection/types.d.ts +2 -2
  181. package/dist/domain/selection/types.d.ts.map +1 -1
  182. package/dist/domain/time/duration-modifiers.d.ts +40 -0
  183. package/dist/domain/time/duration-modifiers.d.ts.map +1 -0
  184. package/dist/domain/time/duration-modifiers.js +50 -0
  185. package/dist/domain/time/duration-modifiers.js.map +1 -0
  186. package/dist/domain/time/duration-selection.d.ts +23 -0
  187. package/dist/domain/time/duration-selection.d.ts.map +1 -0
  188. package/dist/domain/time/duration-selection.js +50 -0
  189. package/dist/domain/time/duration-selection.js.map +1 -0
  190. package/dist/domain/time/durations.js +6 -6
  191. package/dist/domain/time/durations.js.map +1 -1
  192. package/dist/domain/time/fraction.d.ts +1 -1
  193. package/dist/domain/time/fraction.js +1 -1
  194. package/dist/domain/time/tap-to-note.d.ts +21 -0
  195. package/dist/domain/time/tap-to-note.d.ts.map +1 -0
  196. package/dist/domain/time/tap-to-note.js +43 -0
  197. package/dist/domain/time/tap-to-note.js.map +1 -0
  198. package/dist/domain/time/tempo-map.d.ts +1 -1
  199. package/dist/domain/time/ticks.d.ts +1 -1
  200. package/dist/domain/time/ticks.d.ts.map +1 -1
  201. package/dist/domain/time/ticks.js +14 -14
  202. package/dist/domain/time/ticks.js.map +1 -1
  203. package/dist/domain/time/tuplets.d.ts +42 -0
  204. package/dist/domain/time/tuplets.d.ts.map +1 -0
  205. package/dist/domain/time/tuplets.js +53 -0
  206. package/dist/domain/time/tuplets.js.map +1 -0
  207. package/dist/domain/validation/issues.d.ts +1 -1
  208. package/dist/domain/validation/issues.js +20 -20
  209. package/dist/domain/validation/validator.d.ts +2 -2
  210. package/dist/domain/validation/validator.d.ts.map +1 -1
  211. package/dist/domain/validation/validator.js +31 -31
  212. package/dist/domain/validation/validator.js.map +1 -1
  213. package/dist/domain/voicing/allocate.d.ts +2 -2
  214. package/dist/domain/voicing/allocate.js +6 -6
  215. package/dist/domain/voicing/allocate.js.map +1 -1
  216. package/dist/index.d.ts +72 -5535
  217. package/dist/index.d.ts.map +1 -1
  218. package/dist/index.js +79 -462
  219. package/dist/index.js.map +1 -1
  220. package/dist/model/api.d.ts +1696 -0
  221. package/dist/model/api.d.ts.map +1 -0
  222. package/dist/model/api.js +125 -0
  223. package/dist/model/api.js.map +1 -0
  224. package/dist/model/generation.d.ts +2178 -0
  225. package/dist/model/generation.d.ts.map +1 -0
  226. package/dist/model/generation.js +142 -0
  227. package/dist/model/generation.js.map +1 -0
  228. package/dist/model/schemas.d.ts +1200 -0
  229. package/dist/model/schemas.d.ts.map +1 -0
  230. package/dist/model/schemas.js +200 -0
  231. package/dist/model/schemas.js.map +1 -0
  232. package/dist/model/score.d.ts +462 -0
  233. package/dist/model/score.d.ts.map +1 -0
  234. package/dist/model/score.js +34 -0
  235. package/dist/model/score.js.map +1 -0
  236. package/dist/platform/audio.d.ts.map +1 -1
  237. package/dist/platform/file.d.ts.map +1 -1
  238. package/dist/platform/index.d.ts +7 -7
  239. package/dist/platform/index.js +7 -7
  240. package/dist/platform/midi-input.d.ts +2 -2
  241. package/dist/platform/midi.d.ts.map +1 -1
  242. package/dist/platform/mod.d.ts +2 -2
  243. package/dist/platform/playback.d.ts +7 -7
  244. package/dist/platform/xml.js +1 -1
  245. package/dist/services/regeneration/controller.d.ts +6 -6
  246. package/dist/services/regeneration/controller.js +12 -12
  247. package/dist/services/regeneration/controller.js.map +1 -1
  248. package/dist/test/fixtures.d.ts +1 -1
  249. package/dist/test/fixtures.js +103 -103
  250. package/dist/test/fixtures.js.map +1 -1
  251. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/model/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,E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ather than merged into them: these are the *runtime*
5
+ * contract — the velocity range, the tick bounds, which fields are optional —
6
+ * and they are what a payload crossing the wire is checked against.
7
+ */
8
+ import { z } from "zod";
9
+ // ---------------------------------------------------------------------------
10
+ // 4. Zod schemas for the score tree
11
+ // ---------------------------------------------------------------------------
12
+ // Runtime constraints: velocity 0-127, midiProgram 0-127, midiChannel 0-15,
13
+ // ppq positive int, accidental -2..2, octave -1..9. `noteEventSchema` /
14
+ // `restEventSchema` are `.strict()` so an object with a stray `pitch` field
15
+ // cannot be silently accepted as a rest (and vice versa); every other schema
16
+ // stays permissive to tolerate forward-compatible additions.
17
+ export const uuidSchema = z.string().min(1);
18
+ export const pitchStepSchema = z.enum(["C", "D", "E", "F", "G", "A", "B"]);
19
+ export const accidentalSchema = z.union([
20
+ z.literal(-2),
21
+ z.literal(-1),
22
+ z.literal(0),
23
+ z.literal(1),
24
+ z.literal(2),
25
+ ]);
26
+ export const pitchSchema = z.object({
27
+ step: pitchStepSchema,
28
+ accidental: accidentalSchema,
29
+ octave: z.number().int().min(-1).max(9),
30
+ });
31
+ export const timeSignatureSchema = z.object({
32
+ numerator: z.number().int().positive(),
33
+ denominator: z.number().int().positive(),
34
+ });
35
+ export const keySignatureSchema = z.object({
36
+ fifths: z.number().int(),
37
+ mode: z.enum(["major", "minor"]),
38
+ });
39
+ export const tempoEventSchema = z.object({
40
+ id: uuidSchema,
41
+ tick: z.number().int().nonnegative(),
42
+ bpm: z.number().positive(),
43
+ });
44
+ export const articulationSchema = z.enum([
45
+ "staccato",
46
+ "accent",
47
+ "tenuto",
48
+ "marcato",
49
+ ]);
50
+ export const hairpinSchema = z.enum(["crescendo", "diminuendo"]);
51
+ export const ottavaSchema = z.enum(["8va", "8vb", "15ma", "15mb"]);
52
+ export const barlineStyleSchema = z.enum(["double", "final"]);
53
+ export const repeatJumpSchema = z.enum([
54
+ "da-capo",
55
+ "da-capo-al-fine",
56
+ "da-capo-al-coda",
57
+ "dal-segno",
58
+ "dal-segno-al-fine",
59
+ "dal-segno-al-coda",
60
+ ]);
61
+ export const ornamentSchema = z.enum([
62
+ "trill",
63
+ "mordent",
64
+ "inverted-mordent",
65
+ "turn",
66
+ ]);
67
+ export const dynamicSchema = z.enum([
68
+ "ppp",
69
+ "pp",
70
+ "p",
71
+ "mp",
72
+ "mf",
73
+ "f",
74
+ "ff",
75
+ "fff",
76
+ ]);
77
+ export const clefSchema = z.enum([
78
+ "treble",
79
+ "bass",
80
+ "alto",
81
+ "tenor",
82
+ "percussion",
83
+ ]);
84
+ export const noteEventSchema = z
85
+ .object({
86
+ id: uuidSchema,
87
+ pitch: pitchSchema,
88
+ startTick: z.number().int().nonnegative(),
89
+ durationTicks: z.number().int().positive(),
90
+ velocity: z.number().int().min(0).max(127),
91
+ voiceId: uuidSchema,
92
+ trackId: uuidSchema,
93
+ tieStart: z.boolean().optional(),
94
+ tieStop: z.boolean().optional(),
95
+ articulation: articulationSchema.optional(),
96
+ fermata: z.boolean().optional(),
97
+ ornament: ornamentSchema.optional(),
98
+ dynamic: dynamicSchema.optional(),
99
+ slurStart: z.boolean().optional(),
100
+ slurStop: z.boolean().optional(),
101
+ hairpinStart: hairpinSchema.optional(),
102
+ hairpinStop: z.boolean().optional(),
103
+ arpeggiate: z.boolean().optional(),
104
+ ottavaStart: ottavaSchema.optional(),
105
+ ottavaStop: z.boolean().optional(),
106
+ glissandoStart: z.boolean().optional(),
107
+ glissandoStop: z.boolean().optional(),
108
+ fingering: z.string().min(1).optional(),
109
+ chordSymbol: z.string().optional(),
110
+ graceNotes: z
111
+ .array(z.object({
112
+ pitch: pitchSchema,
113
+ durationTicks: z.number(),
114
+ slashed: z.boolean().optional(),
115
+ }))
116
+ .optional(),
117
+ lyric: z
118
+ .object({
119
+ text: z.string(),
120
+ syllabic: z.enum(["single", "begin", "middle", "end"]).optional(),
121
+ })
122
+ .optional(),
123
+ })
124
+ .strict();
125
+ export const restEventSchema = z
126
+ .object({
127
+ id: uuidSchema,
128
+ startTick: z.number().int().nonnegative(),
129
+ durationTicks: z.number().int().positive(),
130
+ voiceId: uuidSchema,
131
+ trackId: uuidSchema,
132
+ })
133
+ .strict();
134
+ export const musicalEventSchema = z.union([noteEventSchema, restEventSchema]);
135
+ export const voiceSchema = z.object({
136
+ id: uuidSchema,
137
+ name: z.string(),
138
+ events: z.array(musicalEventSchema),
139
+ });
140
+ export const measureSchema = z.object({
141
+ id: uuidSchema,
142
+ index: z.number().int().nonnegative(),
143
+ startTick: z.number().int().nonnegative(),
144
+ durationTicks: z.number().int().positive(),
145
+ timeSignature: timeSignatureSchema,
146
+ keySignature: keySignatureSchema,
147
+ voices: z.array(voiceSchema),
148
+ // Minimum 2, not 1: a count of one is not a multi-measure rest, and
149
+ // rejecting it here stops a meaningless value reaching the renderer.
150
+ multiMeasureRestCount: z.number().int().min(2).optional(),
151
+ repeatStart: z.boolean().optional(),
152
+ repeatEnd: z.boolean().optional(),
153
+ // Positive whole numbers: an ending is "1." or "1, 2.", never a zeroth pass.
154
+ endingNumbers: z.array(z.number().int().positive()).min(1).optional(),
155
+ rehearsalMark: z.string().min(1).optional(),
156
+ cue: z
157
+ .object({ label: z.string().min(1), events: z.array(musicalEventSchema) })
158
+ .optional(),
159
+ clef: clefSchema.optional(),
160
+ pickup: z.boolean().optional(),
161
+ barline: barlineStyleSchema.optional(),
162
+ segno: z.boolean().optional(),
163
+ coda: z.boolean().optional(),
164
+ toCoda: z.boolean().optional(),
165
+ fine: z.boolean().optional(),
166
+ jump: repeatJumpSchema.optional(),
167
+ });
168
+ export const trackSchema = z.object({
169
+ id: uuidSchema,
170
+ name: z.string(),
171
+ instrumentName: z.string(),
172
+ midiProgram: z.number().int().min(0).max(127),
173
+ midiChannel: z.number().int().min(0).max(15),
174
+ clef: clefSchema,
175
+ volume: z.number(),
176
+ pan: z.number(),
177
+ muted: z.boolean(),
178
+ solo: z.boolean(),
179
+ measures: z.array(measureSchema),
180
+ });
181
+ export const scoreMetadataSchema = z.object({
182
+ title: z.string(),
183
+ composer: z.string().optional(),
184
+ description: z.string().optional(),
185
+ createdAt: z.string(),
186
+ updatedAt: z.string(),
187
+ });
188
+ export const scoreSchema = z.object({
189
+ id: uuidSchema,
190
+ version: z.number().int().nonnegative(),
191
+ ppq: z.number().int().positive(),
192
+ metadata: scoreMetadataSchema,
193
+ tempoMap: z.array(tempoEventSchema),
194
+ tracks: z.array(trackSchema),
195
+ });
196
+ /** Parses and validates untrusted JSON as a `Score`. Throws `ZodError` on invalid input. */
197
+ export function parseScore(json) {
198
+ return scoreSchema.parse(json);
199
+ }
200
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/model/schemas.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8EAA8E;AAC9E,oCAAoC;AACpC,8EAA8E;AAC9E,4EAA4E;AAC5E,wEAAwE;AACxE,4EAA4E;AAC5E,6EAA6E;AAC7E,6DAA6D;AAE7D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAE5C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC;IACtC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACb,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACb,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;CACb,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WA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AE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,mBAAmB;IAC7B,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;CAC7B,CAAC,CAAC;AAEH,4FAA4F;AAC5F,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,CAAU,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,462 @@
1
+ /**
2
+ * The score model: what a piece of music *is* in this system.
3
+ *
4
+ * Split out of `index.ts`, which had grown to 1,463 lines holding the whole
5
+ * model, every Zod schema and every API payload in one scroll. The index is
6
+ * now purely re-exports, so `@sudobility/music_types` still presents one
7
+ * surface while the declarations are findable.
8
+ */
9
+ export type UUID = string;
10
+ export type Fraction = {
11
+ numerator: number;
12
+ denominator: number;
13
+ };
14
+ export type PitchStep = "C" | "D" | "E" | "F" | "G" | "A" | "B";
15
+ /** -2 = double flat, -1 = flat, 0 = natural, 1 = sharp, 2 = double sharp. */
16
+ export type Accidental = -2 | -1 | 0 | 1 | 2;
17
+ export type Pitch = {
18
+ step: PitchStep;
19
+ accidental: Accidental;
20
+ octave: number;
21
+ };
22
+ export type TimeSignature = {
23
+ numerator: number;
24
+ denominator: number;
25
+ };
26
+ export type KeySignature = {
27
+ fifths: number;
28
+ mode: "major" | "minor";
29
+ };
30
+ export type TempoEvent = {
31
+ id: UUID;
32
+ tick: number;
33
+ bpm: number;
34
+ };
35
+ /**
36
+ * Renderable note-duration names: base values (whole down to thirty-second),
37
+ * their dotted (1.5x) variants, and their triplet (2/3x) variants.
38
+ */
39
+ export type DurationName = "whole" | "half" | "quarter" | "eighth" | "sixteenth" | "thirtysecond" | "dotted-whole" | "dotted-half" | "dotted-quarter" | "dotted-eighth" | "dotted-sixteenth" | "dotted-thirtysecond" | "triplet-whole" | "triplet-half" | "triplet-quarter" | "triplet-eighth" | "triplet-sixteenth" | "triplet-thirtysecond";
40
+ export type Articulation = "staccato" | "accent" | "tenuto" | "marcato";
41
+ /**
42
+ * An ornament sign written over a note.
43
+ *
44
+ * The *sign*, not the notes it stands for: a trill is stored as "trill" rather
45
+ * than expanded into the alternation a player would produce, because the
46
+ * realisation depends on period, tempo and taste, and expanding it would make
47
+ * the ornament impossible to remove or re-read. Written-out ornaments are a
48
+ * different thing entirely and already have one — `NoteEvent.graceNotes`.
49
+ *
50
+ * Named the way a musician names them: `mordent` is the one *with* the
51
+ * vertical stroke and `inverted-mordent` the one without. (VexFlow's own codes
52
+ * use these two words the other way round — see `convert.ts`.)
53
+ */
54
+ export type Ornament = "trill" | "mordent" | "inverted-mordent" | "turn";
55
+ /**
56
+ * A gradual change of loudness, written as a wedge under the stave.
57
+ *
58
+ * The other half of `Dynamic`: a dynamic is a *level* that holds until the
59
+ * next one, and a hairpin is the *change* between two of them. Most dynamic
60
+ * writing is hairpins, so a score that had only levels could say "loud here"
61
+ * but never "get louder".
62
+ */
63
+ export type Hairpin = "crescendo" | "diminuendo";
64
+ /**
65
+ * An octave-displacement bracket: play the written notes an octave (or two)
66
+ * away from where they sit.
67
+ *
68
+ * `8va`/`15ma` are above, `8vb`/`15mb` below. The model stores **sounding**
69
+ * pitch as it always has, so the bracket is purely a display instruction — it
70
+ * says "these were written an octave lower to keep them on the stave", and the
71
+ * display lens moves them there. That is the only way it can work here: a
72
+ * model that stored written pitch would make an ottava change what a note
73
+ * *sounds* like, which is the opposite of what the mark means.
74
+ */
75
+ export type Ottava = "8va" | "8vb" | "15ma" | "15mb";
76
+ /**
77
+ * The line drawn at the end of a bar, where it is not an ordinary single one.
78
+ *
79
+ * Only the two that carry meaning a reader acts on: `double` marks a section
80
+ * break, and `final` ends the piece. The repeat barlines are deliberately not
81
+ * in here — they live on `repeatStart`/`repeatEnd` because they are two
82
+ * independent flags rather than one choice, and a bar can both end a repeat
83
+ * and end the piece.
84
+ */
85
+ export type BarlineStyle = "double" | "final";
86
+ /**
87
+ * A jump instruction written at the end of a bar.
88
+ *
89
+ * The six a player actually meets. Each says two things — where to go back to
90
+ * (the start for a *capo*, the sign for a *segno*) and where to stop or leave
91
+ * (the end, `fine`, or the coda) — which is why they are one enum rather than
92
+ * a direction and a target composed separately: only these combinations are
93
+ * written, and the pairs that are not written should not be expressible.
94
+ */
95
+ export type RepeatJump = "da-capo" | "da-capo-al-fine" | "da-capo-al-coda" | "dal-segno" | "dal-segno-al-fine" | "dal-segno-al-coda";
96
+ /**
97
+ * A dynamic marking, from softest to loudest.
98
+ *
99
+ * Attached to the note it applies *from*, and in force until the next one on
100
+ * that track — which is how a dynamic is read on paper and how it is played.
101
+ * Stored as the marking rather than as a velocity, because "mf" is what the
102
+ * score says; the velocity a player gives it is derived (`velocityForDynamic`
103
+ * in music_lib) and stays adjustable per note on top.
104
+ */
105
+ export type Dynamic = "ppp" | "pp" | "p" | "mp" | "mf" | "f" | "ff" | "fff";
106
+ /**
107
+ * How a sung syllable joins its neighbours.
108
+ *
109
+ * MusicXML's own vocabulary, kept rather than invented: it is what decides
110
+ * whether a hyphen is drawn to the next note. "beau-ti-ful" over three notes
111
+ * is `begin`, `middle`, `end`; a one-syllable word is `single`.
112
+ */
113
+ export type Syllabic = "single" | "begin" | "middle" | "end";
114
+ /**
115
+ * A small ornamental note played just before the note it decorates.
116
+ *
117
+ * Attached to that note rather than sitting in the voice as an event of its
118
+ * own, because a grace note **takes no time from the bar** — it borrows from
119
+ * its principal. As an event it would have to be excluded from every sum that
120
+ * checks a measure adds up: validation, rest filling, quantization, the
121
+ * VexFlow voice. Hanging it off the note it ornaments means none of those
122
+ * change at all, and it moves, copies and deletes with its principal, which is
123
+ * what a player expects of an ornament.
124
+ *
125
+ * `durationTicks` is the *written* value — what decides the glyph and how many
126
+ * flags it gets — not time taken from the measure.
127
+ */
128
+ export type GraceNote = {
129
+ pitch: Pitch;
130
+ durationTicks: number;
131
+ /**
132
+ * A slash through the stem: an acciaccatura, crushed against the principal.
133
+ * Without it the note is an appoggiatura, which takes noticeably longer.
134
+ */
135
+ slashed?: boolean;
136
+ };
137
+ /** One syllable sung on one note. */
138
+ export type Lyric = {
139
+ text: string;
140
+ /** Absent means `single` — a whole word on one note, which is the common case. */
141
+ syllabic?: Syllabic;
142
+ };
143
+ /** Softest first, which is the order a picker should offer them in. */
144
+ export declare const DYNAMICS: readonly Dynamic[];
145
+ export type Clef = "treble" | "bass" | "alto" | "tenor" | "percussion";
146
+ export type NoteEvent = {
147
+ id: UUID;
148
+ pitch: Pitch;
149
+ startTick: number;
150
+ durationTicks: number;
151
+ velocity: number;
152
+ voiceId: UUID;
153
+ trackId: UUID;
154
+ tieStart?: boolean;
155
+ tieStop?: boolean;
156
+ articulation?: Articulation;
157
+ /**
158
+ * A pause held on this note, at the performer's discretion.
159
+ *
160
+ * Separate from `articulation` although it draws like one, because it is not
161
+ * one: an articulation says how a note of a written length is played, while a
162
+ * fermata says the written length is *suspended*. Putting it in the
163
+ * `Articulation` enum would have made it mutually exclusive with staccato and
164
+ * accent, and a fermata over an accented final chord is ordinary notation.
165
+ *
166
+ * Boolean rather than a duration: how long a fermata is held is the
167
+ * performer's judgement, not the score's, which is the whole point of the
168
+ * marking.
169
+ */
170
+ fermata?: boolean;
171
+ /**
172
+ * An ornament sign over this note — a trill, mordent or turn.
173
+ *
174
+ * Beside `graceNotes` rather than replacing it: an ornament *sign* leaves
175
+ * its realisation to the player, while grace notes spell out exactly what is
176
+ * played. A note can carry both, which is how an ornament with a written-out
177
+ * termination is notated.
178
+ */
179
+ ornament?: Ornament;
180
+ /** Dynamic marking starting at this note; in force until the next one. */
181
+ dynamic?: Dynamic;
182
+ /**
183
+ * Phrase mark endpoints.
184
+ *
185
+ * Deliberately separate from `tieStart`/`tieStop`, which look the same on
186
+ * paper and mean something else entirely: a tie joins two notes *of the same
187
+ * pitch* into one sounding note, and playback joins their durations. A slur
188
+ * groups a run of *different* pitches as one phrase and joins nothing — so
189
+ * `joinTiedNotes` must never see these, and it does not.
190
+ */
191
+ slurStart?: boolean;
192
+ slurStop?: boolean;
193
+ /**
194
+ * The ends of a hairpin.
195
+ *
196
+ * Shaped exactly like `slurStart`/`slurStop`, because a hairpin is the same
197
+ * kind of object — a span with two endpoints, written across a run of notes.
198
+ * The *start* carries the direction, since that is what the wedge's opening
199
+ * says; the stop only has to say where it closes.
200
+ *
201
+ * Kept apart from `dynamic`, which marks a level beginning at a note, for
202
+ * the reason the two are different marks on paper: a hairpin can run between
203
+ * two dynamics, from one without a following one, or over notes that carry
204
+ * no dynamic at all.
205
+ */
206
+ hairpinStart?: Hairpin;
207
+ hairpinStop?: boolean;
208
+ /**
209
+ * Roll this chord rather than striking it together.
210
+ *
211
+ * A flag per note, although the mark belongs to the *chord*, because a chord
212
+ * here is several `NoteEvent`s sharing a tick — there is no chord object to
213
+ * hang it on. That is also MusicXML's shape: `<arpeggiate/>` appears on every
214
+ * note of the chord, not once.
215
+ *
216
+ * On a single note it means nothing and draws nothing: there is only one
217
+ * notehead to roll through.
218
+ */
219
+ arpeggiate?: boolean;
220
+ /**
221
+ * The ends of an octave bracket, shaped like the hairpin and the slur.
222
+ *
223
+ * The start carries the displacement; the stop only says where it closes.
224
+ */
225
+ ottavaStart?: Ottava;
226
+ ottavaStop?: boolean;
227
+ /**
228
+ * The ends of a slide between two notes.
229
+ *
230
+ * A span like a slur rather than a flag meaning "slide to the next note",
231
+ * so that an exported `<glissando type="start"/>`/`stop` pair round-trips as
232
+ * what it is, and so a slide across a rest cannot be expressed by accident.
233
+ */
234
+ glissandoStart?: boolean;
235
+ glissandoStop?: boolean;
236
+ /**
237
+ * The finger to play this note with.
238
+ *
239
+ * A string, not a number: piano writing uses `1`-`5`, guitar adds `T` for
240
+ * the thumb, and editions write `1-2` for a substitution. Storing what the
241
+ * engraver typed keeps all three, and nothing here needs to do arithmetic
242
+ * on it.
243
+ */
244
+ fingering?: string;
245
+ /**
246
+ * The syllable sung on this note.
247
+ *
248
+ * On the note rather than in a parallel list because that is what a lyric
249
+ * is: text belonging to a notehead, which moves, copies and deletes with it.
250
+ * A separate track of syllables would have to be re-aligned after every edit
251
+ * that changed the note count.
252
+ */
253
+ lyric?: Lyric;
254
+ /** Ornaments played immediately before this note, in the order written. */
255
+ graceNotes?: GraceNote[];
256
+ /**
257
+ * A chord symbol printed above the stave from this note, e.g. `Cmaj7`.
258
+ *
259
+ * Stored as the text a player reads rather than as a parsed root and
260
+ * quality. A lead sheet's vocabulary is wide and inconsistent — `C-7`,
261
+ * `Cmin7` and `Cm7` are one chord written three ways, and `F/A`, `Bb7#11`
262
+ * and `Cmaj7(add13)` all have to survive being typed — so keeping the string
263
+ * means nothing a player writes is refused or silently rewritten. Export
264
+ * parses the root out of it for MusicXML and carries the rest verbatim.
265
+ *
266
+ * Attached to a note, like a lyric, because that is where it is read from:
267
+ * the chord changes *at* a note. A change during a held note has to wait for
268
+ * the next onset, which is the one thing this shape cannot express.
269
+ */
270
+ chordSymbol?: string;
271
+ };
272
+ export type RestEvent = {
273
+ id: UUID;
274
+ startTick: number;
275
+ durationTicks: number;
276
+ voiceId: UUID;
277
+ trackId: UUID;
278
+ };
279
+ export type MusicalEvent = NoteEvent | RestEvent;
280
+ export type Voice = {
281
+ id: UUID;
282
+ name: string;
283
+ events: MusicalEvent[];
284
+ };
285
+ /**
286
+ * Small-print notes from another instrument, printed in the bar before a long
287
+ * entry so the player knows where they are.
288
+ *
289
+ * Print-only and derived (see `measureCues` in music_lib). Deliberately not
290
+ * part of `Measure.voices`: a cue is not the player's music, and keeping it
291
+ * out is what lets playback, export, selection and note-counting stay correct
292
+ * without learning to skip it.
293
+ */
294
+ export type MeasureCue = {
295
+ /** Which instrument this is, e.g. "Flute". Drawn above the notes. */
296
+ label: string;
297
+ /** The cued bar's notes. Never sounded, never selectable. */
298
+ events: MusicalEvent[];
299
+ };
300
+ export type Measure = {
301
+ id: UUID;
302
+ index: number;
303
+ startTick: number;
304
+ durationTicks: number;
305
+ timeSignature: TimeSignature;
306
+ keySignature: KeySignature;
307
+ voices: Voice[];
308
+ /**
309
+ * How many measures of silence this one stands for, when it is a
310
+ * multi-measure rest. Absent for an ordinary measure.
311
+ *
312
+ * Only ever set on a derived, print-only part (see `extractPart` in
313
+ * music_lib). A stored score always writes its rests out in full, because
314
+ * collapsing loses which bar is which — and the editor needs every bar.
315
+ */
316
+ multiMeasureRestCount?: number;
317
+ /**
318
+ * Rehearsal mark shown above this measure, e.g. "B".
319
+ *
320
+ * Print-only and derived (see `rehearsalMarks` in music_lib): a stored score
321
+ * carries none, and the editor never shows them, because a mark you cannot
322
+ * move would be a control that looks editable and is not.
323
+ */
324
+ rehearsalMark?: string;
325
+ /**
326
+ * The `|:` and `:|` barlines of a repeated section.
327
+ *
328
+ * Two independent flags rather than a span, because that is how they are
329
+ * written and how they behave: a `:|` with no matching `|:` repeats from the
330
+ * start of the piece, which is a real and common marking rather than an
331
+ * error to be prevented.
332
+ *
333
+ * **Notation and export only, for now.** Playback plays straight through a
334
+ * repeat. Expanding it would break the identity that a playback tick *is* a
335
+ * score tick, which the caret, the following-scroll, "play from here" and
336
+ * the position scrubber all rest on — that needs a tick mapping threaded
337
+ * through all four, and it is deliberately a separate change.
338
+ */
339
+ repeatStart?: boolean;
340
+ repeatEnd?: boolean;
341
+ /**
342
+ * Which passes through a repeat this bar is played on — a volta.
343
+ *
344
+ * Carried on **every** bar of the ending, not just its first, so the bracket
345
+ * can be derived from runs of equal numbers rather than stored as a span.
346
+ * Deleting a bar out of a first ending then shortens the bracket instead of
347
+ * leaving one that points at nothing, the same reason a tuplet is derived.
348
+ *
349
+ * `[1]` is a first ending; `[1, 2]` is a bar played on both passes.
350
+ */
351
+ endingNumbers?: number[];
352
+ /** Cue notes printed in this measure. Print-only. */
353
+ cue?: MeasureCue;
354
+ /**
355
+ * A heavier line at the end of this bar: a section break, or the end.
356
+ *
357
+ * Absent means the ordinary single barline, which is almost every bar — so
358
+ * the field is the exception rather than a value repeated on every measure.
359
+ */
360
+ barline?: BarlineStyle;
361
+ /**
362
+ * The navigation marks a player follows, each on the bar that carries it.
363
+ *
364
+ * `segno` and `coda` are *places* — the sign to come back to, and where the
365
+ * closing section begins. `toCoda` is the place you **leave** from on the
366
+ * way to the coda, which is a different bar from the coda itself and is why
367
+ * the two cannot be one flag. `fine` is where the piece ends on a later
368
+ * pass, which is usually not the last bar.
369
+ *
370
+ * `jump` is the *instruction*, and it sits on the bar at whose end it is
371
+ * obeyed. Everything else here is a target it may name.
372
+ */
373
+ segno?: boolean;
374
+ coda?: boolean;
375
+ toCoda?: boolean;
376
+ fine?: boolean;
377
+ jump?: RepeatJump;
378
+ /**
379
+ * Whether this bar is a pickup — an anacrusis, not counted in the numbering.
380
+ *
381
+ * A flag rather than "measure 0 is short", because those are different
382
+ * things: a short bar can also be a deliberate irregular bar mid-score, and
383
+ * a pickup is defined by *not being counted*. The bar after a pickup is
384
+ * bar 1, which is the whole visible consequence.
385
+ *
386
+ * Its shortness lives where it already did, in `durationTicks` — a `Measure`
387
+ * has always carried its own length independently of its time signature, so
388
+ * validation (which sums voices against `durationTicks`) needed no change.
389
+ *
390
+ * This is MusicXML's `implicit="yes"`, which is the same idea.
391
+ */
392
+ pickup?: boolean;
393
+ /**
394
+ * A clef change taking effect at this measure.
395
+ *
396
+ * Absent means "carry on with whatever is in force" — the previous measure's
397
+ * change, or `Track.clef` if none has happened yet. Storing only the
398
+ * *changes* rather than a clef on every bar is what makes the common case
399
+ * (a part that never changes clef) identical to what it was before this
400
+ * existed, and it means inserting or deleting a bar cannot silently strand a
401
+ * clef that was only ever inherited.
402
+ *
403
+ * Keyboard, cello and bassoon parts are unreadable without this: a piano
404
+ * left hand crosses into treble constantly, and before this the whole track
405
+ * had one clef and an imported change was dropped.
406
+ */
407
+ clef?: Clef;
408
+ };
409
+ export type Track = {
410
+ id: UUID;
411
+ name: string;
412
+ instrumentName: string;
413
+ midiProgram: number;
414
+ midiChannel: number;
415
+ clef: Clef;
416
+ volume: number;
417
+ pan: number;
418
+ muted: boolean;
419
+ solo: boolean;
420
+ measures: Measure[];
421
+ };
422
+ export type ScoreMetadata = {
423
+ title: string;
424
+ composer?: string;
425
+ description?: string;
426
+ createdAt: string;
427
+ updatedAt: string;
428
+ };
429
+ export type Score = {
430
+ id: UUID;
431
+ version: number;
432
+ ppq: number;
433
+ metadata: ScoreMetadata;
434
+ tempoMap: TempoEvent[];
435
+ tracks: Track[];
436
+ };
437
+ /** True for `NoteEvent`s (distinguished from `RestEvent` by the `pitch` property). */
438
+ export declare function isNoteEvent(event: MusicalEvent): event is NoteEvent;
439
+ /** True for `RestEvent`s (distinguished from `NoteEvent` by lacking a `pitch` property). */
440
+ export declare function isRestEvent(event: MusicalEvent): event is RestEvent;
441
+ /** A tick range scoped to a set of tracks (e.g. a loop region or regeneration target). */
442
+ export type ScoreRange = {
443
+ startTick: number;
444
+ endTick: number;
445
+ trackIds: string[];
446
+ };
447
+ export type ScoreSelection = {
448
+ eventIds: string[];
449
+ measureIds: string[];
450
+ trackIds: string[];
451
+ range?: ScoreRange;
452
+ };
453
+ /** A region of a score extracted for regeneration/preview: measures per track over a range. */
454
+ export type ScoreFragment = {
455
+ range: ScoreRange;
456
+ ppq: number;
457
+ tracks: Array<{
458
+ trackId: UUID;
459
+ measures: Measure[];
460
+ }>;
461
+ };
462
+ //# sourceMappingURL=score.d.ts.map