How to use the Audio function from three
Find comprehensive JavaScript three.Audio code examples handpicked from public code repositorys.
12 13 14 15 16 17 18 19 20
this.isPositional = isPositional; if (this.isPositional) { this.sound = new THREE.PositionalAudio(State.get('listener')); } else { this.sound = new THREE.Audio(State.get('listener')); } this.averageAnalyser = 0;
10
33
10
15 16 17 18 19 20 21 22 23 24
const THREE = require('three'); var listener = new THREE.AudioListener(); // 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(); audioLoader.load( './resources/sound/BGM.mp3', function( buffer: any ) {
3
4
0
+ 11 other calls in file
27 28 29 30 31 32 33 34 35 36
spiderMoveAction.reset().play(); }, loadAudio(listener) { var audioLoader = new THREE.AudioLoader(); squishSound = new THREE.Audio(listener); audioLoader.load( './assets/audio/spiderSquish1.mp3', function(buffer) { squishSound.setBuffer(buffer); squishSound.setVolume(1.0); });
19
0
1
85 86 87 88 89 90 91 92 93
/* Helper Functions */ /******************/ function loadMusic(index) { listener = new THREE.AudioListener(); var audLoad = new THREE.Audio(listener); visElements.sound = audLoad; audioLoader = new THREE.AudioLoader();
16
0
2
GitHub: debian4tw/cuboid3
46 47 48 49 50 51 52 53 54 55
attachListener(mesh) { mesh.add(this.listener); } loadSound(fileName, callback) { // create a global audio source var sound = new THREE.Audio(this.listener); // load a sound and set it as the Audio object's buffer this.audioLoader.load(this.basePath + fileName, (buffer) => { sound.setBuffer(buffer); sound.setVolume(1);
0
2
0
GitHub: star8ks/sketch
43 44 45 46 47 48 49 50 51 52
const audioBuffer = assets.get('audio-boing'); // a global audio source const audioListener = new THREE.AudioListener(); // add the listener to the camera app.camera.add(audioListener); const boingSound = new THREE.Audio(audioListener); boingSound.setBuffer(audioBuffer); const shaderMat = new THREE.ShaderMaterial({ vertexShader: assets.get('file-vs'),
1
1
0
131 132 133 134 135 136 137 138 139 140
this.fireworks = new Three.Points(this.fireworkGeometry, this.fireworksMaterial); // 创建音频 this.linstener = new Three.AudioListener(); this.linstener1 = new Three.AudioListener(); this.sound = new Three.Audio(this.linstener); this.sendSound = new Three.Audio(this.linstener1); // 创建音频加载器 var audioLoader = new Three.AudioLoader(); audioLoader.load("./assets/audio/pow".concat(Math.floor(Math.random() * 4) + 1, ".ogg"), function (buffer) { _this.sound.setBuffer(buffer);
0
0
0
+ 7 other calls in file
GitHub: e-eq-mc2/cookingworld
6 7 8 9 10 11 12 13 14 15
// create an AudioListener and add it to the camera const listener = new THREE.AudioListener(); camera.add( listener ); // create a global audio source const sound = new THREE.Audio( listener ); const state = {isReady: false} // load a sound and set it as the Audio object's buffer const audioLoader = new THREE.AudioLoader();
0
0
0
GitHub: yugo333/newWeb
211 212 213 214 215 216 217 218 219 220
//オーディオ var listener = new THREE.AudioListener(); loader.camera.add(listener); var fftSize = 128; // create a global audio source sound = new THREE.Audio(listener); // load a sound and set it as the Audio object's buffer // const mp3 = require(); var audioLoader = new THREE.AudioLoader(); audioLoader.load("./assets/images/webSound.mp3", function (buffer) {
0
0
0
GitHub: rikrik527/shan
40 41 42 43 44 45 46 47 48 49
var ambient = new THREE.AmbientLight(0xffffff); scene.add(ambient); scene.add(ball2); var listener = new THREE.AudioListener(); camera.add(listener); var sound = new THREE.Audio(listener); var audioLoader = new THREE.AudioLoader(); audioLoader.load(music, function(buffer){ sound.setBuffer(buffer); sound.setLoop(true);
0
0
0
12 13 14 15 16 17 18 19 20 21 22
let chimes = [chime1, chime2, chime3]; const audioLoader = new THREE.AudioLoader(); export default function(_listener){ listener = _listener; const amb1 = new THREE.Audio(listener); const stab1 = new THREE.Audio(listener); const stab2 = new THREE.Audio(listener);
0
0
0
+ 7 other calls in file
GitHub: twalk4821/kelsiWorld3D
106 107 108 109 110 111 112 113 114 115
const story = new THREE.Mesh(storyGeom, storyMats); story.position.y += 5; scene.add(story); this.story = story; const music = new THREE.Audio( listener ); const explosion = new THREE.Audio( listener ); audioLoader.load(explosionTrack, ( buffer ) => { explosion.setBuffer( buffer );
0
0
1
+ 11 other calls in file
three.Vector3 is the most popular function in three (22341 examples)