Constructor
new SoundWave(filename, randomnessopt, rangeopt, taperopt, onloadCallbackopt)
Create a sound object and cache the wave file for later use
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
filename | String | Filename of audio file to load | ||
randomness | Number | <optional> | 0 | How much to randomize frequency each time sound plays |
range | Number | <optional> | soundDefaultRange | World space max range of sound, will not play if camera is farther away |
taper | Number | <optional> | soundDefaultTaper | At what percentage of range should it start tapering off |
onloadCallback | function | <optional> | callback function to call when sound is loaded |
- Source
Example
// create a sound
const sound_example = new SoundWave('sound.mp3');
// play the sound
sound_example.play();