[chuck-users] cast dur to time?

Rich Caloggero rjc at MIT.EDU
Thu Jan 10 12:16:34 EST 2008


Thanx Graham; this makes sense, and is chuckin cool!  Gees, even I can 
understand it! Woohoo!
-- Rich

----- Original Message ----- 
From: "Graham Coleman" <ravelite at gmail.com>
To: "ChucK Users Mailing List" <chuck-users at lists.cs.princeton.edu>
Sent: Thursday, January 10, 2008 6:44 AM
Subject: Re: [chuck-users] cast dur to time?


> OK, I'm not a math wiz or even a audio/dsp wiz, and certainly not a ChucK
> wiz. What exactly does this mean:
> now - (now % T) => now;

In this context, T is a duration to which to synchronize, like a beat.

minute/140 => dur beat;

the expression (now % beat) is the remainder after dividing the
current time into uniform beats, the amount of time that hangs over
the last beat.

Usually, the next step for me is:

beat - (now % beat)

which indicates the time left until the next beat.

Chucking it to now wakes up the current shred exactly on the next beat / 
period.

beat - (now % beat) => now;

But as far as your expression

now - (now % T) => now;

if T is a duration, then the right hand expression would be the
current shred time (a time) minus that that hangs over the duration (a
duration), which would be a time in the past, which seems to throw a
NegativeTimeException in the VM.

Graham
_______________________________________________
chuck-users mailing list
chuck-users at lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users



More information about the chuck-users mailing list