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

    Function analyzeRhythm

    • How a line places its onsets against the meter: density, metric placement, interval spacing, rest, and Longuet-Higgins & Lee syncopation.

      Onsets within 0.05 beat of one another read as one, and an onset further than 1/32 beat from the nearest twelfth-of-a-beat slot is read as off grid; every onset is moved to its nearest slot for everything downstream of it, so an unquantized line reads a real but reduced syncopation rather than a spurious one from a grid it never intended to sit on.

      Parameters

      Returns RhythmAnalysis

      The rhythm reading; see RhythmAnalysis.

      import { analyzeRhythm } from '@libraz/libcantus';
      const rhythm = analyzeRhythm(
      [
      { pitch: 60, startBeat: 0, durationBeat: 1.5 },
      { pitch: 62, startBeat: 1.5, durationBeat: 2.5 },
      ],
      { ts: '4/4' },
      );
      rhythm.onsets; // 2
      rhythm.syncopation > 0; // true