diff --git a/docs/api/audio/Audio.html b/docs/api/audio/Audio.html index c3629a3ddc42aa..9c09637a89532d 100644 --- a/docs/api/audio/Audio.html +++ b/docs/api/audio/Audio.html @@ -21,18 +21,21 @@

[name]

Example

-
[example:misc_sound misc / sound ]
+
+ [example:webaudio_sandbox webaudio / sandbox ]
+ [example:webaudio_visualizer webaudio / visualizer ] +
+ - //Create an AudioListener and add it to the camera + // 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 ); + // load a sound and set it as the Audio object's buffer 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 ); diff --git a/docs/api/audio/AudioAnalyser.html b/docs/api/audio/AudioAnalyser.html index 2647c0c1656a5d..d6bbb32e5f4ad0 100644 --- a/docs/api/audio/AudioAnalyser.html +++ b/docs/api/audio/AudioAnalyser.html @@ -21,18 +21,21 @@

[name]

Example

-
[example:misc_sound misc / sound ]
+
+ [example:webaudio_sandbox webaudio / sandbox ]
+ [example:webaudio_visualizer webaudio / visualizer ] +
+ - //Create an AudioListener and add it to the camera + // create an AudioListener and add it to the camera var listener = new THREE.AudioListener(); camera.add( listener ); // create an Audio source var sound = new THREE.Audio( listener ); + // load a sound and set it as the Audio object's buffer 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); @@ -40,11 +43,11 @@

Example

sound.play(); }); - //Create an AudioAnalyser, passing in the sound and desired fftSize + // create an AudioAnalyser, passing in the sound and desired fftSize var analyser = new THREE.AudioAnalyser( sound, 32 ); - //Get the average frequency of the sound - analyser.getAverageFrequency(); + // get the average frequency of the sound + var data = analyser.getAverageFrequency();
diff --git a/docs/api/audio/AudioListener.html b/docs/api/audio/AudioListener.html index 73fe60a7e4271d..a9291c3f3b4046 100644 --- a/docs/api/audio/AudioListener.html +++ b/docs/api/audio/AudioListener.html @@ -13,27 +13,30 @@

[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]. - + The [name] represents a virtual [link:https://developer.mozilla.org/de/docs/Web/API/AudioListener listener] of the all positional and non-positional audio effects in the scene.
+ A three.js application usually creates a single instance of [name]. It is a mandatory construtor parameter for audios entities like [page:Audio Audio] and [page:PositionalAudio 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.

Example

-
[example:misc_sound misc / sound ]
+
+ [example:webaudio_sandbox webaudio / sandbox ]
+ [example:webaudio_timing webaudio / timing ]
+ [example:webaudio_visualizer webaudio / visualizer ] +
+ - //Create an AudioListener and add it to the camera + // 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 ); + // load a sound and set it as the Audio object's buffer 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); diff --git a/docs/api/audio/PositionalAudio.html b/docs/api/audio/PositionalAudio.html index c376fe2921e81c..30981e7b5d46f9 100644 --- a/docs/api/audio/PositionalAudio.html +++ b/docs/api/audio/PositionalAudio.html @@ -21,16 +21,20 @@

[name]

Example

-
[example:misc_sound misc / sound ]
+
+ [example:webaudio_sandbox webaudio / sandbox ]
+ [example:webaudio_timing webaudio / timing ] +
+ - //Create an AudioListener and add it to the camera + // create an AudioListener and add it to the camera var listener = new THREE.AudioListener(); camera.add( listener ); - //Create the PositionalAudio object (passing in the listener) + // create the PositionalAudio object (passing in the listener) var sound = new THREE.PositionalAudio( listener ); - //Load a sound and set it as the PositionalAudio object's buffer + // load a sound and set it as the PositionalAudio object's buffer var audioLoader = new THREE.AudioLoader(); audioLoader.load( 'sounds/song.ogg', function( buffer ) { sound.setBuffer( buffer ); @@ -38,13 +42,13 @@

Example

sound.play(); }); - //Create an object for the sound to play from + // create an object for the sound to play from var sphere = new THREE.SphereGeometry( 20, 32, 16 ); var material = new THREE.MeshPhongMaterial( { color: 0xff2200 } ); var mesh = new THREE.Mesh( sphere, material ); scene.add( mesh ); - //Finally add the sound to the mesh + // finally add the sound to the mesh mesh.add( sound );