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.
// 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.
The AudioContext of the listener given in the constructor.
A GainNode created using AudioContext.createGain().
Default is null
.
Time delta value for audio entities. Use in context of AudioParam.linearRampToValueAtTimeDefault(). Default is .
Return the gainNode.
Set the filter property to null
.
Returns the value of the filter property.
Set the filter property to value
.
Return the volume.
Set the volume.
For more info on how to obtain the source code of this module see this page.