[chuck-users] cast dur to time?
Graham Coleman
ravelite at gmail.com
Thu Jan 10 06:44:54 EST 2008
> 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
More information about the chuck-users
mailing list