@webmusic/kernel 0.2.0 → 0.4.0

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 (188) hide show
  1. package/LICENSE +202 -21
  2. package/NOTICE +2 -0
  3. package/README.md +103 -64
  4. package/dist/audio-context.cjs.map +1 -1
  5. package/dist/build-receipt.json +3 -3
  6. package/dist/chunk-27LH6QLZ.cjs +277 -0
  7. package/dist/chunk-27LH6QLZ.cjs.map +1 -0
  8. package/dist/chunk-3INDOVUC.cjs.map +1 -1
  9. package/dist/chunk-3RR2VIKA.js +393 -0
  10. package/dist/chunk-3RR2VIKA.js.map +1 -0
  11. package/dist/chunk-3YTKIKKX.cjs +378 -0
  12. package/dist/chunk-3YTKIKKX.cjs.map +1 -0
  13. package/dist/chunk-4RG4WQKC.js +360 -0
  14. package/dist/chunk-4RG4WQKC.js.map +1 -0
  15. package/dist/chunk-5AHVQXTF.cjs +620 -0
  16. package/dist/chunk-5AHVQXTF.cjs.map +1 -0
  17. package/dist/chunk-624KWJWZ.js +170 -0
  18. package/dist/chunk-624KWJWZ.js.map +1 -0
  19. package/dist/chunk-6HGFEKD3.cjs +851 -0
  20. package/dist/chunk-6HGFEKD3.cjs.map +1 -0
  21. package/dist/chunk-7ZTZZ5PN.cjs.map +1 -1
  22. package/dist/chunk-ALWV4P7D.js +726 -0
  23. package/dist/chunk-ALWV4P7D.js.map +1 -0
  24. package/dist/chunk-BADJJ6DV.cjs +143 -0
  25. package/dist/chunk-BADJJ6DV.cjs.map +1 -0
  26. package/dist/chunk-C3LMS36L.cjs +393 -0
  27. package/dist/chunk-C3LMS36L.cjs.map +1 -0
  28. package/dist/chunk-C3YWUZW3.cjs.map +1 -1
  29. package/dist/chunk-CR6OUWBJ.cjs +726 -0
  30. package/dist/chunk-CR6OUWBJ.cjs.map +1 -0
  31. package/dist/chunk-CYWDZLWC.js +2141 -0
  32. package/dist/chunk-CYWDZLWC.js.map +1 -0
  33. package/dist/chunk-DDOGX2D5.js +378 -0
  34. package/dist/chunk-DDOGX2D5.js.map +1 -0
  35. package/dist/chunk-DVN6E5U3.js +620 -0
  36. package/dist/chunk-DVN6E5U3.js.map +1 -0
  37. package/dist/chunk-EURMRU2S.js +208 -0
  38. package/dist/chunk-EURMRU2S.js.map +1 -0
  39. package/dist/chunk-EXDCK2VL.cjs +20 -0
  40. package/dist/chunk-EXDCK2VL.cjs.map +1 -0
  41. package/dist/chunk-G5EIUP52.js +114 -0
  42. package/dist/chunk-G5EIUP52.js.map +1 -0
  43. package/dist/chunk-GB4DGKLZ.js +143 -0
  44. package/dist/chunk-GB4DGKLZ.js.map +1 -0
  45. package/dist/chunk-GPOEAYOW.js +2147 -0
  46. package/dist/chunk-GPOEAYOW.js.map +1 -0
  47. package/dist/chunk-I4YMA5VM.cjs +120 -0
  48. package/dist/chunk-I4YMA5VM.cjs.map +1 -0
  49. package/dist/chunk-IVWHMDCB.cjs +4383 -0
  50. package/dist/chunk-IVWHMDCB.cjs.map +1 -0
  51. package/dist/chunk-JFCBJMA7.cjs +2147 -0
  52. package/dist/chunk-JFCBJMA7.cjs.map +1 -0
  53. package/dist/chunk-JLVSAZ3K.cjs +813 -0
  54. package/dist/chunk-JLVSAZ3K.cjs.map +1 -0
  55. package/dist/chunk-K7FYH6UG.cjs +208 -0
  56. package/dist/chunk-K7FYH6UG.cjs.map +1 -0
  57. package/dist/chunk-L4MYCETM.cjs +970 -0
  58. package/dist/chunk-L4MYCETM.cjs.map +1 -0
  59. package/dist/chunk-MNCMYNYL.js +970 -0
  60. package/dist/chunk-MNCMYNYL.js.map +1 -0
  61. package/dist/chunk-NT2BZ3QM.js +120 -0
  62. package/dist/chunk-NT2BZ3QM.js.map +1 -0
  63. package/dist/chunk-O7SA5GLC.js +277 -0
  64. package/dist/chunk-O7SA5GLC.js.map +1 -0
  65. package/dist/chunk-OCKAHITL.cjs +548 -0
  66. package/dist/chunk-OCKAHITL.cjs.map +1 -0
  67. package/dist/chunk-OTXYWCLA.js +206 -0
  68. package/dist/chunk-OTXYWCLA.js.map +1 -0
  69. package/dist/chunk-P6ZA63J7.js +548 -0
  70. package/dist/chunk-P6ZA63J7.js.map +1 -0
  71. package/dist/chunk-QLF3BOST.js +20 -0
  72. package/dist/chunk-QLF3BOST.js.map +1 -0
  73. package/dist/chunk-RCWFRZDR.js +4383 -0
  74. package/dist/chunk-RCWFRZDR.js.map +1 -0
  75. package/dist/chunk-RZBLPM3L.cjs +206 -0
  76. package/dist/chunk-RZBLPM3L.cjs.map +1 -0
  77. package/dist/chunk-TA3TNJZU.cjs +360 -0
  78. package/dist/chunk-TA3TNJZU.cjs.map +1 -0
  79. package/dist/chunk-TZSRPTQL.cjs +2141 -0
  80. package/dist/chunk-TZSRPTQL.cjs.map +1 -0
  81. package/dist/chunk-UMTPJ76S.cjs.map +1 -1
  82. package/dist/chunk-UY77FXDW.js +813 -0
  83. package/dist/chunk-UY77FXDW.js.map +1 -0
  84. package/dist/chunk-VFU3S7OC.js +851 -0
  85. package/dist/chunk-VFU3S7OC.js.map +1 -0
  86. package/dist/chunk-VY6WWZSW.cjs.map +1 -1
  87. package/dist/chunk-WN5DZOVT.cjs +170 -0
  88. package/dist/chunk-WN5DZOVT.cjs.map +1 -0
  89. package/dist/chunk-WOPW6WLR.cjs.map +1 -1
  90. package/dist/chunk-XBSIYUHM.cjs +114 -0
  91. package/dist/chunk-XBSIYUHM.cjs.map +1 -0
  92. package/dist/chunk-ZMU72HJS.cjs.map +1 -1
  93. package/dist/context-DSa0ymyN.d.cts +664 -0
  94. package/dist/context-DaxfAg3b.d.ts +664 -0
  95. package/dist/effect-chain-Cu03O5Y0.d.ts +91 -0
  96. package/dist/effect-chain-Do75T7uK.d.cts +91 -0
  97. package/dist/effect.cjs +16 -1
  98. package/dist/effect.cjs.map +1 -1
  99. package/dist/effect.d.cts +56 -14
  100. package/dist/effect.d.ts +56 -14
  101. package/dist/effect.js +16 -1
  102. package/dist/elements.cjs +37 -2
  103. package/dist/elements.cjs.map +1 -1
  104. package/dist/elements.d.cts +197 -8
  105. package/dist/elements.d.ts +197 -8
  106. package/dist/elements.js +36 -1
  107. package/dist/events.cjs.map +1 -1
  108. package/dist/index.cjs +555 -8
  109. package/dist/index.cjs.map +1 -1
  110. package/dist/index.d.cts +16 -4
  111. package/dist/index.d.ts +16 -4
  112. package/dist/index.js +566 -19
  113. package/dist/message.cjs +104 -0
  114. package/dist/message.cjs.map +1 -0
  115. package/dist/message.d.cts +738 -0
  116. package/dist/message.d.ts +738 -0
  117. package/dist/message.js +104 -0
  118. package/dist/meter.cjs.map +1 -1
  119. package/dist/module-control-C25BMtH7.d.ts +61 -0
  120. package/dist/module-control-yH6nTJM9.d.cts +61 -0
  121. package/dist/module-plugin-BnPmq1VP.d.ts +198 -0
  122. package/dist/module-plugin-CHb-5W0Y.d.cts +198 -0
  123. package/dist/module.cjs +263 -0
  124. package/dist/module.cjs.map +1 -0
  125. package/dist/module.d.cts +1112 -0
  126. package/dist/module.d.ts +1112 -0
  127. package/dist/module.js +263 -0
  128. package/dist/parameter-DwQzFmBR.d.cts +172 -0
  129. package/dist/parameter-DwQzFmBR.d.ts +172 -0
  130. package/dist/player.cjs.map +1 -1
  131. package/dist/processor-worklet.cjs +18 -0
  132. package/dist/processor-worklet.cjs.map +1 -0
  133. package/dist/processor-worklet.d.cts +166 -0
  134. package/dist/processor-worklet.d.ts +166 -0
  135. package/dist/processor-worklet.js +18 -0
  136. package/dist/processor-worklet.js.map +1 -0
  137. package/dist/processor.cjs +51 -0
  138. package/dist/processor.cjs.map +1 -0
  139. package/dist/processor.d.cts +397 -0
  140. package/dist/processor.d.ts +397 -0
  141. package/dist/processor.js +51 -0
  142. package/dist/processor.js.map +1 -0
  143. package/dist/project-types-BU4awMnL.d.ts +323 -0
  144. package/dist/project-types-DufCV8Ma.d.cts +323 -0
  145. package/dist/ring-C-i9N90a.d.cts +139 -0
  146. package/dist/ring-DkcMt2Eg.d.ts +139 -0
  147. package/dist/sequence.cjs +68 -0
  148. package/dist/sequence.cjs.map +1 -0
  149. package/dist/sequence.d.cts +303 -0
  150. package/dist/sequence.d.ts +303 -0
  151. package/dist/sequence.js +68 -0
  152. package/dist/sequence.js.map +1 -0
  153. package/dist/session.cjs +16 -0
  154. package/dist/session.cjs.map +1 -0
  155. package/dist/session.d.cts +407 -0
  156. package/dist/session.d.ts +407 -0
  157. package/dist/session.js +16 -0
  158. package/dist/session.js.map +1 -0
  159. package/dist/tick.cjs.map +1 -1
  160. package/dist/transport.cjs +50 -2
  161. package/dist/transport.cjs.map +1 -1
  162. package/dist/transport.d.cts +145 -1
  163. package/dist/transport.d.ts +145 -1
  164. package/dist/transport.js +51 -3
  165. package/dist/worker.cjs.map +1 -1
  166. package/package.json +61 -10
  167. package/dist/chunk-53YD73OY.js +0 -162
  168. package/dist/chunk-53YD73OY.js.map +0 -1
  169. package/dist/chunk-54JYWB5X.cjs +0 -1051
  170. package/dist/chunk-54JYWB5X.cjs.map +0 -1
  171. package/dist/chunk-BR63OD53.cjs +0 -1
  172. package/dist/chunk-BR63OD53.cjs.map +0 -1
  173. package/dist/chunk-ON64FRCF.js +0 -1051
  174. package/dist/chunk-ON64FRCF.js.map +0 -1
  175. package/dist/chunk-SM5YPDDI.cjs +0 -162
  176. package/dist/chunk-SM5YPDDI.cjs.map +0 -1
  177. package/dist/chunk-TEM2I2NN.js +0 -1
  178. package/dist/chunk-VVZX7DQ6.cjs +0 -254
  179. package/dist/chunk-VVZX7DQ6.cjs.map +0 -1
  180. package/dist/chunk-WNFGDB7B.js +0 -254
  181. package/dist/chunk-WNFGDB7B.js.map +0 -1
  182. package/dist/sync.cjs +0 -12
  183. package/dist/sync.cjs.map +0 -1
  184. package/dist/sync.d.cts +0 -307
  185. package/dist/sync.d.ts +0 -307
  186. package/dist/sync.js +0 -12
  187. /package/dist/{chunk-TEM2I2NN.js.map → message.js.map} +0 -0
  188. /package/dist/{sync.js.map → module.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/private/tmp/claude-501/-Users-mamingchen-GitHub-public-WebMusic/77eac0d8-82c0-45c6-aba8-0cd73cfd2b1b/scratchpad/release-0.4.0/platform/kernel/dist/chunk-6HGFEKD3.cjs","../src/sequence/data.ts","../src/sequence/document.ts","../src/sequence/player.ts","../src/sequence/sequencer.ts"],"names":["_disposed","_running","track"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACvBO,IAAM,gBAAA,EAAkB,mBAAA;AACxB,IAAM,iBAAA,EAAmB,CAAA;AAoDhC,IAAM,SAAA,EAAW,CAAC,KAAA,EAAA,GAAqD,OAAO,MAAA,IAAU,SAAA,GAAY,MAAA,IAAU,KAAA,GAAQ,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA;AAE1I,SAAS,UAAA,CAAW,KAAA,EAAgB,IAAA,EAAsB;AACxD,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,SAAA,GAAY,CAAC,KAAA,CAAM,IAAA,CAAK,EAAA,GAAK,MAAA,IAAU,KAAA,CAAM,IAAA,CAAK,CAAA,EAAG,MAAM,IAAI,SAAA,CAAU,CAAA,EAAA;AACvF,EAAA;AACT;AAEoD;AAC6C,EAAA;AACxF,EAAA;AACT;AAEkE;AACsB,EAAA;AACvD,EAAA;AACwD,IAAA;AAC9E,IAAA;AACT,EAAA;AACoE,EAAA;AACyB,EAAA;AACxE,EAAA;AACsB,IAAA;AACuD,IAAA;AACvE,IAAA;AAC3B,EAAA;AAC2C,EAAA;AAC7C;AAEgH;AAEnD;AACY,EAAA;AAC1B,EAAA;AACA,EAAA;AACsC,EAAA;AACU,EAAA;AAC/F;AAE6D;AACY,EAAA;AAC1B,EAAA;AACM,EAAA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;AACnB,EAAA;AACnC,IAAA;AACqB,IAAA;AACE,IAAA;AACJ,IAAA;AACG,IAAA;AACxB,EAAA;AAmCF;AAvFW;AACA;AACA;AACA;AACT;AAZK;AA8DW;AAA2D,EAAA;AAAwC,EAAA;AAAG;AAEvF;AACT,EAAA;AACE,EAAA;AACE,EAAA;AACjB,IAAA;AAAyB,MAAA;AAAM,MAAA;AAAgB,MAAA;AAC/C,IAAA;AAAwB,MAAA;AAAO,MAAA;AAAgB,MAAA;AAC/C,IAAA;AAAY,IAAA;AAA8C,MAAA;AAAG,MAAA;AAAgB,MAAA;AAC7E,IAAA;AAAiD,MAAA;AAAG,MAAA;AACpD,IAAA;AAC+EC,MAAAA;AAClF,MAAA;AACG,IAAA;AAAiF,MAAA;AAAG,MAAA;AAC5E,IAAA;AACyE,MAAA;AACkB,MAAA;AACtE,MAAA;AACqD,MAAA;AACnF,QAAA;AAAM,QAAA;AAA8F,QAAA;AACnG,MAAA;AACH,MAAA;AACF,IAAA;AACc,IAAA;AACwC,MAAA;AAC+B,MAAA;AACxB,MAAA;AAC4B,MAAA;AACvF,MAAA;AACF,IAAA;AACA,IAAA;AAA6E,MAAA;AAC/E,EAAA;AACF;AA7FuB;AADlB;AAkGoF;AACxB,EAAA;AAE3D,IAAA;AAA8B,MAAA;AACpB,IAAA;AAA0F,MAAA;AAAyB,IAAA;AACrH,EAAA;AAChB;AJ6oBiG;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/private/tmp/claude-501/-Users-mamingchen-GitHub-public-WebMusic/77eac0d8-82c0-45c6-aba8-0cd73cfd2b1b/scratchpad/release-0.4.0/platform/kernel/dist/chunk-6HGFEKD3.cjs","sourcesContent":[null,"// Sequence data (DEC-095): timed events on tracks, as plain immutable JSON.\n// A sequence says when things happen, not what plays them: a clip of notes,\n// a lane of messages, a list of marks or parameter values are all tracks of\n// events. Pure functions only; nothing here owns a clock or a resource.\n\nimport type {JsonValue} from '../module/message';\nimport {tickSeconds, type MusicalTempo} from '../transport';\n\nexport const SEQUENCE_SCHEMA = 'webmusic.sequence';\nexport const SEQUENCE_VERSION = 1;\n\n/** The axis event times are written on: musical ticks (480 per quarter note) or seconds. */\nexport type SequenceUnit = 'ticks' | 'seconds';\n\nexport interface SequenceEvent {\n /** Unique within its track. */\n readonly id: string;\n /** Start, on the sequence's axis; finite and not negative. */\n readonly time: number;\n /** Length on the same axis; omitted for an instant. */\n readonly duration?: number;\n /** What the event carries. The track's `kind` says how to read it. */\n readonly value: JsonValue;\n}\n\nexport interface SequenceTrack {\n /** Unique within its sequence. */\n readonly id: string;\n /**\n * How the events' values are read. `note` and `message` are understood by\n * the Kernel's sinks; any other kind is the application's own.\n */\n readonly kind: string;\n readonly label?: string;\n /** A muted track is kept and edited but not played. */\n readonly muted?: boolean;\n /** Ordered by time, then by ID. */\n readonly events: readonly SequenceEvent[];\n}\n\nexport interface Sequence {\n readonly schema: typeof SEQUENCE_SCHEMA;\n readonly version: typeof SEQUENCE_VERSION;\n readonly unit: SequenceUnit;\n /** Where the sequence ends and a loop wraps; the end of its last event when omitted. */\n readonly length?: number;\n readonly tracks: readonly SequenceTrack[];\n}\n\n/** A note track's value: a MIDI pitch and a velocity from 0 to 1. A bare number is a pitch. */\nexport interface SequenceNote { readonly pitch: number; readonly velocity?: number }\n\n/** An event before it has an ID; {@link insertEvents} gives it one. */\nexport type SequenceEventInit = Omit<SequenceEvent, 'id'> & {readonly id?: string};\nexport type SequenceTrackInit = Omit<SequenceTrack, 'events'> & {readonly events?: readonly SequenceEventInit[]};\nexport interface SequenceInit {\n readonly unit?: SequenceUnit;\n readonly length?: number;\n readonly tracks?: readonly SequenceTrackInit[];\n}\n\nconst isObject = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value);\n\nfunction identifier(value: unknown, what: string): string {\n if (typeof value !== 'string' || !value.trim() || value !== value.trim()) throw new TypeError(`${what} must be a nonempty trimmed string.`);\n return value;\n}\n\nfunction span(value: unknown, what: string): number {\n if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) throw new RangeError(`${what} must be a finite number that is not negative.`);\n return value;\n}\n\nfunction json(value: unknown, what: string, depth = 0): JsonValue {\n if (value === null || typeof value === 'boolean' || typeof value === 'string') return value;\n if (typeof value === 'number') {\n if (!Number.isFinite(value)) throw new RangeError(`${what} must hold finite numbers.`);\n return value;\n }\n if (depth > 32) throw new RangeError(`${what} is nested too deeply.`);\n if (Array.isArray(value)) return Object.freeze(value.map(item => json(item, what, depth + 1)));\n if (isObject(value)) {\n const copy: Record<string, JsonValue> = {};\n for (const [key, item] of Object.entries(value)) if (item !== undefined) copy[key] = json(item, what, depth + 1);\n return Object.freeze(copy);\n }\n throw new TypeError(`${what} must be JSON.`);\n}\n\nconst byTime = (a: SequenceEvent, b: SequenceEvent) => a.time - b.time || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0);\n\nfunction event(input: unknown, where: string): SequenceEvent {\n if (!isObject(input)) throw new TypeError(`${where} must be an object.`);\n const id = identifier(input.id, `${where} ID`);\n const time = span(input.time, `${where} time`);\n const value = json(input.value === undefined ? null : input.value, `${where} value`);\n return Object.freeze(input.duration === undefined ? {id, time, value} : {id, time, duration: span(input.duration, `${where} duration`), value});\n}\n\nfunction track(input: unknown, where: string): SequenceTrack {\n if (!isObject(input)) throw new TypeError(`${where} must be an object.`);\n const id = identifier(input.id, `${where} ID`);\n const kind = identifier(input.kind, `${where} kind`);\n if (input.label !== undefined && typeof input.label !== 'string') throw new TypeError(`${where} label must be text.`);\n if (input.muted !== undefined && typeof input.muted !== 'boolean') throw new TypeError(`${where} muted must be true or false.`);\n if (input.events !== undefined && !Array.isArray(input.events)) throw new TypeError(`${where} events must be a list.`);\n const events = ((input.events as unknown[] | undefined) ?? []).map((item, index) => event(item, `${where} event ${index}`));\n const seen = new Set<string>();\n for (const item of events) {\n if (seen.has(item.id)) throw new Error(`${where} has two events with the ID ${item.id}.`);\n seen.add(item.id);\n }\n return Object.freeze({\n id, kind,\n ...(input.label === undefined ? {} : {label: input.label as string}),\n ...(input.muted ? {muted: true} : {}),\n events: Object.freeze(events.sort(byTime)),\n });\n}\n\n/**\n * Read a sequence from untrusted JSON: validate it, order its events and\n * freeze the result. Throws a readable TypeError, RangeError or Error and\n * never returns a partly valid sequence.\n */\nexport function parseSequence(input: unknown): Sequence {\n if (!isObject(input)) throw new TypeError('A sequence must be an object.');\n if (input.schema !== SEQUENCE_SCHEMA) throw new TypeError(`A sequence's schema must be ${SEQUENCE_SCHEMA}.`);\n if (input.version !== SEQUENCE_VERSION) throw new RangeError(`Sequence version ${String(input.version)} is not supported; this build reads version ${SEQUENCE_VERSION}.`);\n if (input.unit !== 'ticks' && input.unit !== 'seconds') throw new TypeError('A sequence\\'s unit must be ticks or seconds.');\n if (!Array.isArray(input.tracks)) throw new TypeError('A sequence\\'s tracks must be a list.');\n const tracks = input.tracks.map((item, index) => track(item, `Track ${index}`));\n const seen = new Set<string>();\n for (const item of tracks) {\n if (seen.has(item.id)) throw new Error(`A sequence has two tracks with the ID ${item.id}.`);\n seen.add(item.id);\n }\n return Object.freeze({\n schema: SEQUENCE_SCHEMA, version: SEQUENCE_VERSION, unit: input.unit,\n ...(input.length === undefined ? {} : {length: span(input.length, 'A sequence\\'s length')}),\n tracks: Object.freeze(tracks),\n });\n}\n\n/** Events without an ID get `e1`, `e2`… above the highest such ID already used. */\nfunction withIds(existing: readonly SequenceEvent[], added: readonly SequenceEventInit[]): unknown[] {\n let next = 0;\n const used = new Set<string>();\n const note = (id: string) => {\n used.add(id);\n const match = /^e(\\d+)$/.exec(id);\n if (match) next = Math.max(next, Number(match[1]));\n };\n for (const item of existing) note(item.id);\n for (const item of added) if (item.id !== undefined) note(item.id);\n return added.map(item => {\n if (item.id !== undefined) return item;\n let id: string;\n do { id = `e${++next}`; } while (used.has(id));\n used.add(id);\n return {...item, id};\n });\n}\n\n/** A new sequence, in ticks unless `unit` says seconds. */\nexport function createSequence(init: SequenceInit = {}): Sequence {\n return parseSequence({\n schema: SEQUENCE_SCHEMA, version: SEQUENCE_VERSION, unit: init.unit ?? 'ticks',\n ...(init.length === undefined ? {} : {length: init.length}),\n tracks: (init.tracks ?? []).map(item => ({...item, events: withIds([], item.events ?? [])})),\n });\n}\n\nfunction trackOf(sequence: Sequence, trackId: string): SequenceTrack {\n const found = sequence.tracks.find(item => item.id === trackId);\n if (!found) throw new Error(`The sequence has no track ${trackId}.`);\n return found;\n}\n\nfunction replaceTrack(sequence: Sequence, trackId: string, change: (track: SequenceTrack) => unknown): Sequence {\n trackOf(sequence, trackId);\n return parseSequence({...sequence, tracks: sequence.tracks.map(item => item.id === trackId ? change(item) : item)});\n}\n\n/** Add a track at `index`, or at the end. */\nexport function addTrack(sequence: Sequence, init: SequenceTrackInit, index = sequence.tracks.length): Sequence {\n const tracks: unknown[] = [...sequence.tracks];\n tracks.splice(Math.max(0, Math.min(tracks.length, Math.trunc(index))), 0, {...init, events: withIds([], init.events ?? [])});\n return parseSequence({...sequence, tracks});\n}\n\nexport function removeTrack(sequence: Sequence, trackId: string): Sequence {\n trackOf(sequence, trackId);\n return parseSequence({...sequence, tracks: sequence.tracks.filter(item => item.id !== trackId)});\n}\n\n/** Change a track's label, kind or muted state; its ID and events stay. */\nexport function updateTrack(sequence: Sequence, trackId: string, change: Partial<Pick<SequenceTrack, 'kind' | 'label' | 'muted'>>): Sequence {\n return replaceTrack(sequence, trackId, item => ({...item, ...change}));\n}\n\n/** Add events to a track. An event without an ID is given the next free `e<n>`. */\nexport function insertEvents(sequence: Sequence, trackId: string, events: readonly SequenceEventInit[]): Sequence {\n return replaceTrack(sequence, trackId, item => ({...item, events: [...item.events, ...withIds(item.events, events)]}));\n}\n\n/** Remove the named events; IDs the track does not hold are ignored. */\nexport function removeEvents(sequence: Sequence, trackId: string, ids: Iterable<string>): Sequence {\n const gone = new Set(ids);\n return replaceTrack(sequence, trackId, item => ({...item, events: item.events.filter(entry => !gone.has(entry.id))}));\n}\n\n/** Rewrite the named events (every event when `ids` is omitted); the ID of each is kept. */\nexport function updateEvents(\n sequence: Sequence, trackId: string, ids: Iterable<string> | undefined,\n change: Partial<Omit<SequenceEvent, 'id'>> | ((event: SequenceEvent) => Partial<Omit<SequenceEvent, 'id'>>),\n): Sequence {\n const chosen = ids === undefined ? undefined : new Set(ids);\n return replaceTrack(sequence, trackId, item => ({...item, events: item.events.map(entry => {\n if (chosen && !chosen.has(entry.id)) return entry;\n return {...entry, ...(typeof change === 'function' ? change(entry) : change), id: entry.id};\n })}));\n}\n\n/** Move the named events by `delta`; an event never starts before 0. */\nexport function shiftEvents(sequence: Sequence, trackId: string, ids: Iterable<string> | undefined, delta: number): Sequence {\n if (!Number.isFinite(delta)) throw new RangeError('A shift must be a finite number.');\n return updateEvents(sequence, trackId, ids, entry => ({time: Math.max(0, entry.time + delta)}));\n}\n\nexport interface QuantizeOptions {\n /** How far each start moves toward the grid, 0 to 1. Default 1. */\n readonly strength?: number;\n /** Also round durations to the grid, never below one grid step. Default false. */\n readonly durations?: boolean;\n}\n\n/** Move the named events' starts toward the nearest multiple of `grid`. */\nexport function quantizeEvents(sequence: Sequence, trackId: string, ids: Iterable<string> | undefined, grid: number, options: QuantizeOptions = {}): Sequence {\n if (!(grid > 0) || !Number.isFinite(grid)) throw new RangeError('A quantize grid must be a positive number.');\n const strength = options.strength ?? 1;\n if (!(strength >= 0 && strength <= 1)) throw new RangeError('Quantize strength must be from 0 to 1.');\n return updateEvents(sequence, trackId, ids, entry => {\n const time = Math.max(0, entry.time + (Math.round(entry.time / grid) * grid - entry.time) * strength);\n return options.durations && entry.duration !== undefined ? {time, duration: Math.max(grid, Math.round(entry.duration / grid) * grid)} : {time};\n });\n}\n\n/** Set where the sequence ends, or let it end with its last event again. */\nexport function setSequenceLength(sequence: Sequence, length: number | undefined): Sequence {\n const {length: _previous, ...rest} = sequence;\n return parseSequence(length === undefined ? rest : {...rest, length});\n}\n\n/** Where a sequence ends: its `length`, or the end of its last event. */\nexport function sequenceEnd(sequence: Sequence): number {\n if (sequence.length !== undefined) return sequence.length;\n let end = 0;\n for (const item of sequence.tracks) for (const entry of item.events) end = Math.max(end, entry.time + (entry.duration ?? 0));\n return end;\n}\n\n/** Index of the first event at or after `time` (after it, when `inclusive` is false). */\nexport function eventIndexAt(events: readonly SequenceEvent[], time: number, inclusive = true): number {\n let low = 0, high = events.length;\n while (low < high) {\n const middle = (low + high) >>> 1;\n const before = inclusive ? events[middle]!.time < time : events[middle]!.time <= time;\n if (before) low = middle + 1; else high = middle;\n }\n return low;\n}\n\n/** The events of a track that start in `[start, end)`. */\nexport function eventsBetween(track: SequenceTrack, start: number, end: number): readonly SequenceEvent[] {\n return track.events.slice(eventIndexAt(track.events, start), eventIndexAt(track.events, end));\n}\n\n/**\n * The part of a sequence in `[start, end)` as a sequence of its own: events\n * that start there, moved to begin at 0, with durations cut at the end.\n */\nexport function sliceSequence(sequence: Sequence, start: number, end: number): Sequence {\n if (!(end >= start) || !(start >= 0) || !Number.isFinite(end)) throw new RangeError('A slice needs 0 <= start <= end.');\n return parseSequence({\n ...sequence, length: end - start,\n tracks: sequence.tracks.map(item => ({...item, events: eventsBetween(item, start, end).map(entry => ({\n ...entry, time: entry.time - start,\n ...(entry.duration === undefined ? {} : {duration: Math.min(entry.duration, end - entry.time)}),\n }))})),\n });\n}\n\n/** A span of the sequence's axis in seconds; ticks follow `tempo`. */\nexport function sequenceSeconds(sequence: Pick<Sequence, 'unit'>, time: number, tempo: MusicalTempo): number {\n return sequence.unit === 'ticks' ? time * tickSeconds(tempo) : time;\n}\n\n/** Seconds as a span of the sequence's axis; ticks follow `tempo`. */\nexport function sequenceTime(sequence: Pick<Sequence, 'unit'>, seconds: number, tempo: MusicalTempo): number {\n return sequence.unit === 'ticks' ? seconds / tickSeconds(tempo) : seconds;\n}\n\n/** Read a note track's value: `{pitch, velocity}` or a bare pitch. Undefined when it is neither. */\nexport function sequenceNote(value: JsonValue): SequenceNote | undefined {\n if (typeof value === 'number') return value >= 0 && value <= 127 ? {pitch: value} : undefined;\n if (!isObject(value)) return undefined;\n const {pitch, velocity} = value as {pitch?: unknown; velocity?: unknown};\n if (typeof pitch !== 'number' || !(pitch >= 0 && pitch <= 127)) return undefined;\n if (velocity === undefined) return {pitch};\n return typeof velocity === 'number' && velocity >= 0 && velocity <= 1 ? {pitch, velocity} : undefined;\n}\n","// SequenceDocument (DEC-095): the one owner that commits a sequence's content\n// and its revision, with optional bounded history. It owns no clock, player\n// or view; those borrow its snapshot and subscribe.\n\nimport {createSequence, parseSequence, type Sequence} from './data';\n\nexport interface SequenceDocumentSnapshot {\n readonly sequence: Sequence;\n /** Rises by one with every commit, undo and redo. */\n readonly revision: number;\n readonly canUndo: boolean;\n readonly canRedo: boolean;\n}\n\nexport interface SequenceDocumentOptions {\n /** How many earlier sequences undo can return to. 0 keeps no history. Default 100. */\n readonly historyLimit?: number;\n /** Receives a listener's failure; a failing listener never stops a commit. */\n readonly onListenerError?: (error: unknown) => void;\n}\n\nexport class SequenceDocument {\n #sequence: Sequence;\n #revision = 0;\n #disposed = false;\n readonly #limit: number;\n readonly #undo: Sequence[] = [];\n readonly #redo: Sequence[] = [];\n readonly #listeners = new Set<{listener: () => void}>();\n readonly #onListenerError?: (error: unknown) => void;\n #snapshot: SequenceDocumentSnapshot | undefined;\n\n /** `initial` is validated as untrusted JSON; an empty sequence in ticks when omitted. */\n constructor(initial?: unknown, options: SequenceDocumentOptions = {}) {\n const limit = options.historyLimit ?? 100;\n if (!Number.isInteger(limit) || limit < 0) throw new RangeError('historyLimit must be an integer that is not negative.');\n this.#limit = limit;\n this.#onListenerError = options.onListenerError;\n this.#sequence = initial === undefined ? createSequence() : parseSequence(initial);\n }\n\n get disposed(): boolean { return this.#disposed; }\n\n /** The committed state; the same object until the next change. */\n get snapshot(): SequenceDocumentSnapshot {\n return this.#snapshot ??= Object.freeze({\n sequence: this.#sequence, revision: this.#revision, canUndo: this.#undo.length > 0, canRedo: this.#redo.length > 0,\n });\n }\n\n /**\n * Replace the sequence with `next`, or with what `next` makes of the\n * current one. The result is validated before anything changes; a change\n * that throws leaves the document as it was. Returning the current\n * sequence commits nothing. Returns the revision now current.\n */\n commit(next: Sequence | ((current: Sequence) => Sequence)): number {\n this.#alive();\n const candidate = typeof next === 'function' ? next(this.#sequence) : next;\n if (candidate === this.#sequence) return this.#revision;\n const sequence = parseSequence(candidate);\n if (this.#limit > 0) {\n this.#undo.push(this.#sequence);\n if (this.#undo.length > this.#limit) this.#undo.shift();\n }\n this.#redo.length = 0;\n return this.#install(sequence);\n }\n\n /** Return to the sequence before the last commit. False when there is none. */\n undo(): boolean {\n this.#alive();\n const previous = this.#undo.pop();\n if (!previous) return false;\n this.#redo.push(this.#sequence);\n this.#install(previous);\n return true;\n }\n\n /** Reapply the commit last undone. False when there is none. */\n redo(): boolean {\n this.#alive();\n const next = this.#redo.pop();\n if (!next) return false;\n this.#undo.push(this.#sequence);\n this.#install(next);\n return true;\n }\n\n /** Called after every change, with the new state already readable from `snapshot`. */\n subscribe(listener: () => void): () => void {\n this.#alive();\n if (typeof listener !== 'function') throw new TypeError('Listener must be a function.');\n const entry = {listener};\n this.#listeners.add(entry);\n return () => { this.#listeners.delete(entry); };\n }\n\n /** Drop history and listeners. The last snapshot stays readable; changes throw. */\n dispose(): void {\n if (this.#disposed) return;\n this.#disposed = true;\n this.#undo.length = 0;\n this.#redo.length = 0;\n this.#listeners.clear();\n this.#snapshot = undefined;\n }\n\n #alive(): void { if (this.#disposed) throw new Error('SequenceDocument is disposed.'); }\n\n #install(sequence: Sequence): number {\n this.#sequence = sequence;\n this.#revision++;\n this.#snapshot = undefined;\n for (const entry of [...this.#listeners]) {\n if (!this.#listeners.has(entry)) continue;\n try { entry.listener(); } catch (error) { try { this.#onListenerError?.(error); } catch { /* Reporting never stops a commit. */ } }\n }\n return this.#revision;\n }\n}\n","// SequencePlayer (DEC-095): plays a sequence against a borrowed transport.\n// It reads positions from a time source (a Session's musical time), asks a\n// borrowed clock to call it shortly before each event is due, and hands the\n// events to sinks with their exact time. It makes no sound and owns no clock.\n//\n// Ownership: the player owns its subscription to the time source, the one\n// clock event it has pending and nothing else. Sinks, the clock, the time\n// source and the sequence are borrowed.\n\nimport {NoteOutputPort, type NoteEvent} from '../module/note-port';\nimport {message, floatAtom, parseMessage, type Message} from '../module/message';\nimport type {MusicalTempo} from '../transport';\nimport {eventIndexAt, sequenceEnd, sequenceNote, sequenceSeconds, type Sequence, type SequenceEvent, type SequenceTrack} from './data';\n\n/** What the player reads time from. A Kernel `MusicalTimeSource` is one. */\nexport interface SequenceTimeSource {\n tempo(): MusicalTempo;\n playing(): boolean;\n /** Transport position in seconds. */\n position(): number;\n /** Clock time at which the transport reaches `position`; undefined while it is not playing. */\n timeAt(position: number): number | undefined;\n /** Notified after play, pause, seek, a loop jump and a tempo change. */\n subscribe(listener: () => void): () => void;\n}\n\n/** What the player schedules on. A Kernel `MessageClock` is one. */\nexport interface SequenceClock {\n now(): number;\n schedule(time: number, callback: (time: number) => void): () => void;\n}\n\nexport interface SequencePlayedEvent {\n readonly track: SequenceTrack;\n readonly event: SequenceEvent;\n /** Clock time the event starts at: slightly ahead of `clock.now()`, or just behind it when the event is late. */\n readonly time: number;\n /** The event's duration in clock seconds, at the transport's current tempo and rate. */\n readonly duration?: number;\n /** How many times the sequence had looped before this event; 0 on the first pass. */\n readonly pass: number;\n}\n\nexport interface SequenceSink {\n event(played: SequencePlayedEvent): void;\n /**\n * The timeline broke at clock time `time` (pause, seek, loop jump, tempo\n * change, stop): release what is sounding and drop what was scheduled.\n */\n invalidate?(time: number): void;\n}\n\nexport interface SequencePlayerOptions {\n /** The sequence to play now; read again whenever the player schedules. */\n read(): Sequence;\n time: SequenceTimeSource;\n clock: SequenceClock;\n /** Sinks by track kind. `'*'` receives the kinds that have no sink of their own. */\n sinks: Readonly<Record<string, SequenceSink>>;\n /** Repeat from the start when the sequence ends. Default false. */\n loop?: boolean;\n /** Transport position, in seconds, at which the sequence begins. Default 0. */\n offset?: number;\n /** Called once when a sequence that does not loop reaches its end, with the clock time. */\n onEnd?(time: number): void;\n /** Receives a sink's or callback's failure; playback continues. */\n onError?(error: unknown): void;\n /**\n * After the timeline breaks, events that started up to this many seconds\n * before the new position still play, at once. Default 0.02.\n */\n catchUp?: number;\n}\n\n/** How far behind the clock a continuing event may be before the player rejoins the transport instead. */\nconst LATE_LIMIT = 0.1;\n\n/** The last event group handed out, used to continue without repeating or skipping. */\ninterface Mark { pass: number; time: number; position: number; when: number; scale: number; fired: number }\n\nexport class SequencePlayer {\n readonly #options: SequencePlayerOptions;\n readonly #catchUp: number;\n #loop: boolean;\n #offset: number;\n #running = false;\n #disposed = false;\n #cancel: (() => void) | undefined;\n #release: (() => void) | undefined;\n #mark: Mark | undefined;\n /** Whether sinks may hold work from a timeline that is still current. */\n #live = false;\n #ended = false;\n /** Where the transport stood when it was last seen not playing. */\n #pausedAt: number | undefined;\n\n constructor(options: SequencePlayerOptions) {\n if (typeof options?.read !== 'function') throw new TypeError('A sequence player needs read().');\n if (!options.time || !options.clock || !options.sinks) throw new TypeError('A sequence player needs a time source, a clock and sinks.');\n const offset = options.offset ?? 0, catchUp = options.catchUp ?? 0.02;\n if (!Number.isFinite(offset)) throw new RangeError('offset must be finite.');\n if (!(catchUp >= 0) || !Number.isFinite(catchUp)) throw new RangeError('catchUp must be a finite number that is not negative.');\n this.#options = options;\n this.#loop = options.loop ?? false;\n this.#offset = offset;\n this.#catchUp = catchUp;\n }\n\n get running(): boolean { return this.#running; }\n get disposed(): boolean { return this.#disposed; }\n get loop(): boolean { return this.#loop; }\n set loop(value: boolean) { this.#alive(); if (this.#loop === value) return; this.#loop = value; this.#ended = false; if (this.#running) this.#schedule(); }\n get offset(): number { return this.#offset; }\n set offset(value: number) {\n this.#alive();\n if (!Number.isFinite(value)) throw new RangeError('offset must be finite.');\n if (this.#offset === value) return;\n this.#offset = value;\n this.#break();\n if (this.#running) this.#schedule();\n }\n\n /** Follow the transport: events play while it plays. Starting twice changes nothing. */\n start(): void {\n this.#alive();\n if (this.#running) return;\n this.#running = true;\n this.#release = this.#options.time.subscribe(() => { if (this.#running) this.#schedule(); });\n this.#schedule();\n }\n\n /** Stop following the transport and release what the sinks hold. */\n stop(): void {\n if (!this.#running) return;\n this.#running = false;\n this.#release?.(); this.#release = undefined;\n this.#cancel?.(); this.#cancel = undefined;\n this.#break();\n }\n\n /** The sequence changed: schedule again from what `read()` returns now. Sounding events finish. */\n refresh(): void {\n this.#alive();\n this.#ended = false;\n if (this.#running) this.#schedule();\n }\n\n dispose(): void {\n if (this.#disposed) return;\n this.stop();\n this.#disposed = true;\n }\n\n #alive(): void { if (this.#disposed) throw new Error('SequencePlayer is disposed.'); }\n\n #guard(work: () => void): void {\n try { work(); } catch (error) { try { this.#options.onError?.(error); } catch { /* Reporting never stops playback. */ } }\n }\n\n /** Forget the continuation point and tell the sinks the timeline broke. */\n #break(): void {\n this.#mark = undefined;\n this.#ended = false;\n if (!this.#live) return;\n this.#live = false;\n const now = this.#options.clock.now();\n for (const sink of new Set(Object.values(this.#options.sinks))) this.#guard(() => sink.invalidate?.(now));\n }\n\n #schedule(): void {\n this.#cancel?.(); this.#cancel = undefined;\n const {time, clock} = this.#options;\n if (!this.#running) { this.#break(); return; }\n if (!time.playing()) { this.#pausedAt = time.position(); this.#break(); return; }\n // Resuming where it paused repeats nothing; any other break may arrive a moment late.\n const resumed = this.#pausedAt !== undefined && Math.abs(time.position() - this.#pausedAt) < 1e-6;\n this.#pausedAt = undefined;\n let sequence: Sequence;\n try { sequence = this.#options.read(); } catch (error) { this.#guard(() => { throw error; }); return; }\n const scale = sequenceSeconds(sequence, 1, time.tempo());\n const end = sequenceEnd(sequence);\n const length = end * scale;\n // A loop shorter than a millisecond would never let the clock catch up.\n const looping = this.#loop && length >= 0.001;\n\n // Continue after the last group only if the transport still maps it to the same instant.\n const mark = this.#mark;\n let recent: Mark | undefined;\n if (mark) {\n const when = time.timeAt(mark.position);\n if (when === undefined || Math.abs(when - mark.when) > 1e-4 || mark.scale !== scale) { recent = mark; this.#break(); }\n }\n\n let pass: number, cursor: number, inclusive: boolean, exact: number;\n if (this.#mark) {\n pass = this.#mark.pass; cursor = this.#mark.time; inclusive = false; exact = cursor;\n } else {\n const local = time.position() - this.#offset;\n pass = looping && local > 0 ? Math.floor(local / length) : 0;\n const within = Math.max(0, local - pass * length);\n exact = within / scale;\n // A group that just started still plays; one this player already handed out does not.\n cursor = Math.max(0, (within - (resumed ? 0 : this.#catchUp)) / scale - 1e-9);\n inclusive = true;\n }\n\n let next = this.#next(sequence, cursor, inclusive, end);\n if (next !== undefined && recent && next < exact - 1e-9 && next === recent.time && clock.now() - recent.fired < this.#catchUp) {\n next = this.#next(sequence, next, false, end);\n }\n if (next === undefined && looping) {\n const wrapped = this.#next(sequence, 0, true, end);\n if (wrapped === undefined) return;\n pass++; next = wrapped;\n }\n if (next === undefined) {\n // Nothing left: tell the owner once when the end passes.\n if (this.#ended || !this.#options.onEnd) return;\n const when = time.timeAt(this.#offset + length);\n if (when === undefined) return;\n this.#cancel = clock.schedule(when, at => {\n this.#cancel = undefined;\n if (!this.#running || this.#ended) return;\n this.#ended = true;\n this.#guard(() => this.#options.onEnd!(at));\n });\n return;\n }\n\n const at = next, position = this.#offset + pass * length + at * scale;\n const when = time.timeAt(position);\n if (when === undefined) return;\n // The clock fell far behind (a throttled page): do not play the backlog at once, rejoin the transport.\n if (this.#mark && clock.now() - when > LATE_LIMIT) { this.#break(); this.#schedule(); return; }\n const group = pass;\n // A late event keeps its own time, so events that were due together stay apart.\n this.#cancel = clock.schedule(when, fired => {\n this.#cancel = undefined;\n if (!this.#running) return;\n if (clock.now() - when > LATE_LIMIT) { this.#break(); this.#schedule(); return; }\n this.#mark = {pass: group, time: at, position, when, scale, fired: clock.now()};\n this.#live = true;\n this.#emit(sequence, at, fired, group, position, scale);\n this.#schedule();\n });\n }\n\n /** The earliest start among unmuted tracks at or after `cursor`, before the sequence's end. */\n #next(sequence: Sequence, cursor: number, inclusive: boolean, end: number): number | undefined {\n let found: number | undefined;\n for (const track of sequence.tracks) {\n if (track.muted) continue;\n const entry = track.events[eventIndexAt(track.events, cursor, inclusive)];\n if (!entry) continue;\n // An event at or past a set length belongs to no pass.\n if (sequence.length !== undefined && entry.time >= end) continue;\n if (found === undefined || entry.time < found) found = entry.time;\n }\n return found;\n }\n\n #emit(sequence: Sequence, at: number, fired: number, pass: number, position: number, scale: number): void {\n const {time, sinks} = this.#options;\n for (const track of sequence.tracks) {\n if (track.muted) continue;\n const sink = sinks[track.kind] ?? sinks['*'];\n if (!sink) continue;\n const events = track.events;\n for (let index = eventIndexAt(events, at); index < events.length && events[index]!.time === at; index++) {\n const event = events[index]!;\n let duration: number | undefined;\n if (event.duration !== undefined) {\n const until = time.timeAt(position + event.duration * scale);\n const from = time.timeAt(position);\n duration = until !== undefined && from !== undefined ? Math.max(0, until - from) : event.duration * scale;\n }\n const played: SequencePlayedEvent = Object.freeze(duration === undefined ? {track, event, time: fired, pass} : {track, event, time: fired, duration, pass});\n this.#guard(() => sink.event(played));\n }\n }\n }\n}\n\nexport interface NoteSinkOptions {\n /** The port the notes leave from; borrowed. */\n port: NoteOutputPort;\n clock: SequenceClock;\n /** The `sourceId` of every note. Defaults to the port's ID. */\n sourceId?: string;\n /** Scheduling generation at attack; defaults to 0 without a Session. */\n epoch?(): number;\n /** Seconds a note without a duration sounds. Default 0.1. */\n defaultDuration?: number;\n /** Velocity of a note that names none, 0 to 1. Default 0.8. */\n defaultVelocity?: number;\n}\n\n/**\n * A sink for `note` tracks: each event becomes a note on the port at its\n * time and is released after its duration. Invalidating releases every note\n * this sink still holds; it never touches another producer's notes.\n */\nexport function createNoteSink(options: NoteSinkOptions): SequenceSink & {dispose(): void} {\n const {port, clock} = options;\n const sourceId = options.sourceId ?? port.id;\n const defaultDuration = options.defaultDuration ?? 0.1, defaultVelocity = options.defaultVelocity ?? 0.8;\n const pending = new Map<string, {cancel: () => void; on: NoteEvent}>();\n let count = 0;\n let disposed = false;\n const release = (id: string, time: number) => {\n const held = pending.get(id);\n if (!held) return;\n pending.delete(id);\n held.cancel();\n if (!port.disposed && port.held.some(event => event.occurrenceId === id)) port.emit({...held.on, velocity: 0, gate: 'off', time: Math.max(time, held.on.time)});\n };\n return {\n event(played) {\n if (disposed || port.disposed) return;\n const note = sequenceNote(played.event.value);\n if (!note) return;\n const occurrenceId = `${sourceId}-${played.track.id}-${++count}`;\n const on: NoteEvent = {\n occurrenceId, sourceId, pitch: {midi: note.pitch}, velocity: note.velocity ?? defaultVelocity,\n gate: 'on', axis: 'audio-context-seconds', time: played.time, epoch: options.epoch?.() ?? 0,\n };\n port.emit(on);\n const end = played.time + Math.max(0.001, played.duration ?? defaultDuration);\n pending.set(occurrenceId, {on, cancel: clock.schedule(end, at => release(occurrenceId, at))});\n },\n invalidate(time) { for (const id of [...pending.keys()]) release(id, time); },\n dispose() {\n if (disposed) return;\n for (const id of [...pending.keys()]) release(id, clock.now());\n disposed = true;\n },\n };\n}\n\n/**\n * A sink for `message` tracks: a text value is parsed as a message, a number\n * becomes a `float`, and anything else is skipped. `send` receives the\n * message stamped with the event's time.\n */\nexport function createMessageSink(send: (track: SequenceTrack, value: Message, played: SequencePlayedEvent) => void): SequenceSink {\n return {\n event(played) {\n const value = played.event.value;\n if (typeof value === 'number') send(played.track, message('float', [floatAtom(value)], played.time), played);\n else if (typeof value === 'string' && value.trim()) send(played.track, parseMessage(value, played.time), played);\n },\n };\n}\n","// Sequencer (DEC-095, DEC-097): a sequence as a module. It holds a Kernel\n// sequence, plays it on its context's Session through a SequencePlayer, sends\n// `note` tracks to its `notes` port and `message` tracks to its `events`\n// output, and lends its SequenceDocument to whatever edits it.\n//\n// Ownership: it owns its document, player, sinks and ports and releases them\n// on dispose. The Session's musical time and the clock are borrowed.\n\nimport {createCapabilityKey, ModuleCapabilities, type CapabilityKey} from '../module/capability';\nimport {GraphModule, type GraphModuleOptions, type ModuleOptionsJson} from '../module/graph-module';\nimport {\n atomsOf, bang, formatMessage, isNumberAtom, message, messageFromAtoms,\n type Atom, type Message, type MessageOutputPort,\n} from '../module/message';\nimport {modulePlugin, type ModuleEnvironment} from '../module/module-plugin';\nimport {NoteOutputPort} from '../module/note-port';\nimport {ProjectModuleUnavailableError, type ProjectJson, type ProjectPluginFactory} from '../module/project-types';\nimport type {ModuleHandle} from '../module/registry';\nimport {addTrack, insertEvents, setSequenceLength, type Sequence} from './data';\nimport {SequenceDocument} from './document';\nimport {SequencePlayer, createMessageSink, createNoteSink} from './player';\n\n/** The capability under which a sequencer lends the document it plays. */\nexport const SEQUENCE_DOCUMENT: CapabilityKey<SequenceDocument> = createCapabilityKey<SequenceDocument>('webmusic.sequence-document');\n\n/** The sequence document of a sequencer module, to read, edit and subscribe to. */\nexport function sequenceDocumentOf(module: ModuleHandle | undefined): SequenceDocument | undefined {\n return module?.capabilities?.get(SEQUENCE_DOCUMENT);\n}\n\nexport interface SequencerOptions extends GraphModuleOptions {\n /** The sequence to hold: a `Sequence`, or its saved JSON. Default: an empty one. */\n readonly sequence?: unknown;\n /** Start again from the beginning at the end. Default false. */\n readonly loop?: boolean;\n /** Follow the transport when activated. Default true. */\n readonly running?: boolean;\n}\n\nconst number = (atom: Atom | undefined): number | undefined => isNumberAtom(atom) ? atom.value : undefined;\nconst word = (atom: Atom | undefined): string | undefined => atom?.type === 'symbol' ? atom.value : isNumberAtom(atom) ? String(atom.value) : undefined;\n\n/** The track to add an event to, made with `kind` when the sequence has none of that ID. */\nfunction ensureTrack(sequence: Sequence, id: string, kind: string): Sequence {\n const found = sequence.tracks.find(track => track.id === id);\n if (!found) return addTrack(sequence, {id, kind});\n if (found.kind !== kind) throw new Error(`Track ${id} holds ${found.kind} events, not ${kind}.`);\n return sequence;\n}\n\n/**\n * Plays the sequence it holds while the transport plays. Needs the musical\n * time of a Session, from its context or the `musicalTime` option.\n *\n * `control` input: `start`/1 and `stop`/0 turn following on and off; `loop\n * 0/1`; `note track time duration pitch [velocity 0–127]` and `event track\n * time message…` add an event, on the sequence's own axis; `length n` sets\n * where it ends (`length` alone lets it end with its last event); `clear`\n * empties every track. Outputs: `notes`; `events`, each `message` track's\n * events as `<track> message…`; `done`, a bang when a sequence that does not\n * loop ends.\n */\nexport class Sequencer extends GraphModule {\n static readonly type = 'webmusic.sequencer';\n readonly inputs = {control: this.input('control', 'start, stop, loop, note, event, length, clear', value => this.#receive(value))};\n /** The notes of the `note` tracks, on the audio clock. */\n readonly notes: NoteOutputPort;\n readonly outputs: {readonly events: MessageOutputPort; readonly done: MessageOutputPort};\n /** The sequence it plays, to read, edit and subscribe to. */\n readonly document: SequenceDocument;\n readonly #player: SequencePlayer;\n readonly #noteSink: ReturnType<typeof createNoteSink>;\n readonly #unsubscribe: () => void;\n readonly #capabilities: ModuleCapabilities;\n #running: boolean;\n\n constructor(options: SequencerOptions = {}) {\n super(Sequencer.type, options);\n const musical = this.musicalTime;\n if (!musical) throw new TypeError('A sequencer needs the musical time of a Session; this graph has none.');\n this.document = new SequenceDocument(options.sequence === undefined ? undefined : options.sequence as never);\n this.#running = typeof options.running === 'boolean' ? options.running : true;\n this.notes = new NoteOutputPort({id: 'notes', onListenerError: error => this.fail(error)});\n this.addPort(this.notes, {id: 'notes', label: 'notes', kind: 'note', direction: 'output'});\n this.outputs = {events: this.output('events', 'track message…'), done: this.output('done', 'bang at the end')};\n this.#capabilities = new ModuleCapabilities().with(SEQUENCE_DOCUMENT, this.document);\n const clock = this.clock;\n this.#noteSink = createNoteSink({port: this.notes, clock, sourceId: this.id, epoch: () => this.context?.session?.scheduling.epoch ?? 0});\n this.#player = new SequencePlayer({\n read: () => this.document.snapshot.sequence,\n time: musical,\n clock,\n sinks: {\n note: this.#noteSink,\n message: createMessageSink((track, value) => this.outputs.events.send(message(track.id, atomsOf(value), value.time))),\n },\n loop: options.loop === true,\n onEnd: time => this.outputs.done.send(bang(time)),\n onError: error => this.fail(error),\n });\n this.#unsubscribe = this.document.subscribe(() => { if (!this.disposed) this.#player.refresh(); });\n }\n\n override get capabilities(): ModuleCapabilities { return this.#capabilities; }\n /** Whether it follows the transport. */\n get running(): boolean { return this.#running; }\n get loop(): boolean { return this.#player.loop; }\n set loop(value: boolean) { this.#player.loop = value; }\n /** Follow the transport. Activates the module if it is not yet active. */\n start(): void { this.#running = true; if (!this.active) this.activate(); else this.#follow(); }\n stop(): void { this.#running = false; this.#follow(); }\n\n exportOptions(): ModuleOptionsJson {\n return {sequence: this.document.snapshot.sequence as unknown as ProjectJson, running: this.#running, loop: this.#player.loop};\n }\n protected override onActivate(): void { this.#follow(); }\n protected override onDispose(): void {\n this.#unsubscribe();\n this.#player.dispose();\n this.#noteSink.dispose();\n this.notes.dispose();\n this.document.dispose();\n }\n\n #follow(): void { if (this.#running && this.active && !this.disposed) this.#player.start(); else this.#player.stop(); }\n\n #receive(value: Message): void {\n const atoms = value.atoms;\n const document = this.document;\n switch (value.selector) {\n case 'start': this.#running = true; this.#follow(); return;\n case 'stop': this.#running = false; this.#follow(); return;\n case 'int': case 'float': this.#running = number(atoms[0]) !== 0; this.#follow(); return;\n case 'loop': this.#player.loop = number(atoms[0]) !== 0; return;\n case 'clear':\n document.commit(current => ({...current, tracks: current.tracks.map(track => ({...track, events: []}))}));\n return;\n case 'length': document.commit(current => setSequenceLength(current, number(atoms[0]))); return;\n case 'note': {\n const track = word(atoms[0]), time = number(atoms[1]), duration = number(atoms[2]), pitch = number(atoms[3]);\n if (track === undefined || time === undefined || duration === undefined || pitch === undefined) throw new Error('sequencer: note needs track time duration pitch [velocity].');\n const velocity = number(atoms[4]);\n document.commit(current => insertEvents(ensureTrack(current, track, 'note'), track, [{\n time, duration, value: velocity === undefined ? {pitch} : {pitch, velocity: Math.min(1, Math.max(0, velocity / 127))},\n }]));\n return;\n }\n case 'event': {\n const track = word(atoms[0]), time = number(atoms[1]);\n if (track === undefined || time === undefined || atoms.length < 3) throw new Error('sequencer: event needs track time message….');\n const text = formatMessage(messageFromAtoms(atoms.slice(2)));\n document.commit(current => insertEvents(ensureTrack(current, track, 'message'), track, [{time, value: text}]));\n return;\n }\n default: throw new Error(`A sequencer does not understand ${value.selector}.`);\n }\n }\n}\n\n/** The project plugin that restores a {@link Sequencer} from a record's options. */\nexport function sequencerPlugin(environment: ModuleEnvironment = {}): ProjectPluginFactory {\n return modulePlugin<SequencerOptions>(Sequencer.type, options => {\n // A sequence that does not read leaves the module unresolved with the reason.\n try { return new Sequencer(options); }\n catch (error) { throw new ProjectModuleUnavailableError(error instanceof Error ? error.message : String(error), {cause: error}); }\n }, environment);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/mamingchen/GitHub/public/WebMusic/platform/kernel/dist/chunk-7ZTZZ5PN.cjs"],"names":[],"mappings":"AAAA,6EAAI,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG;AAC3B,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC;AACtB,CAAC;AACD,IAAI,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,UAAU,EAAE,GAAG,CAAC;AACzF,IAAI,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,yBAAyB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAChJ,IAAI,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,WAAW,CAAC,mDAAmD,EAAE,EAAE,OAAO,WAAW,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;AACpM,IAAI,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,wBAAwB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,CAAC;AAC3K,IAAI,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,uBAAuB,CAAC,EAAE,MAAM,CAAC;AAC5G,IAAI,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC;AACzD,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE;AACf,IAAI,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;AAC5C,EAAE,CAAC;AACH,EAAE,IAAI,CAAC,CAAC,EAAE;AACV,IAAI,OAAO,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC;AAC5C,EAAE;AACF,CAAC,CAAC;AACF;AACA;AACE;AACA;AACA;AACA;AACA;AACF,sMAAC","file":"/Users/mamingchen/GitHub/public/WebMusic/platform/kernel/dist/chunk-7ZTZZ5PN.cjs"}
1
+ {"version":3,"sources":["/private/tmp/claude-501/-Users-mamingchen-GitHub-public-WebMusic/77eac0d8-82c0-45c6-aba8-0cd73cfd2b1b/scratchpad/release-0.4.0/platform/kernel/dist/chunk-7ZTZZ5PN.cjs"],"names":[],"mappings":"AAAA,6EAAI,YAAY,EAAE,CAAC,GAAG,EAAE,GAAG;AAC3B,EAAE,MAAM,SAAS,CAAC,GAAG,CAAC;AACtB,CAAC;AACD,IAAI,cAAc,EA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