jsynth-sync
A syncopation module for jsynth, baudio, and webaudio;
how to use it
see also the example
The constructor requires beatsPerMinute and SampleRate values.
var sync = ; var timer = // 72 bpm, samplRate 8000 (8k samples per second)var t = timervar i = timer { timertick };
methods
sync.on(beatValue, fn)
timer will call fn every beatValue. the return of sync.on() is a function which clears fn from being called any more. Your function will be called with the actual clock time of the call, a count for the beatValue, and a function you can call to clear the current call for good.
var quarter = sync
timer.tick()
Timer tick does not require any arguments, but will pass them on to your function. Simply call it for every sample.
timer.clearAll()
clear all the timered functions