[LAD] 64 bit tempo-based time stamp

David Robillard d at drobilla.net
Tue Feb 7 01:48:41 UTC 2012


On Tue, 2012-02-07 at 00:40 +0000, Harry van Haaren wrote:
> Luppp's internals use a single(!) floating point, which mixes a bar
> number, and a "percent" of that bar.
> Found it quite nice to work with, to get the bar you just:
> int bar = (int) floatBeatPercent;
> while to get the percent you:
> float percent = floatBeatPercent - ((int)floatBeatPercent);
> 
> In C you mention "bar" as int, and "beat" as float, I presume you want
> to use the decimal part of the float to show "progress" trough that
> beat? Thinking about very slow BPM's.. that could become important.

Interesting, I hadn't considered just a value in bars.  Not having beats
at all seems strange.  The complete independence from time signature is
sort of nice, though.

The problem with that is the precision of exact beats is pretty fuzzy.
Particularly for e.g. 3/4 where beat 1 would be 0.33333....., beat 2 is
0.66666..., etc.

There *is* a lot to be said for a single floating point value, be it
beats or bars (math is so easy), but it seems sort of naive in a way I
can't really justify... 

-dr

P.S. "Percent" means "out of 100", "fraction" would be better here.  The
value you describe is simply a float with "bars" as the unit.





More information about the Linux-audio-dev mailing list