@libraz/libcantus - v1.1.0
    Preparing search index...

    Function formatBarPosition

    • Render an absolute position as the bar.beat a DAW or a score shows: 1-based bar, 1-based felt beat.

      The felt beats counted are the ones the bar actually has. A meter change starts a new bar, so the bar it interrupts is short, and a position that rounds past the end of a short bar reads as the downbeat of the next one rather than as a beat the bar never reached.

      Parameters

      • beatInQuarters: number

        Absolute position in quarter-note beats.

      • meter: MeterLike

        A single signature, or the piece's meter map.

      • decimals: number = 2

        Digits of the fractional beat to keep.

      Returns string

      The formatted position in one of two forms: bar.beat on a felt beat, e.g. '3.2' for bar 3, felt beat 2; and bar.beat+fraction between felt beats, e.g. '3.2+0.5' halfway from the second felt beat to the third. A reader of these strings has to take both, since most onsets of an ordinary piece fall between pulses.

      import { formatBarPosition, parseTimeSignature } from '@libraz/libcantus';
      formatBarPosition(7.5, parseTimeSignature('6/8')); // '3.2'
      formatBarPosition(8.25, parseTimeSignature('6/8')); // '3.2+0.5'