[chuck-users] coordinating rhythmic timing with unpredictable OSC events

chriswicks crwicks at yahoo.com
Thu May 3 12:34:39 EDT 2012

All 3 replies were spot-on, thanks very much.  Tom Lieber, your suggestion works perfectly for my application, verbatim.  Thanks guys, this list is fantastic!  Loving ChucK.


 From: Tom Lieber <tom at alltom.com>
To: [chriswicks] <crwicks at yahoo.com>; ChucK Users Mailing List <chuck-users at lists.cs.princeton.edu> 
Sent: Thursday, May 3, 2012 11:08 AM
Subject: Re: [chuck-users] coordinating rhythmic timing with unpredictable OSC events
On Thu, May 3, 2012 at 10:54 AM, [chriswicks] <crwicks at yahoo.com> wrote:
> Hello all!  I'm quite new to ChucK, and I have a question concerning
> rhythmic timing.  I've got a program that I'm working on that accepts OSC
> events being sent from a C++ application.  Now, the program chugs along,
> it's quite rhytmic, and I'd like to trigger melodic shreds based on values
> sent through OSC.  No problem doing that.  My problem comes from the fact
> that the C++ app isn't in sync with the ChucK VM, so the times at which it
> chooses to send data are pretty much never in sync with everything else
> that's going on, so the melodic shred is triggered but is not lined up
> rhythmically with everything else that's going on.
> Is there any way to hack it so that it waits to add the shred until it's
> lined up with everything else (quantized, so to speak).  I'm not sure if I'm
> properly expressing the problem, so let me know if there's some way I can
> further clarify.

Simplest way is to prepend your shreds with synchronization code like this:

  second / 2 => dur beat;
  beat - (now % beat) => now;

If your tempo varies, you might need an object that sends 'beat'
events and you could wait to receive one of those at the start of the
shred instead.

Tom Lieber
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20120503/133ab177/attachment.html>

More information about the chuck-users mailing list