API

Interface ISoundOptions

Interface used to define options for Sound class

interface ISoundOptions {
    autoplay?: boolean;
    distanceModel?: "linear" | "inverse" | "exponential";
    length?: number;
    loop?: boolean;
    maxDistance?: number;
    offset?: number;
    playbackRate?: number;
    refDistance?: number;
    rolloffFactor?: number;
    skipCodecCheck?: boolean;
    spatialSound?: boolean;
    streaming?: boolean;
    useCustomAttenuation?: boolean;
    volume?: number;
}
Index
autoplay?: boolean

Does the sound autoplay once loaded.

distanceModel?: "linear" | "inverse" | "exponential"

Define the distance attenuation model the sound will follow.

length?: number

Defines an optional length (in seconds) inside the sound file

loop?: boolean

Does the sound loop after it finishes playing once.

maxDistance?: number

Maximum distance to hear that sound

offset?: number

Defines an optional offset (in seconds) inside the sound file

playbackRate?: number

Defines the playback speed (1 by default)

refDistance?: number

Define the reference distance the sound should be heard perfectly.

rolloffFactor?: number

Define the roll off factor of spatial sounds.

skipCodecCheck?: boolean

If true, URLs will not be required to state the audio file codec to use.

spatialSound?: boolean

Is it a spatial sound?

streaming?: boolean

Defines if the sound is from a streaming source

useCustomAttenuation?: boolean

Uses user defined attenuation function

volume?: number

Sound's volume