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

    Function metricWeight

    • Metric weight of a position within its bar, on a 0–3 scale: 3 the downbeat, 2 a secondary strong pulse, 1 any other main pulse, and 0 an off-pulse subdivision.

      The secondary strong pulse is the bar's midpoint in even simple/compound meters. For an additive/irregular meter with TimeSignature.grouping set (e.g. [2, 2, 3] for 7/8), each group's head pulse other than the downbeat is the secondary strong pulse instead; without a grouping every non-downbeat main pulse of such a meter weighs 1 (flat, evenly divided pulses). A grouping of equal-length groups (9/8 as [1, 1, 1], 4/4 as [1, 1, 1, 1]) states the division the meter already has, so it weighs as an ungrouped bar rather than accenting every group head.

      Given a meter map, the weight follows the signature in force at that beat, so beat 2 of a piece is a mid-bar accent in 4/4 and a plain main pulse in 3/4. The downbeat is beat 0 however much pickup precedes it, so a note in the pickup weighs as the upbeat it is rather than as a downbeat.

      Parameters

      • beatInQuarters: number

        Absolute quarter-note position, or an in-bar offset when the meter is a single signature.

      • meter: MeterLike

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

      Returns number

      The metric weight (0–3).

      If the meter is malformed, including a grouping that is not a positive-integer list summing to the pulse count or the numerator.

      import { parseTimeSignature, metricWeight } from '@libraz/libcantus';
      const ts = parseTimeSignature('4/4');
      metricWeight(0, ts); // 3 (the downbeat)