[chuck-users] debug print duration
signal.automatique at gmail.com
Mon Nov 26 17:24:14 EST 2007
On 26/11/2007, Juan-Pablo Caceres <jcaceres at ccrma.stanford.edu> wrote:
> Hello list,
This is kind of a silly question, but do you guys remember how to print
> a duration on a specific unit? What I mean is something like this:
> 1::second => dur mydur;
> <<< mydur >>>; //see the output in seconds (or another time unit) rather
> than samples
Well, as mydur is some amount of time we can simply divide it by "a second",
It's that simple :-).
<<< mydur / 1.0::second, "seconds" >>>;
I put the 1.0 there to make sure we don't get that weird integer math
rounding business, I don't think we actually need that but i'm not on a
chucking computer right now so i can't test it.
Anyway, using this logic you can also express it in days or bars or beats
(asuming you define those last two) or whatever, as long as it's some sort
of time. the result will be a flaot without a unit, as per highschool
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the chuck-users