1.6.0 • Published 10 years ago

openmusic-sample-player v1.6.0

Weekly downloads
3
License
Apache 2
Repository
github
Last release
10 years ago

openmusic-sample-player

Provides an abstraction on top of BufferSourceNodes so samples can be played without regenerating the node when ended

Install with NPM

Usage

Install first: npm install openmusic-sample-player.

Then you can use it in your code:

var SamplePlayer = require('openmusic-sample-player');

var audioContext = new AudioContext();
var player = SamplePlayer(audioContext);

// suppose you have a BufferSource in `buffer` already

player.buffer = buffer;

// if you want to make it loop
player.loop = true;

// and start playing!
player.start();

Multiple plays can be scheduled:

var now = audioContext.currentTime;
player.start(now + 1); // play in 1 second
player.start(now + 2); // play in 2 seconds
player.start(now + 3); // play in 3 seconds
// ...
player.stop(); // stop all scheduled plays

Demo

Run npm install so it installs stuff for the demo. Then gulp build, and then you can open build/index.html for the demo.

If you do changes in the code, you'll need to rebuild the demo. Use gulp build or gulp only for running build and setting up a watch loop that automatically rebuilds the demo as you change its files.

1.6.0

10 years ago

1.5.0

10 years ago

1.4.3

10 years ago

1.4.1

10 years ago

1.3.1

11 years ago

1.2.1

11 years ago

1.3.0

11 years ago

1.2.0

11 years ago

1.1.0

11 years ago

1.0.0

11 years ago