Hi There,<div><br></div><div>Graham Coleman had this awesome class called TimeGrid…  anyone know where that's located anymore?  I might be able to dig it up this weekend.  It encapsulated a lot of this kind of quantizing functionality in a neat way.</div>
<div><br></div><div>-Mike<br clear="all"><div><br></div><a href="http://michaelclemow.com" target="_blank">http://michaelclemow.com</a><br><a href="http://semiotech.org" target="_blank">http://semiotech.org</a><br><br><br>

<br><br><div class="gmail_quote">On Thu, May 3, 2012 at 12:34 PM, [chriswicks] <span dir="ltr"><<a href="mailto:crwicks@yahoo.com" target="_blank">crwicks@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:10pt;font-family:arial,helvetica,sans-serif"><div><span>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.</span></div>
<div><br><span></span></div><div><span>-crwicks<br></span></div><div class="hm HOEnZb"><div><br></div>  </div><div style="font-family:arial,helvetica,sans-serif;font-size:10pt"><div class="hm HOEnZb"> </div><div style="font-family:times new roman,new york,times,serif;font-size:12pt">
<div class="hm HOEnZb"> <div dir="ltr"> <font face="Arial"> <hr size="1">  <b><span style="font-weight:bold">From:</span></b> Tom Lieber <<a href="mailto:tom@alltom.com" target="_blank">tom@alltom.com</a>><br> <b><span style="font-weight:bold">To:</span></b> [chriswicks] <<a href="mailto:crwicks@yahoo.com" target="_blank">crwicks@yahoo.com</a>>; ChucK Users Mailing List <<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a>> <br>
 <b><span style="font-weight:bold">Sent:</span></b> Thursday, May 3, 2012 11:08
 AM<br> <b><span style="font-weight:bold">Subject:</span></b> Re: [chuck-users] coordinating rhythmic timing with unpredictable OSC events<br> </font> </div></div><div class="im"> <br>
On Thu, May 3, 2012 at 10:54 AM, [chriswicks] <<a href="mailto:crwicks@yahoo.com" target="_blank">crwicks@yahoo.com</a>> wrote:<br>> Hello all!  I'm quite new to ChucK, and I have a question concerning<br>> rhythmic timing.  I've got a program that I'm working on that accepts OSC<br>
> events being sent from a C++ application.  Now, the program chugs along,<br>> it's quite rhytmic, and I'd like to trigger melodic shreds based on values<br>> sent through OSC.  No problem doing that.  My problem comes from the fact<br>
> that the C++ app isn't in sync with the ChucK VM, so the times at which it<br>> chooses to send data are pretty much never in sync with everything else<br>> that's going on, so the melodic shred is triggered but is not lined up<br>
> rhythmically with everything else that's going on.<br>><br>> Is there any way to hack it so that it waits to add the shred until
 it's<br>> lined up with everything else (quantized, so to speak).  I'm not sure if I'm<br>> properly expressing the problem, so let me know if there's some way I can<br>> further clarify.<br><br>
Simplest way is to prepend your shreds with synchronization code like this:<br><br>  second / 2 => dur beat;<br>  beat - (now % beat) => now;<br><br>If your tempo varies, you might need an object that sends 'beat'<br>
events and you could wait to receive one of those at the start of the<br>shred instead.<br><br>-- <br>Tom Lieber<br><a href="http://AllTom.com/" target="_blank">http://AllTom.com/</a><br><a href="http://infinite-sketchpad.com/" target="_blank">http://infinite-sketchpad.com/</a><br>
<br><br> </div></div> </div>  </div></div><br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br></div>