0.0.37 • Published 2 years ago
divine-audio-engine v0.0.37
A JavaScript game audio engine.
Suppourts varationsm, spatial sounds, and effects.
Check out live examples here: Examples
import {DAE} from "divine-audio-engine";
await DAE.effects.preloadReverbBuffers(
[
"Vaneev/Deep Space",
"Vaneev/Rays",
"Vaneev/On a Star",
"Vaneev/St Nicolaes Church",
],
[]
);
DAE.sfx.registerSFX([
{
path: "./assets/audio/sfx/electric-gong.wav",
id: "electric-gong",
channel: "sfx",
is3dSound: true,
_3dSoundData: {
rolloffFactor: 1,
},
varations: [
{
playBackRate: 0.9,
},
{
playBackRate: 0.8,
},
{
playBackRate: 1.2,
},
{
playBackRate: 0.5,
},
],
},
]);
await DAE.$INIT();
DAE.sfx.play("electric-gong", {
level: 1,
_3dSoundPosition: {
x: 1,
y: 1,
z: 1,
},
effects: {
reverb: {
builtIn: "Vaneev/Deep Space",
level: 0.1,
},
},
});