Skip to content

rezoner/SoundOnDemand

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SoundOnDemand

Game oriented sound library using WebAudioAPI. Probably won't get along with mobiles or Internet Explorer - but get things done if you are targeting desktop games, Chrome or Firefox.

Comes in vanilla and playground.js flavor.

Core features:

  • Sounds don't have to be preloaded hence the Sound On Demand.
  • Engine can be divided to separate channels (for music, gui, environment...)
  • Each channel can be armed with convolver (for reverb or environmental effects)

Examples

Initialization:

var audio = new SoundOnDemand();

var sound = audio.channel("sound");
var music = audio.channel("music");
var enviro = audio.channel("enviro");

enviro.convolver(0.4, "forest");

Play music in a loop:

music.play("themes/intro").loop().fadeIn();

Play a sound and change its pitch (playback rate)

sound.play("gunshot").rate(0.8).volume(0.4);

Play a loop and manipulate it later:

var laserLoop = sound.play("laser").loop();

/* ... */

laserLoop.rate(0.4).volume(1.0);
laserLoop.fadeOut();

Or create a new sound from existing one:

audio.alias("explosion2", "explosion", rate, volume);

/* ... */

sound.play("explosion2");

Documentation

Read full documentation

About

Game oriented sound library using WebAudioAPI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published