2009/2/28 Robert Poor
<rdpoor@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 floats.
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,
Kas.