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

    Function beatsToTiedDurations

    • Spell a length in beats as a chain of tied note values.

      A length with a single spelling comes back as a one-element chain. Anything else is broken into undotted values, longest first, and a value immediately followed by its own half is then written as a dot instead: 5 beats reads as a whole note tied to a quarter, and 1.9375 beats as a double-dotted quarter tied to a dotted thirty-second. The dot is only written where it leaves the chain in longest-first order, so 10 beats reads as two whole notes tied to a half rather than as a whole note tied to a longer dotted whole. The chain knows nothing of barlines or beat grouping — an engraver splits further at those — and it uses no tuplets, so a length off the plain grid and with no single spelling has no chain either.

      Parameters

      • beats: number

        The length in beats.

      • options: { beatUnit?: NoteValue | DurationData } = {}

        beatUnit sets what one beat is; a quarter note by default.

      Returns SpelledDuration[]

      The tied durations, longest first, summing to beats.

      If beats is not positive, if the chain would exceed the generation budget, or — as a NoSolutionError — if no chain of plain and dotted values sums to it.

      import { beatsToTiedDurations } from '@libraz/libcantus';
      beatsToTiedDurations(5); // [{ base: 'whole', dots: 0 }, { base: 'quarter', dots: 0 }]