The notion of time


#1

Studying the StepSequencer example, in TempoSequence we have a bunch of conversions.

I was just wondering if you could clarify the types of timing Tracktion recognizes.

Does time means seconds/milliseconds?

Is there a notion of float/double beat time?

e.g. 1.5f is beat 1 and a half, where 0.5 in a step sequencer is step 7 (in 16ths).

EDIT: This calculation is connected to the time signature.

TempoSequence does seem to have all the answers but I am bit confused as to the exact meaning of the lingo. Time / Bars / Beats / TempoSections etc.


#2

Unless it specifies in the function name (e.g. getTimeBeats) time is in seconds.

The best description of “beats” is in one of the settings comments:

    /** If this returns true, it means that the length (in seconds) of one "beat" at
        any point in an edit is considered to be the length of one division in the current
        bar's time signature.
        So for example at 120BPM, in a bar of 4/4, one beat would be the length of a
        quarter-note (0.5s), but in a bar of 4/8, one beat would be the length of an
        eighth-note (0.25s)

        If false, then the length of one beat always depends only the current BPM at that
        point in the edit, so where the BPM = 120, one beat is always 0.5s, regardless of
        the time-sig.

        You shouldn't dynamically change this function's return value - just implement a
        function that always returns true or false.
    */
    virtual bool lengthOfOneBeatDependsOnTimeSignature()             { return true; }

(I’m changing the default to true as this makes more musical sense and is what we use in Waveform).

The simplest thing to do is look at TempoSequence and the various conversion methods it has timeToBeats, timeToBarsBeats, beatsToTime etc.

One day we’ll add a class to encapsulate this but it will still need a TempoSequence to do the conversion between beats/time.