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

    Function resolveMeters

    • Read the meter out of a pair of options that accept either form.

      Entry points take meters for a piece that changes meter and keep ts as sugar for a piece that does not, so this is the one place that resolves the pair — including the rule that naming both is an input error rather than one of them silently winning.

      Parameters

      • opts: { ts?: MeterLike; meters?: MeterLike }

        The options carrying ts, meters, or neither.

      • name: string = 'meters'

        What the options belong to, for the error message.

      Returns MeterMap

      The meter map to analyse against, freshly allocated down to every signature and grouping array, so writing to it changes nothing another caller reads; 4/4 throughout when neither ts nor meters is given.

      If both ts and meters are given, or the map is malformed.

      import { parseTimeSignature, resolveMeters } from '@libraz/libcantus';
      resolveMeters({ ts: parseTimeSignature('3/4') });
      // [{ startBeat: 0, ts: { numerator: 3, denominator: 4 } }]