[chuck-users] converting from dur to float

Kassen signal.automatique at gmail.com
Sat Feb 28 05:28:49 EST 2009

2009/2/28 Robert Poor <rdpoor at gmail.com>

> Is there truly no way to cast from a dur to a float?

In addition to  Rogan's notes;

Dividing any dur by another dur will give you a float so;

second / ms => float thousand;

This is, BTW, a 100% proper; in physics, if I divide a meter into bits that
are a centimetre long then the result will be a 100, a amount without a
unit. If I'd divede the same meter into a hundred(without unit)  bits the
result will be a centimetre (or 0.01 metre) so definitely with a unit.
Duration inherently expresses time and so it will have a unit, unlike

> I'm writing a sketch of a TapTempo object.  It measures the duration
> between events to estimate a tempo (in my case, expressed in Hz), which of
> necessity means *somewhere* I need to convert from a dur to a float.

You may also be interested in .period( dur ), a member function of many
oscillators that sets the period of the wave shape and which is just a
alternative way of expressing the frequency. This can be quite useful for
setting LFO speeds relative to a piece's BPM.

Hope that helps,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20090228/56783534/attachment.htm>

More information about the chuck-users mailing list