API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

I

interfaceSpatializable

@codexo/exojs / audio / stable

A voice that can be positioned in space and optionally track a node.

14
props
1
methods
0
events
Import
import { Spatializable } from '@codexo/exojs'

A voice that can be positioned in space and optionally track a node.

Methods1
Track a SceneNode: the voice reads the node's global translation each frame. Pass null to stop following and fall back to Spatializable.position.
Properties14
coneInnerAngle: number
Full-gain cone half-angle in degrees. Default 360 (omnidirectional - no cone).
coneOuterAngle: number
Falloff-to-coneOuterGain cone half-angle in degrees. Default 360.
coneOuterGain: number
Gain applied outside coneOuterAngle. Default 0.
elevation: number
Height of the source above (positive) or below (negative) the world plane, in world units. Default 0. Independent of Spatializable.position, and preserved across a position change that does not carry a z. It contributes to distance attenuation, to the panner's own directionality, and to Doppler - a source rising straight up recedes.
elevationVelocity: number
Vertical component of Spatializable.velocity, in world units per second. Default 0. Only Doppler reads it.
maxDistance: number
For the 'linear' model: distance at which volume reaches zero. Default 1000.
occlusion: number
How obstructed the path from this source to the listener is, in [0, 1]. 0 (default) is a clear path; 1 is fully obstructed. Caller-supplied: the engine does not trace geometry, because what counts as an obstruction is a game's decision (a wall, a closed door, a crowd). Write an estimate as often as you like - it is ramped, not stepped, so a per-frame value does not click. Realized as a lowpass plus an attenuation, tuned by app.audio.spatial.occlusionCutoff / .occlusionAttenuation. A voice whose occlusion stays 0 builds neither node.
orientation: number
Facing direction for cone attenuation, in degrees - same convention as SceneNode.rotation (0° = local +X / "east", clockwise-positive on a Y-down screen). Has no audible effect unless coneInnerAngle/ coneOuterAngle are narrowed below 360°. Default 0.
panningModel: PanningModelType | null
Per-voice panning model override. null (default) inherits the app-wide default from app.audio.spatial.panningModel.
refDistance: number
Distance below which volume is at full strength. Default 50.
rolloffFactor: number
Falloff rate. Higher = steeper attenuation. Default 1.
World-plane position of the source, or null when not spatialized. Two-dimensional, because the world plane is: the third axis lives on Spatializable.elevation, which Spatializable.follow cannot fill in and which most 2D games never touch.
World-space velocity of the source (world units/second), or null. Feeds the Doppler calculation (app.audio.spatial.dopplerFactor) - has no other effect. Explicit; when null and follow(node) is active, velocity is auto-derived each frame from the tracked node's position delta instead.
Source