This page is work-in-progress. You can reach me on twitter or mail to rezoner1337@gmail.com

Sound

Instance of SoundOnDemand.Sound - representation of a sound being played through a channel.

Play sound

Sound cannot play itself. It needs to get through a channel.

var sound = channel.play("explosion");

Volume, pan and playback rate (pitch):

sound.volume(0.5).rate(0.8).pan(-0.5);

Play a loop:

var song = channel.play("mysong").loop();

Fade

song.fadeOut(duration);
song.fadeIn(duration);
song.fadeTo(volume, duration);

Duration is provided in seconds - for example 0.5 is half of a second.

Stop, pause, resume

song.pause();
song.stop();
song.resume();

Ask question:

Fork me on GitHub