Interface SoundSourceOptions

Options to use for a sound source.

interface SoundSourceOptions {
    coneInnerAngle?: number;
    coneOuterAngle?: number;
    coneOuterGain?: number;
    distanceModel?: DistanceModelType;
    gain?: number;
    maxDistance?: number;
    panningModel?: PanningModelType;
    refDistance?: number;
    rolloffFactor?: number;
}

Properties

coneInnerAngle?: number

The angle, in degrees, of a cone inside of which there will be no volume reduction.

coneOuterAngle?: number

The angle, in degrees, of a cone outside of which the volume will be reduced by a constant value, defined by the coneOuterGain attribute.

coneOuterGain?: number

The amount of volume reduction outside the cone defined by the coneOuterAngle attribute. Its default value is 0, meaning that no sound can be heard.

distanceModel?: DistanceModelType

The algorithm to use to reduce the volume of the audio source as it moves away from the listener. The default value is "inverse".

gain?: number

The amount of gain to apply. If not specified, a GainNode will not be created and you won't be able to change the gain afterwards!

maxDistance?: number

The maximum distance between the audio source and the listener, after which the volume is not reduced any further.

panningModel?: PanningModelType

The spatialization algorithm to use to position the audio in 3D space.

refDistance?: number

The reference distance for reducing volume as the audio source moves further from the listener. For distances greater than this the volume will be reduced based on SoundSourceOptions.rolloffFactor and SoundSourceOptions.distanceModel.

rolloffFactor?: number

How quickly the volume is reduced as the source moves away from the listener. This value is used by all distance models.