Sound and lighting
Gizmos own their sound and light recipes. Scape owns timing, caching, spatial output, player volume, native routing and cleanup. You do not need recorded audio or a model animation to make an object audible.
Procedural sound
Declare named recipes in sounds. The SDK supports oscillators and envelopes, filtered noise, partials, delay and reverb. State changes or accepted actions can schedule those sounds using audio timelines.
For example, an audio command references a sound you declared:
ts
{ kind: 'play', voice: 'bell', sound: 'bell', delayMs: 0,
gain: 1, rate: 1, loop: false, rangeCells: [1, 8], stereo: 0.7 }1
2
2
This is a recipe fragment, not a complete definition. Chime provides a complete sound and shared-action example; Pressure pad demonstrates a local arrival sound.
gizmoSynthError and related validators report invalid fields before rendering. renderGizmoSound is available for local waveform tests. Optional recorded PCM16 WAV imports are supported, but are not required for synthesized sounds.
Sound banks and previews
soundBank(state) returns bounded state-specific recipes, useful for pitch or timbre choices. It is an alternative to static sounds and cannot be combined with static ambience. A bank has at most 16 sounds and 64 KiB of recipe data.
previews provide local auditions through preview controls. They do not create shared actions. Use them to let an editor hear a choice before or alongside saving it.
Ambience and sequences
ambience describes passive playback. sequence(context) chooses timed events for authored procedural ambience; shared bus effects retain their signal state. Scape bounds work and routes generated samples through its platform audio engine.
Installed iOS output uses native audio. Authored code does not choose a browser fallback, bypass player volume, or gain microphone access.
Light versus glow
light illuminates the world in grid-cell units. glow describes a visual halo. They are independent of sound. A state-dependent lighting(state, environment) returns a complete replacement recipe; {} turns both off.
ts
lighting: state => state.on ? {
light: {
radiusCells: 3, color: '#ffc078', intensity: 0.12,
basementIntensity: 0.25, illumination: 0.7,
},
} : {},1
2
3
4
5
6
2
3
4
5
6
The optional environment includes whether host-created linking is complete. Use resolveGizmoLighting in local tests; its default context is unlinked. Outputs are cached outside the frame loop.
Reference
- Audio, synthesis, noise, and partials.
- Sound banks and sequences.
- Light, glow, and state-driven lighting.
Start with small effects and test overlapping sources. Scape retains output limits regardless of the authored recipe.
