@webmusic/kernel 0.1.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.
- package/LICENSE +202 -21
- package/NOTICE +2 -0
- package/README.md +138 -101
- package/dist/audio-context.cjs.map +1 -1
- package/dist/build-receipt.json +3 -3
- package/dist/chunk-27LH6QLZ.cjs +277 -0
- package/dist/chunk-27LH6QLZ.cjs.map +1 -0
- package/dist/chunk-3INDOVUC.cjs.map +1 -1
- package/dist/chunk-3RR2VIKA.js +393 -0
- package/dist/chunk-3RR2VIKA.js.map +1 -0
- package/dist/chunk-3YTKIKKX.cjs +378 -0
- package/dist/chunk-3YTKIKKX.cjs.map +1 -0
- package/dist/chunk-4RG4WQKC.js +360 -0
- package/dist/chunk-4RG4WQKC.js.map +1 -0
- package/dist/chunk-5AHVQXTF.cjs +620 -0
- package/dist/chunk-5AHVQXTF.cjs.map +1 -0
- package/dist/chunk-624KWJWZ.js +170 -0
- package/dist/chunk-624KWJWZ.js.map +1 -0
- package/dist/chunk-6HGFEKD3.cjs +851 -0
- package/dist/chunk-6HGFEKD3.cjs.map +1 -0
- package/dist/chunk-7ZTZZ5PN.cjs.map +1 -1
- package/dist/chunk-ALWV4P7D.js +726 -0
- package/dist/chunk-ALWV4P7D.js.map +1 -0
- package/dist/chunk-BADJJ6DV.cjs +143 -0
- package/dist/chunk-BADJJ6DV.cjs.map +1 -0
- package/dist/chunk-C3LMS36L.cjs +393 -0
- package/dist/chunk-C3LMS36L.cjs.map +1 -0
- package/dist/chunk-C3YWUZW3.cjs.map +1 -1
- package/dist/chunk-CR6OUWBJ.cjs +726 -0
- package/dist/chunk-CR6OUWBJ.cjs.map +1 -0
- package/dist/chunk-CYWDZLWC.js +2141 -0
- package/dist/chunk-CYWDZLWC.js.map +1 -0
- package/dist/chunk-DDOGX2D5.js +378 -0
- package/dist/chunk-DDOGX2D5.js.map +1 -0
- package/dist/chunk-DVN6E5U3.js +620 -0
- package/dist/chunk-DVN6E5U3.js.map +1 -0
- package/dist/chunk-EURMRU2S.js +208 -0
- package/dist/chunk-EURMRU2S.js.map +1 -0
- package/dist/chunk-EXDCK2VL.cjs +20 -0
- package/dist/chunk-EXDCK2VL.cjs.map +1 -0
- package/dist/chunk-G5EIUP52.js +114 -0
- package/dist/chunk-G5EIUP52.js.map +1 -0
- package/dist/chunk-GB4DGKLZ.js +143 -0
- package/dist/chunk-GB4DGKLZ.js.map +1 -0
- package/dist/chunk-GPOEAYOW.js +2147 -0
- package/dist/chunk-GPOEAYOW.js.map +1 -0
- package/dist/chunk-I4YMA5VM.cjs +120 -0
- package/dist/chunk-I4YMA5VM.cjs.map +1 -0
- package/dist/chunk-IVWHMDCB.cjs +4383 -0
- package/dist/chunk-IVWHMDCB.cjs.map +1 -0
- package/dist/chunk-JFCBJMA7.cjs +2147 -0
- package/dist/chunk-JFCBJMA7.cjs.map +1 -0
- package/dist/chunk-JLVSAZ3K.cjs +813 -0
- package/dist/chunk-JLVSAZ3K.cjs.map +1 -0
- package/dist/chunk-K7FYH6UG.cjs +208 -0
- package/dist/chunk-K7FYH6UG.cjs.map +1 -0
- package/dist/chunk-L4MYCETM.cjs +970 -0
- package/dist/chunk-L4MYCETM.cjs.map +1 -0
- package/dist/chunk-MNCMYNYL.js +970 -0
- package/dist/chunk-MNCMYNYL.js.map +1 -0
- package/dist/chunk-NT2BZ3QM.js +120 -0
- package/dist/chunk-NT2BZ3QM.js.map +1 -0
- package/dist/chunk-O7SA5GLC.js +277 -0
- package/dist/chunk-O7SA5GLC.js.map +1 -0
- package/dist/chunk-OCKAHITL.cjs +548 -0
- package/dist/chunk-OCKAHITL.cjs.map +1 -0
- package/dist/{chunk-HOKRTYPV.js → chunk-OPBHDUZK.js} +39 -1
- package/dist/chunk-OPBHDUZK.js.map +1 -0
- package/dist/chunk-OTXYWCLA.js +206 -0
- package/dist/chunk-OTXYWCLA.js.map +1 -0
- package/dist/chunk-P6ZA63J7.js +548 -0
- package/dist/chunk-P6ZA63J7.js.map +1 -0
- package/dist/chunk-QLF3BOST.js +20 -0
- package/dist/chunk-QLF3BOST.js.map +1 -0
- package/dist/chunk-RCWFRZDR.js +4383 -0
- package/dist/chunk-RCWFRZDR.js.map +1 -0
- package/dist/chunk-RZBLPM3L.cjs +206 -0
- package/dist/chunk-RZBLPM3L.cjs.map +1 -0
- package/dist/chunk-TA3TNJZU.cjs +360 -0
- package/dist/chunk-TA3TNJZU.cjs.map +1 -0
- package/dist/chunk-TZSRPTQL.cjs +2141 -0
- package/dist/chunk-TZSRPTQL.cjs.map +1 -0
- package/dist/chunk-UMTPJ76S.cjs.map +1 -1
- package/dist/chunk-UY77FXDW.js +813 -0
- package/dist/chunk-UY77FXDW.js.map +1 -0
- package/dist/chunk-VFU3S7OC.js +851 -0
- package/dist/chunk-VFU3S7OC.js.map +1 -0
- package/dist/chunk-VY6WWZSW.cjs.map +1 -1
- package/dist/chunk-WN5DZOVT.cjs +170 -0
- package/dist/chunk-WN5DZOVT.cjs.map +1 -0
- package/dist/{chunk-HZQX4J2J.cjs → chunk-WOPW6WLR.cjs} +40 -2
- package/dist/chunk-WOPW6WLR.cjs.map +1 -0
- package/dist/chunk-XBSIYUHM.cjs +114 -0
- package/dist/chunk-XBSIYUHM.cjs.map +1 -0
- package/dist/chunk-ZMU72HJS.cjs.map +1 -1
- package/dist/context-DSa0ymyN.d.cts +664 -0
- package/dist/context-DaxfAg3b.d.ts +664 -0
- package/dist/effect-chain-Cu03O5Y0.d.ts +91 -0
- package/dist/effect-chain-Do75T7uK.d.cts +91 -0
- package/dist/effect.cjs +16 -1
- package/dist/effect.cjs.map +1 -1
- package/dist/effect.d.cts +56 -14
- package/dist/effect.d.ts +56 -14
- package/dist/effect.js +16 -1
- package/dist/elements.cjs +37 -2
- package/dist/elements.cjs.map +1 -1
- package/dist/elements.d.cts +197 -8
- package/dist/elements.d.ts +197 -8
- package/dist/elements.js +36 -1
- package/dist/events.cjs.map +1 -1
- package/dist/index.cjs +556 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -5
- package/dist/index.d.ts +17 -5
- package/dist/index.js +567 -20
- package/dist/message.cjs +104 -0
- package/dist/message.cjs.map +1 -0
- package/dist/message.d.cts +738 -0
- package/dist/message.d.ts +738 -0
- package/dist/message.js +104 -0
- package/dist/meter.cjs +2 -2
- package/dist/meter.cjs.map +1 -1
- package/dist/meter.d.cts +9 -1
- package/dist/meter.d.ts +9 -1
- package/dist/meter.js +1 -1
- package/dist/module-control-C25BMtH7.d.ts +61 -0
- package/dist/module-control-yH6nTJM9.d.cts +61 -0
- package/dist/module-plugin-BnPmq1VP.d.ts +198 -0
- package/dist/module-plugin-CHb-5W0Y.d.cts +198 -0
- package/dist/module.cjs +263 -0
- package/dist/module.cjs.map +1 -0
- package/dist/module.d.cts +1112 -0
- package/dist/module.d.ts +1112 -0
- package/dist/module.js +263 -0
- package/dist/parameter-DwQzFmBR.d.cts +172 -0
- package/dist/parameter-DwQzFmBR.d.ts +172 -0
- package/dist/player.cjs.map +1 -1
- package/dist/processor-worklet.cjs +18 -0
- package/dist/processor-worklet.cjs.map +1 -0
- package/dist/processor-worklet.d.cts +166 -0
- package/dist/processor-worklet.d.ts +166 -0
- package/dist/processor-worklet.js +18 -0
- package/dist/processor-worklet.js.map +1 -0
- package/dist/processor.cjs +51 -0
- package/dist/processor.cjs.map +1 -0
- package/dist/processor.d.cts +397 -0
- package/dist/processor.d.ts +397 -0
- package/dist/processor.js +51 -0
- package/dist/processor.js.map +1 -0
- package/dist/project-types-BU4awMnL.d.ts +323 -0
- package/dist/project-types-DufCV8Ma.d.cts +323 -0
- package/dist/ring-C-i9N90a.d.cts +139 -0
- package/dist/ring-DkcMt2Eg.d.ts +139 -0
- package/dist/sequence.cjs +68 -0
- package/dist/sequence.cjs.map +1 -0
- package/dist/sequence.d.cts +303 -0
- package/dist/sequence.d.ts +303 -0
- package/dist/sequence.js +68 -0
- package/dist/sequence.js.map +1 -0
- package/dist/session.cjs +16 -0
- package/dist/session.cjs.map +1 -0
- package/dist/session.d.cts +407 -0
- package/dist/session.d.ts +407 -0
- package/dist/session.js +16 -0
- package/dist/session.js.map +1 -0
- package/dist/tick.cjs.map +1 -1
- package/dist/transport.cjs +50 -2
- package/dist/transport.cjs.map +1 -1
- package/dist/transport.d.cts +145 -1
- package/dist/transport.d.ts +145 -1
- package/dist/transport.js +51 -3
- package/dist/worker.cjs.map +1 -1
- package/package.json +62 -11
- package/dist/chunk-53YD73OY.js +0 -162
- package/dist/chunk-53YD73OY.js.map +0 -1
- package/dist/chunk-BR63OD53.cjs +0 -1
- package/dist/chunk-BR63OD53.cjs.map +0 -1
- package/dist/chunk-HOKRTYPV.js.map +0 -1
- package/dist/chunk-HZQX4J2J.cjs.map +0 -1
- package/dist/chunk-JNXB74G3.cjs +0 -987
- package/dist/chunk-JNXB74G3.cjs.map +0 -1
- package/dist/chunk-SM5YPDDI.cjs +0 -162
- package/dist/chunk-SM5YPDDI.cjs.map +0 -1
- package/dist/chunk-TEM2I2NN.js +0 -1
- package/dist/chunk-VVZX7DQ6.cjs +0 -254
- package/dist/chunk-VVZX7DQ6.cjs.map +0 -1
- package/dist/chunk-WNFGDB7B.js +0 -254
- package/dist/chunk-WNFGDB7B.js.map +0 -1
- package/dist/chunk-XBJBY4J5.js +0 -987
- package/dist/chunk-XBJBY4J5.js.map +0 -1
- package/dist/sync.cjs +0 -12
- package/dist/sync.cjs.map +0 -1
- package/dist/sync.d.cts +0 -304
- package/dist/sync.d.ts +0 -304
- package/dist/sync.js +0 -12
- /package/dist/{chunk-TEM2I2NN.js.map → message.js.map} +0 -0
- /package/dist/{sync.js.map → module.js.map} +0 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { J as JsonValue, I as NoteOutputPort, j as Message, C as CapabilityKey, l as MessageInputPort, n as MessageOutputPort, t as ModuleCapabilities, w as ModuleHandle } from './context-DaxfAg3b.js';
|
|
2
|
+
import { MusicalTempo } from './transport.js';
|
|
3
|
+
import { x as ProjectPluginFactory } from './project-types-BU4awMnL.js';
|
|
4
|
+
import { G as GraphModule, a as GraphModuleOptions, d as ModuleOptionsJson, c as ModuleEnvironment } from './module-plugin-BnPmq1VP.js';
|
|
5
|
+
import './tick.js';
|
|
6
|
+
import './session.js';
|
|
7
|
+
import './parameter-DwQzFmBR.js';
|
|
8
|
+
import './effect-chain-Cu03O5Y0.js';
|
|
9
|
+
|
|
10
|
+
declare const SEQUENCE_SCHEMA = "webmusic.sequence";
|
|
11
|
+
declare const SEQUENCE_VERSION = 1;
|
|
12
|
+
/** The axis event times are written on: musical ticks (480 per quarter note) or seconds. */
|
|
13
|
+
type SequenceUnit = 'ticks' | 'seconds';
|
|
14
|
+
interface SequenceEvent {
|
|
15
|
+
/** Unique within its track. */
|
|
16
|
+
readonly id: string;
|
|
17
|
+
/** Start, on the sequence's axis; finite and not negative. */
|
|
18
|
+
readonly time: number;
|
|
19
|
+
/** Length on the same axis; omitted for an instant. */
|
|
20
|
+
readonly duration?: number;
|
|
21
|
+
/** What the event carries. The track's `kind` says how to read it. */
|
|
22
|
+
readonly value: JsonValue;
|
|
23
|
+
}
|
|
24
|
+
interface SequenceTrack {
|
|
25
|
+
/** Unique within its sequence. */
|
|
26
|
+
readonly id: string;
|
|
27
|
+
/**
|
|
28
|
+
* How the events' values are read. `note` and `message` are understood by
|
|
29
|
+
* the Kernel's sinks; any other kind is the application's own.
|
|
30
|
+
*/
|
|
31
|
+
readonly kind: string;
|
|
32
|
+
readonly label?: string;
|
|
33
|
+
/** A muted track is kept and edited but not played. */
|
|
34
|
+
readonly muted?: boolean;
|
|
35
|
+
/** Ordered by time, then by ID. */
|
|
36
|
+
readonly events: readonly SequenceEvent[];
|
|
37
|
+
}
|
|
38
|
+
interface Sequence {
|
|
39
|
+
readonly schema: typeof SEQUENCE_SCHEMA;
|
|
40
|
+
readonly version: typeof SEQUENCE_VERSION;
|
|
41
|
+
readonly unit: SequenceUnit;
|
|
42
|
+
/** Where the sequence ends and a loop wraps; the end of its last event when omitted. */
|
|
43
|
+
readonly length?: number;
|
|
44
|
+
readonly tracks: readonly SequenceTrack[];
|
|
45
|
+
}
|
|
46
|
+
/** A note track's value: a MIDI pitch and a velocity from 0 to 1. A bare number is a pitch. */
|
|
47
|
+
interface SequenceNote {
|
|
48
|
+
readonly pitch: number;
|
|
49
|
+
readonly velocity?: number;
|
|
50
|
+
}
|
|
51
|
+
/** An event before it has an ID; {@link insertEvents} gives it one. */
|
|
52
|
+
type SequenceEventInit = Omit<SequenceEvent, 'id'> & {
|
|
53
|
+
readonly id?: string;
|
|
54
|
+
};
|
|
55
|
+
type SequenceTrackInit = Omit<SequenceTrack, 'events'> & {
|
|
56
|
+
readonly events?: readonly SequenceEventInit[];
|
|
57
|
+
};
|
|
58
|
+
interface SequenceInit {
|
|
59
|
+
readonly unit?: SequenceUnit;
|
|
60
|
+
readonly length?: number;
|
|
61
|
+
readonly tracks?: readonly SequenceTrackInit[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Read a sequence from untrusted JSON: validate it, order its events and
|
|
65
|
+
* freeze the result. Throws a readable TypeError, RangeError or Error and
|
|
66
|
+
* never returns a partly valid sequence.
|
|
67
|
+
*/
|
|
68
|
+
declare function parseSequence(input: unknown): Sequence;
|
|
69
|
+
/** A new sequence, in ticks unless `unit` says seconds. */
|
|
70
|
+
declare function createSequence(init?: SequenceInit): Sequence;
|
|
71
|
+
/** Add a track at `index`, or at the end. */
|
|
72
|
+
declare function addTrack(sequence: Sequence, init: SequenceTrackInit, index?: number): Sequence;
|
|
73
|
+
declare function removeTrack(sequence: Sequence, trackId: string): Sequence;
|
|
74
|
+
/** Change a track's label, kind or muted state; its ID and events stay. */
|
|
75
|
+
declare function updateTrack(sequence: Sequence, trackId: string, change: Partial<Pick<SequenceTrack, 'kind' | 'label' | 'muted'>>): Sequence;
|
|
76
|
+
/** Add events to a track. An event without an ID is given the next free `e<n>`. */
|
|
77
|
+
declare function insertEvents(sequence: Sequence, trackId: string, events: readonly SequenceEventInit[]): Sequence;
|
|
78
|
+
/** Remove the named events; IDs the track does not hold are ignored. */
|
|
79
|
+
declare function removeEvents(sequence: Sequence, trackId: string, ids: Iterable<string>): Sequence;
|
|
80
|
+
/** Rewrite the named events (every event when `ids` is omitted); the ID of each is kept. */
|
|
81
|
+
declare function updateEvents(sequence: Sequence, trackId: string, ids: Iterable<string> | undefined, change: Partial<Omit<SequenceEvent, 'id'>> | ((event: SequenceEvent) => Partial<Omit<SequenceEvent, 'id'>>)): Sequence;
|
|
82
|
+
/** Move the named events by `delta`; an event never starts before 0. */
|
|
83
|
+
declare function shiftEvents(sequence: Sequence, trackId: string, ids: Iterable<string> | undefined, delta: number): Sequence;
|
|
84
|
+
interface QuantizeOptions {
|
|
85
|
+
/** How far each start moves toward the grid, 0 to 1. Default 1. */
|
|
86
|
+
readonly strength?: number;
|
|
87
|
+
/** Also round durations to the grid, never below one grid step. Default false. */
|
|
88
|
+
readonly durations?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** Move the named events' starts toward the nearest multiple of `grid`. */
|
|
91
|
+
declare function quantizeEvents(sequence: Sequence, trackId: string, ids: Iterable<string> | undefined, grid: number, options?: QuantizeOptions): Sequence;
|
|
92
|
+
/** Set where the sequence ends, or let it end with its last event again. */
|
|
93
|
+
declare function setSequenceLength(sequence: Sequence, length: number | undefined): Sequence;
|
|
94
|
+
/** Where a sequence ends: its `length`, or the end of its last event. */
|
|
95
|
+
declare function sequenceEnd(sequence: Sequence): number;
|
|
96
|
+
/** Index of the first event at or after `time` (after it, when `inclusive` is false). */
|
|
97
|
+
declare function eventIndexAt(events: readonly SequenceEvent[], time: number, inclusive?: boolean): number;
|
|
98
|
+
/** The events of a track that start in `[start, end)`. */
|
|
99
|
+
declare function eventsBetween(track: SequenceTrack, start: number, end: number): readonly SequenceEvent[];
|
|
100
|
+
/**
|
|
101
|
+
* The part of a sequence in `[start, end)` as a sequence of its own: events
|
|
102
|
+
* that start there, moved to begin at 0, with durations cut at the end.
|
|
103
|
+
*/
|
|
104
|
+
declare function sliceSequence(sequence: Sequence, start: number, end: number): Sequence;
|
|
105
|
+
/** A span of the sequence's axis in seconds; ticks follow `tempo`. */
|
|
106
|
+
declare function sequenceSeconds(sequence: Pick<Sequence, 'unit'>, time: number, tempo: MusicalTempo): number;
|
|
107
|
+
/** Seconds as a span of the sequence's axis; ticks follow `tempo`. */
|
|
108
|
+
declare function sequenceTime(sequence: Pick<Sequence, 'unit'>, seconds: number, tempo: MusicalTempo): number;
|
|
109
|
+
/** Read a note track's value: `{pitch, velocity}` or a bare pitch. Undefined when it is neither. */
|
|
110
|
+
declare function sequenceNote(value: JsonValue): SequenceNote | undefined;
|
|
111
|
+
|
|
112
|
+
interface SequenceDocumentSnapshot {
|
|
113
|
+
readonly sequence: Sequence;
|
|
114
|
+
/** Rises by one with every commit, undo and redo. */
|
|
115
|
+
readonly revision: number;
|
|
116
|
+
readonly canUndo: boolean;
|
|
117
|
+
readonly canRedo: boolean;
|
|
118
|
+
}
|
|
119
|
+
interface SequenceDocumentOptions {
|
|
120
|
+
/** How many earlier sequences undo can return to. 0 keeps no history. Default 100. */
|
|
121
|
+
readonly historyLimit?: number;
|
|
122
|
+
/** Receives a listener's failure; a failing listener never stops a commit. */
|
|
123
|
+
readonly onListenerError?: (error: unknown) => void;
|
|
124
|
+
}
|
|
125
|
+
declare class SequenceDocument {
|
|
126
|
+
#private;
|
|
127
|
+
/** `initial` is validated as untrusted JSON; an empty sequence in ticks when omitted. */
|
|
128
|
+
constructor(initial?: unknown, options?: SequenceDocumentOptions);
|
|
129
|
+
get disposed(): boolean;
|
|
130
|
+
/** The committed state; the same object until the next change. */
|
|
131
|
+
get snapshot(): SequenceDocumentSnapshot;
|
|
132
|
+
/**
|
|
133
|
+
* Replace the sequence with `next`, or with what `next` makes of the
|
|
134
|
+
* current one. The result is validated before anything changes; a change
|
|
135
|
+
* that throws leaves the document as it was. Returning the current
|
|
136
|
+
* sequence commits nothing. Returns the revision now current.
|
|
137
|
+
*/
|
|
138
|
+
commit(next: Sequence | ((current: Sequence) => Sequence)): number;
|
|
139
|
+
/** Return to the sequence before the last commit. False when there is none. */
|
|
140
|
+
undo(): boolean;
|
|
141
|
+
/** Reapply the commit last undone. False when there is none. */
|
|
142
|
+
redo(): boolean;
|
|
143
|
+
/** Called after every change, with the new state already readable from `snapshot`. */
|
|
144
|
+
subscribe(listener: () => void): () => void;
|
|
145
|
+
/** Drop history and listeners. The last snapshot stays readable; changes throw. */
|
|
146
|
+
dispose(): void;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** What the player reads time from. A Kernel `MusicalTimeSource` is one. */
|
|
150
|
+
interface SequenceTimeSource {
|
|
151
|
+
tempo(): MusicalTempo;
|
|
152
|
+
playing(): boolean;
|
|
153
|
+
/** Transport position in seconds. */
|
|
154
|
+
position(): number;
|
|
155
|
+
/** Clock time at which the transport reaches `position`; undefined while it is not playing. */
|
|
156
|
+
timeAt(position: number): number | undefined;
|
|
157
|
+
/** Notified after play, pause, seek, a loop jump and a tempo change. */
|
|
158
|
+
subscribe(listener: () => void): () => void;
|
|
159
|
+
}
|
|
160
|
+
/** What the player schedules on. A Kernel `MessageClock` is one. */
|
|
161
|
+
interface SequenceClock {
|
|
162
|
+
now(): number;
|
|
163
|
+
schedule(time: number, callback: (time: number) => void): () => void;
|
|
164
|
+
}
|
|
165
|
+
interface SequencePlayedEvent {
|
|
166
|
+
readonly track: SequenceTrack;
|
|
167
|
+
readonly event: SequenceEvent;
|
|
168
|
+
/** Clock time the event starts at: slightly ahead of `clock.now()`, or just behind it when the event is late. */
|
|
169
|
+
readonly time: number;
|
|
170
|
+
/** The event's duration in clock seconds, at the transport's current tempo and rate. */
|
|
171
|
+
readonly duration?: number;
|
|
172
|
+
/** How many times the sequence had looped before this event; 0 on the first pass. */
|
|
173
|
+
readonly pass: number;
|
|
174
|
+
}
|
|
175
|
+
interface SequenceSink {
|
|
176
|
+
event(played: SequencePlayedEvent): void;
|
|
177
|
+
/**
|
|
178
|
+
* The timeline broke at clock time `time` (pause, seek, loop jump, tempo
|
|
179
|
+
* change, stop): release what is sounding and drop what was scheduled.
|
|
180
|
+
*/
|
|
181
|
+
invalidate?(time: number): void;
|
|
182
|
+
}
|
|
183
|
+
interface SequencePlayerOptions {
|
|
184
|
+
/** The sequence to play now; read again whenever the player schedules. */
|
|
185
|
+
read(): Sequence;
|
|
186
|
+
time: SequenceTimeSource;
|
|
187
|
+
clock: SequenceClock;
|
|
188
|
+
/** Sinks by track kind. `'*'` receives the kinds that have no sink of their own. */
|
|
189
|
+
sinks: Readonly<Record<string, SequenceSink>>;
|
|
190
|
+
/** Repeat from the start when the sequence ends. Default false. */
|
|
191
|
+
loop?: boolean;
|
|
192
|
+
/** Transport position, in seconds, at which the sequence begins. Default 0. */
|
|
193
|
+
offset?: number;
|
|
194
|
+
/** Called once when a sequence that does not loop reaches its end, with the clock time. */
|
|
195
|
+
onEnd?(time: number): void;
|
|
196
|
+
/** Receives a sink's or callback's failure; playback continues. */
|
|
197
|
+
onError?(error: unknown): void;
|
|
198
|
+
/**
|
|
199
|
+
* After the timeline breaks, events that started up to this many seconds
|
|
200
|
+
* before the new position still play, at once. Default 0.02.
|
|
201
|
+
*/
|
|
202
|
+
catchUp?: number;
|
|
203
|
+
}
|
|
204
|
+
declare class SequencePlayer {
|
|
205
|
+
#private;
|
|
206
|
+
constructor(options: SequencePlayerOptions);
|
|
207
|
+
get running(): boolean;
|
|
208
|
+
get disposed(): boolean;
|
|
209
|
+
get loop(): boolean;
|
|
210
|
+
set loop(value: boolean);
|
|
211
|
+
get offset(): number;
|
|
212
|
+
set offset(value: number);
|
|
213
|
+
/** Follow the transport: events play while it plays. Starting twice changes nothing. */
|
|
214
|
+
start(): void;
|
|
215
|
+
/** Stop following the transport and release what the sinks hold. */
|
|
216
|
+
stop(): void;
|
|
217
|
+
/** The sequence changed: schedule again from what `read()` returns now. Sounding events finish. */
|
|
218
|
+
refresh(): void;
|
|
219
|
+
dispose(): void;
|
|
220
|
+
}
|
|
221
|
+
interface NoteSinkOptions {
|
|
222
|
+
/** The port the notes leave from; borrowed. */
|
|
223
|
+
port: NoteOutputPort;
|
|
224
|
+
clock: SequenceClock;
|
|
225
|
+
/** The `sourceId` of every note. Defaults to the port's ID. */
|
|
226
|
+
sourceId?: string;
|
|
227
|
+
/** Scheduling generation at attack; defaults to 0 without a Session. */
|
|
228
|
+
epoch?(): number;
|
|
229
|
+
/** Seconds a note without a duration sounds. Default 0.1. */
|
|
230
|
+
defaultDuration?: number;
|
|
231
|
+
/** Velocity of a note that names none, 0 to 1. Default 0.8. */
|
|
232
|
+
defaultVelocity?: number;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* A sink for `note` tracks: each event becomes a note on the port at its
|
|
236
|
+
* time and is released after its duration. Invalidating releases every note
|
|
237
|
+
* this sink still holds; it never touches another producer's notes.
|
|
238
|
+
*/
|
|
239
|
+
declare function createNoteSink(options: NoteSinkOptions): SequenceSink & {
|
|
240
|
+
dispose(): void;
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* A sink for `message` tracks: a text value is parsed as a message, a number
|
|
244
|
+
* becomes a `float`, and anything else is skipped. `send` receives the
|
|
245
|
+
* message stamped with the event's time.
|
|
246
|
+
*/
|
|
247
|
+
declare function createMessageSink(send: (track: SequenceTrack, value: Message, played: SequencePlayedEvent) => void): SequenceSink;
|
|
248
|
+
|
|
249
|
+
/** The capability under which a sequencer lends the document it plays. */
|
|
250
|
+
declare const SEQUENCE_DOCUMENT: CapabilityKey<SequenceDocument>;
|
|
251
|
+
/** The sequence document of a sequencer module, to read, edit and subscribe to. */
|
|
252
|
+
declare function sequenceDocumentOf(module: ModuleHandle | undefined): SequenceDocument | undefined;
|
|
253
|
+
interface SequencerOptions extends GraphModuleOptions {
|
|
254
|
+
/** The sequence to hold: a `Sequence`, or its saved JSON. Default: an empty one. */
|
|
255
|
+
readonly sequence?: unknown;
|
|
256
|
+
/** Start again from the beginning at the end. Default false. */
|
|
257
|
+
readonly loop?: boolean;
|
|
258
|
+
/** Follow the transport when activated. Default true. */
|
|
259
|
+
readonly running?: boolean;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Plays the sequence it holds while the transport plays. Needs the musical
|
|
263
|
+
* time of a Session, from its context or the `musicalTime` option.
|
|
264
|
+
*
|
|
265
|
+
* `control` input: `start`/1 and `stop`/0 turn following on and off; `loop
|
|
266
|
+
* 0/1`; `note track time duration pitch [velocity 0–127]` and `event track
|
|
267
|
+
* time message…` add an event, on the sequence's own axis; `length n` sets
|
|
268
|
+
* where it ends (`length` alone lets it end with its last event); `clear`
|
|
269
|
+
* empties every track. Outputs: `notes`; `events`, each `message` track's
|
|
270
|
+
* events as `<track> message…`; `done`, a bang when a sequence that does not
|
|
271
|
+
* loop ends.
|
|
272
|
+
*/
|
|
273
|
+
declare class Sequencer extends GraphModule {
|
|
274
|
+
#private;
|
|
275
|
+
static readonly type = "webmusic.sequencer";
|
|
276
|
+
readonly inputs: {
|
|
277
|
+
control: MessageInputPort;
|
|
278
|
+
};
|
|
279
|
+
/** The notes of the `note` tracks, on the audio clock. */
|
|
280
|
+
readonly notes: NoteOutputPort;
|
|
281
|
+
readonly outputs: {
|
|
282
|
+
readonly events: MessageOutputPort;
|
|
283
|
+
readonly done: MessageOutputPort;
|
|
284
|
+
};
|
|
285
|
+
/** The sequence it plays, to read, edit and subscribe to. */
|
|
286
|
+
readonly document: SequenceDocument;
|
|
287
|
+
constructor(options?: SequencerOptions);
|
|
288
|
+
get capabilities(): ModuleCapabilities;
|
|
289
|
+
/** Whether it follows the transport. */
|
|
290
|
+
get running(): boolean;
|
|
291
|
+
get loop(): boolean;
|
|
292
|
+
set loop(value: boolean);
|
|
293
|
+
/** Follow the transport. Activates the module if it is not yet active. */
|
|
294
|
+
start(): void;
|
|
295
|
+
stop(): void;
|
|
296
|
+
exportOptions(): ModuleOptionsJson;
|
|
297
|
+
protected onActivate(): void;
|
|
298
|
+
protected onDispose(): void;
|
|
299
|
+
}
|
|
300
|
+
/** The project plugin that restores a {@link Sequencer} from a record's options. */
|
|
301
|
+
declare function sequencerPlugin(environment?: ModuleEnvironment): ProjectPluginFactory;
|
|
302
|
+
|
|
303
|
+
export { type NoteSinkOptions, type QuantizeOptions, SEQUENCE_DOCUMENT, SEQUENCE_SCHEMA, SEQUENCE_VERSION, type Sequence, type SequenceClock, SequenceDocument, type SequenceDocumentOptions, type SequenceDocumentSnapshot, type SequenceEvent, type SequenceEventInit, type SequenceInit, type SequenceNote, type SequencePlayedEvent, SequencePlayer, type SequencePlayerOptions, type SequenceSink, type SequenceTimeSource, type SequenceTrack, type SequenceTrackInit, type SequenceUnit, Sequencer, type SequencerOptions, addTrack, createMessageSink, createNoteSink, createSequence, eventIndexAt, eventsBetween, insertEvents, parseSequence, quantizeEvents, removeEvents, removeTrack, sequenceDocumentOf, sequenceEnd, sequenceNote, sequenceSeconds, sequenceTime, sequencerPlugin, setSequenceLength, shiftEvents, sliceSequence, updateEvents, updateTrack };
|
package/dist/sequence.js
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SEQUENCE_DOCUMENT,
|
|
3
|
+
SEQUENCE_SCHEMA,
|
|
4
|
+
SEQUENCE_VERSION,
|
|
5
|
+
SequenceDocument,
|
|
6
|
+
SequencePlayer,
|
|
7
|
+
Sequencer,
|
|
8
|
+
addTrack,
|
|
9
|
+
createMessageSink,
|
|
10
|
+
createNoteSink,
|
|
11
|
+
createSequence,
|
|
12
|
+
eventIndexAt,
|
|
13
|
+
eventsBetween,
|
|
14
|
+
insertEvents,
|
|
15
|
+
parseSequence,
|
|
16
|
+
quantizeEvents,
|
|
17
|
+
removeEvents,
|
|
18
|
+
removeTrack,
|
|
19
|
+
sequenceDocumentOf,
|
|
20
|
+
sequenceEnd,
|
|
21
|
+
sequenceNote,
|
|
22
|
+
sequenceSeconds,
|
|
23
|
+
sequenceTime,
|
|
24
|
+
sequencerPlugin,
|
|
25
|
+
setSequenceLength,
|
|
26
|
+
shiftEvents,
|
|
27
|
+
sliceSequence,
|
|
28
|
+
updateEvents,
|
|
29
|
+
updateTrack
|
|
30
|
+
} from "./chunk-VFU3S7OC.js";
|
|
31
|
+
import "./chunk-EURMRU2S.js";
|
|
32
|
+
import "./chunk-ALWV4P7D.js";
|
|
33
|
+
import "./chunk-NT2BZ3QM.js";
|
|
34
|
+
import "./chunk-4RG4WQKC.js";
|
|
35
|
+
import "./chunk-GB4DGKLZ.js";
|
|
36
|
+
import "./chunk-QLF3BOST.js";
|
|
37
|
+
import "./chunk-PXG64RU4.js";
|
|
38
|
+
export {
|
|
39
|
+
SEQUENCE_DOCUMENT,
|
|
40
|
+
SEQUENCE_SCHEMA,
|
|
41
|
+
SEQUENCE_VERSION,
|
|
42
|
+
SequenceDocument,
|
|
43
|
+
SequencePlayer,
|
|
44
|
+
Sequencer,
|
|
45
|
+
addTrack,
|
|
46
|
+
createMessageSink,
|
|
47
|
+
createNoteSink,
|
|
48
|
+
createSequence,
|
|
49
|
+
eventIndexAt,
|
|
50
|
+
eventsBetween,
|
|
51
|
+
insertEvents,
|
|
52
|
+
parseSequence,
|
|
53
|
+
quantizeEvents,
|
|
54
|
+
removeEvents,
|
|
55
|
+
removeTrack,
|
|
56
|
+
sequenceDocumentOf,
|
|
57
|
+
sequenceEnd,
|
|
58
|
+
sequenceNote,
|
|
59
|
+
sequenceSeconds,
|
|
60
|
+
sequenceTime,
|
|
61
|
+
sequencerPlugin,
|
|
62
|
+
setSequenceLength,
|
|
63
|
+
shiftEvents,
|
|
64
|
+
sliceSequence,
|
|
65
|
+
updateEvents,
|
|
66
|
+
updateTrack
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=sequence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/session.cjs
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkJFCBJMA7cjs = require('./chunk-JFCBJMA7.cjs');
|
|
6
|
+
require('./chunk-5AHVQXTF.cjs');
|
|
7
|
+
require('./chunk-3INDOVUC.cjs');
|
|
8
|
+
require('./chunk-TA3TNJZU.cjs');
|
|
9
|
+
require('./chunk-EXDCK2VL.cjs');
|
|
10
|
+
require('./chunk-7ZTZZ5PN.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.SessionLFO = _chunkJFCBJMA7cjs.SessionLFO; exports.SessionTransport = _chunkJFCBJMA7cjs.SessionTransport; exports.attachSessionAutomation = _chunkJFCBJMA7cjs.attachSessionAutomation;
|
|
16
|
+
//# sourceMappingURL=session.cjs.map
|
|
@@ -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/session.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACF,8LAAC","file":"/private/tmp/claude-501/-Users-mamingchen-GitHub-public-WebMusic/77eac0d8-82c0-45c6-aba8-0cd73cfd2b1b/scratchpad/release-0.4.0/platform/kernel/dist/session.cjs"}
|