[page:Object3D] →

[name]

Create a non-positional ( global ) audio object.

This uses the [link:https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API Web Audio API].

Example

[example:misc_sound misc / sound ]
//Create an AudioListener and add it to the camera var listener = new THREE.AudioListener(); camera.add( listener ); // create a global audio source var sound = new THREE.Audio( listener ); var audioLoader = new THREE.AudioLoader(); //Load a sound and set it as the Audio object's buffer audioLoader.load( 'sounds/ambient.ogg', function( buffer ) { sound.setBuffer( buffer ); sound.setLoop(true); sound.setVolume(0.5); sound.play(); });

Constructor

[name]( )

Create a new AudioListener.

Properties

[property:AudioContext context]

The [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext] of the [page:AudioListener listener] given in the constructor.

[property:GainNode gain]

A [link:https://developer.mozilla.org/en-US/docs/Web/API/GainNode GainNode] created using [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createGain AudioContext.createGain]().

[property:AudioNode filter]

Default is *null*.

Methods

[method:GainNode getInput]()

Return the [page:AudioListener.gain gainNode].

[method:null removeFilter]()

Set the [page:AudioListener.filter filter] property to *null*.

[method:AudioNode getFilter]()

Returns the value of the [page:AudioListener.filter filter] property.

[method:null setFilter]( [page:AudioNode value] )

Set the [page:AudioListener.filter filter] property to *value*.

[method:Number getMasterVolume]()

Return the volume.

[method:null getMasterVolume]( [page:Number value] )

Set the volume.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]