[flocking-users] Fwd: using flocking

Laurens van der Wee l.vanderwee at gmail.com
Thu Jan 23 12:29:39 EST 2014


[sorry, that was sent out privately, again on the list:]


thank you colin, this is really great work! having fun!

http://laurensvanderwee.nl/flocking/index.html

repeating ajax call with timer determining pitch of sine wave.
is this the way to do it? -> schedule a change 'now', or is there also a
way to do something like: synth.freq = newfreq ?

thanks again!

laurens.



code:

var clock = flock.scheduler.async(),
synth = flock.synth({
nickName: "sinesynth",
synthDef: {
id: "sine",
ugen: "flock.ugen.sinOsc",
freq: 0,
mul: 0.25
}
}).play();


  function ajaxSynth(){
  var start = new Date().getTime();
  $.ajax({
  url: 'synthEcho.php',
  success: function(data) {
  var elapsed = new Date().getTime() - start;
var freq = elapsed*10;
$('body').append(' [' + elapsed + ',' + freq + ']');
clock.schedule([
{
interval: "once",
time: 0, //'now'
change: {
synth: "sinesynth",
values: {
"sine.freq": freq
}
}
}
]);
ajaxSynth();
}
});
}
 ajaxSynth();
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idrc.ocad.ca/pipermail/flocking/attachments/20140123/34ca2339/attachment.html>


More information about the flocking mailing list