[CM] Timing drift

Neil Baylis neil.baylis at gmail.com
Wed Apr 8 09:42:16 PDT 2009


On Wed, Apr 8, 2009 at 9:02 AM, Heinrich Taube <taube at uiuc.edu> wrote:

> this might do it, at least it sounds better in chicken. the problem is that
> it may screw up other things
>
>
>            else
>             {
>                double after=Time::getMillisecondCounterHiRes();
>                delta*=1000.0; // convert user's wait value to milliseconds
>                delta-=(after-curtime); // subtract out scheme's overhead
>                //time=(delta>0.0) ? (after+delta) : after;
>                time=(delta>0.0) ? (curtime+delta) : curtime;
>              }
>


Rick,
I applied this patch (with Chicken 3.4.0) and it seems to work. I listened
for many minutes and couldn't detect the phase drifting between the two
processes.

I'm using this process:

(define (note-cycle endtime keys rate)
  (process with pat = (make-cycle keys)
   for t from rate by rate
   while (< (elapsed) endtime)
   do
   (send "mp:midi" key: (next pat) dur: rate)
   (wait (- t (elapsed)))))

With your patch and the original process that doesn't attempt to compensate
for the overhead, I still saw phase drift, although it may have taken longer
to become apparent:

(define (note-cycle endtime keys rate)
  (process with pat = (make-cycle keys)
   while (< (elapsed) endtime)
   do
   (send "mp:midi" key: (next pat) dur: rate)
   (wait rate)))

Thanks,

Neil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/pipermail/cmdist/attachments/20090408/a97b6f46/attachment.html 


More information about the Cmdist mailing list