[flocking] Scheduling

Colin Clark colin at colinclark.org
Thu Dec 1 23:10:18 UTC 2016

Hi Jesse,

Sorry for the slow response. In terms of scheduling, I think the easiest approach is to use a tempo scheduler, and schedule actions using the low-level callback API:

var scheduler = flock.scheduler.async.tempo({
    bpm: 120

scheduler.repeat(4, function () {
   // Do something every four beats.

scheduler.once(8, function () {
    // Do something eight beats from now.

This is a very low-level API, but it should allow you to build more musical abstractions on top of it. It is also not, in the current version, sample-accurate, so you will find some clock drift (especially on Firefox). You could, as an alternative, look at integrating the Bergson scheduler with Flocking, but that will be more work (something on my to do list for the next release). 

https://github.com/colinbdclark/bergson <https://github.com/colinbdclark/bergson>

I hope this helps,


> On Nov 25, 2016, at 8:05 AM, Jesse Sibley <jessesibley at protonmail.com> wrote:
> Hi flocking people!
> Sorry for this extremely late reply. After sending my previous email, I stopped work on my project for a while (it's a school project). I'm looking for advice using scheduling in flocking. I've managed to find odd bits and bobs on how to schedule changes to a synth but I'm looking to be able to schedule different samples and have them synchronise to say 120 bpm (if that makes sense).
> I've had a look at bands and scheduling, although I'm not entirely sure of the best method and considering the changes that are happening in flocking, I'm not sure if any code I write now will be made redundant by better features in the near future.
> Thanks for your help again!
> Jesse Sibley (Chickencoder)
> _______________________________________________
> flocking mailing list
> flocking at lists.idrc.ocad.ca
> http://lists.idrc.ocad.ca/mailman/listinfo/flocking

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idrc.ocad.ca/pipermail/flocking/attachments/20161201/75340fc5/attachment.html>

More information about the flocking mailing list