SoundWave

Sound Wave Object - Stores a wave sound for later use and can be played positionally

  • this can be used to play wave, mp3, and ogg files

Constructor

new SoundWave(filename, randomnessopt, rangeopt, taperopt, onloadCallbackopt)

Create a sound object and cache the wave file for later use

Parameters:
NameTypeAttributesDefaultDescription
filenameString

Filename of audio file to load

randomnessNumber<optional>
0

How much to randomize frequency each time sound plays

rangeNumber<optional>
soundDefaultRange

World space max range of sound, will not play if camera is farther away

taperNumber<optional>
soundDefaultTaper

At what percentage of range should it start tapering off

onloadCallbackfunction<optional>

callback function to call when sound is loaded

Example
// create a sound
const sound_example = new SoundWave('sound.mp3');

// play the sound
sound_example.play();