The AudioListener represents a virtual listener of the all positional and non-positional audio effects in the scene.
A Verge3D application usually creates a single instance of AudioListener. It is a mandatory construtor parameter for audios entities like Audio and PositionalAudio.
In most cases, the listener object is a child of the camera. So the 3D transformation of the camera represents the 3D transformation of the listener.

Code Example

// create an AudioListener and add it to the camera const listener = new v3d.AudioListener(); camera.add(listener); // create a global audio source const sound = new v3d.Audio(listener); // load a sound and set it as the Audio object's buffer const audioLoader = new v3d.AudioLoader(); audioLoader.load('sounds/ambient.ogg', function(buffer) { sound.setBuffer(buffer); sound.setLoop(true); sound.setVolume(0.5); sound.play(); });


webaudio / sandbox
webaudio / timing
webaudio / visualizer



Create a new AudioListener.


.context : AudioContext

The AudioContext of the listener given in the constructor.

.gain : GainNode

A GainNode created using AudioContext.createGain().

.filter : AudioNode

Default is null.

.timeDelta : Number

Time delta value for audio entities. Use in context of AudioParam.linearRampToValueAtTimeDefault(). Default is .


.getInput () : GainNode

Return the gainNode.

.removeFilter () : this

Set the filter property to null.

.getFilter () : AudioNode

Returns the value of the filter property.

.setFilter (value : AudioNode) : this

Set the filter property to value.

.getMasterVolume () : Float

Return the volume.

.setMasterVolume (value : Number) : this

Set the volume.


For more info on how to obtain the source code of this module see this page.