Controls
const orchestre = new Orchestre(120); await orchestre.addPlayers([ {name: 'bass', url: './assets/bass.ogg', length: 16, absolute: true}, {name: 'melody', url: './assets/melody.ogg', length: 8, absolute: false}, // etc... ]) orchestre.start();
Play
Activate and deactivate your players to make them play in sync.
There are two kinds of players: absolute and relative. Play around with them to hear the difference!
Absolute
Will always stay on the same beats
Relative
Will play on the first beat when activated
orchestre.play('bass');
orchestre.stop('bass');
// alternate between play and stop orchestre.toggle('bass');
Options
Orchestre-JS comes with several options to use players in different ways.
Play or stop immediately with a fade in and fade out
Play only once
orchestre.toggle('synth', { now: true, fade: 1.2 });
orchestre.play('jingle', { once: true });
Events
Subscribe to events to trigger actions on beat.
EIGHT!
Called every two beats
off
await orchestre.wait(8);
let listenerId = orchestre.addListener(() => { playAnimation() }, 2);
orchestre.removeListener(listenerId);