[chuck-users] coordinating rhythmic timing with unpredictable OSC events
tom at alltom.com
Thu May 3 11:08:50 EDT 2012
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
More information about the chuck-users