Sequences
Compose timed, procedural ambient events.
Public exports
Import from @scape-wtf/sdk.
GizmoAudioBus, GizmoSequence, GizmoSequenceContext, GizmoSequenceStep, gizmoBusError, gizmoSequenceError.
Type declarations
Import the public exports listed above from the package entry point.
ts
import { type GizmoSynth } from './synthesis.js';
/** A shared, listener-local bus. All strikes feed these persistent effects. */
export interface GizmoAudioBus {
/** Dry bus gain from silence to unity. */
gain: number;
delay?: {
time: number;
feedback: number;
wet: number;
modulation?: {
frequency: number;
depth: number;
};
};
reverb?: {
duration: number;
decay: number;
seed: number;
wet: number;
};
compressor?: {
threshold: number;
knee: number;
ratio: number;
attack: number;
release: number;
};
}
/** Host-provided context for one deterministic sequence callback. */
export interface GizmoSequenceContext {
/** Monotonic opportunity counter, including steps that produce no sound. */
step: number;
/** Nearest-first audible sources; positions in world cells.
* Scape supplies neutral gain (1) and pan (0) for source-local synthesis, then
* applies smoothly changing distance/pan to the complete dry note before bus effects.
* Multiplying authored gain by this gain and adding this pan remains supported.
*/
sources: readonly {
x: number;
y: number;
gain: number;
pan: number;
}[];
}
/** One bounded sequence result emitted for the current opportunity. */
export interface GizmoSequenceStep {
/** Delay before the next sequence opportunity, in seconds. */
afterSeconds: number;
/** Sound strikes scheduled against the shared bus. */
strikes: {
source: number;
delaySeconds: number;
sound: GizmoSynth;
}[];
}
/** Author callback that returns one bounded step without using timers or I/O. */
export type GizmoSequence = (context: GizmoSequenceContext) => GizmoSequenceStep;
export declare function gizmoBusError(value: unknown): string | null;
export declare function gizmoSequenceError(value: unknown, sources: number): string | null;1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Usage and limits
See Gizmo guides, working examples, and limits for lifecycle, validation and Scape behavior.
