Partial synthesis
Build and render bounded partial-based sound recipes.
Generated from the reviewed SDK 0.1.0 contract snapshot. Unreviewed workspace changes are not included.
Public exports
Import from @scape/sdk.
GizmoAmplitude, GizmoPartialLayer, GizmoPartialsSound, GizmoSignalStage, gizmoPartialsError, renderGizmoPartials.
Type declarations
These declarations preserve source comments and related types. Import only the public exports listed above; module-relative paths below describe how the package is organized.
ts
import { type GizmoSoundSamples } from './synthesis.js';
/** Multiplicative amplitude factors, in seconds and inverse seconds. */
export interface GizmoAmplitude {
gain: number;
attack: number;
attackCurve?: 'linear' | 'sine-squared';
decay?: number;
release?: {
at: number;
time: number;
};
fadeOut: number;
}
/** A bounded, ordered signal chain. Filters and nonlinear stages are reusable sound primitives. */
export type GizmoSignalStage = {
kind: 'pole';
frequency: number;
subtract?: number;
} | {
kind: 'noise';
seed: number;
gain: number;
decay: number;
} | {
kind: 'soft-clip' | 'hard-clip';
drive: number;
};
export interface GizmoPartialLayer {
frequency: number;
partials: {
ratio: number;
gain: number;
decay: number;
}[];
/** Fractional frequency deviation and cycles per second. */
vibrato?: {
depth: number;
rate: number;
};
stages?: GizmoSignalStage[];
gain: number;
}
/** Additive oscillators, optional oversampling and ordered signal processing; no instrument presets. */
export interface GizmoPartialsSound {
kind: 'partials';
duration: number;
oversample?: 1 | 2 | 4;
layers: GizmoPartialLayer[];
stages?: GizmoSignalStage[];
amplitude: GizmoAmplitude;
/** Parallel dry-signal echoes, followed by a final edge fade. */
echoes?: {
time: number;
gain: number;
}[];
tailFade?: number;
}
export declare function gizmoPartialsError(value: unknown, path?: string): string | null;
/** Deterministic PCM only. Hosts render this in a worker, with their normal time/cache budgets. */
export declare function renderGizmoPartials(sound: GizmoPartialsSound, rate?: number): GizmoSoundSamples;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
60
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
60
Usage and limits
See Gizmo guides, working examples, and limits for lifecycle, validation and host behavior.
