Logic Pro X: Use the JavaScript TimingInfo object

Use the JavaScript TimingInfo object

The TimingInfo object contains timing information that describes the state of the host transport and the current musical tempo and meter. A TimingInfo object can be retrieved by calling GetTimingInfo().

TimingInfo properties

  • TimingInfo.playing: Uses Boolean logic where “true” means the host transport is running.

  • TimingInfo.blockStartBeat: A floating point number indicates the beat position at the start of the process block. An alternative is to use the beatPos property. See Use the MIDI event beatPos property.

  • TimingInfo.blockEndBeat: A floating point number indicates the beat position at the end of the process block.

  • TimingInfo.blockLength: A floating point number indicates the length of the process block in beats.

  • TimingInfo.tempo: A floating point number indicates the host tempo.

  • TimingInfo.meterNumerator: An integer number indicates the host meter numerator.

  • TimingInfo.meterDenominator: An integer number indicates the host meter denominator.

  • TimingInfo.cycling: Uses Boolean logic where “true” means the host transport is cycling.

  • TimingInfo.leftCycleBeat: A floating point number indicates the beat position at the start of the cycle range.

  • TimingInfo.rightCycleBeat: A floating point number indicates the beat position at the end of the cycle range.

    Note: The length of a beat is determined by the Logic Pro X time signature and tempo.

Load the corresponding Tutorial setting to view the script in the Script Editor. This will help you to understand the syntax structure and layout of code and comments. See Use the Script Editor.

Tutorial script 9: NeedsTimingInfo and GetTimingInfo

This example prints the beat position to the console while the transport is running.

  • Text following /* shows comments that explain the JavaScript code.

    var NeedsTimingInfo = true; /* needed for GetTimingInfo to work */ function ProcessMIDI() { var info = GetTimingInfo(); /* get the timing info from the host */ if (info.playing) /* if the transport is playing */ Trace(info.blockStartBeat) /* print the beat position */ }
Published Date: Aug 9, 2019
Helpful?