Universal Music Theory Library - v0.12.0
    Preparing search index...

    Class RhythmAnalysis

    Detection of rhythmic features: hemiola, syncopation, clave patterns, etc.

    Index

    Constructors

    Methods

    • Detects if the pattern matches the Cinquillo (2+1+2+1+2 - 8 steps, 5 pulses: X.XX.XX.).

      Parameters

      • pattern: number[]

      Returns boolean

    • Identifies which clave pattern (if any) matches the input, from CLAVE_PATTERNS.

      Parameters

      • pattern: number[]

        Onset array of 16 steps (two bars of 4/4 in eighth notes, or one in sixteenths).

      Returns "son-3-2" | "son-2-3" | "rumba-3-2" | "rumba-2-3" | "bossa" | "none"

    • Detects hemiola: accents grouping six beats as 2+2+2 where the meter groups them 3+3 (two bars of a triple meter such as 3/4, or one bar of 6/8 or 6/4).

      Parameters

      • pattern: number[]

        Accent positions in beats from the start (0-indexed), over one span of six beats (two bars of 3, one bar of 6); later spans repeat modulo 6.

      • timeSignature: TimeSignature

        A meter of 3 or 6 beats; others return false.

      Returns boolean

      True when accents fall on beats 0, 2 and 4 of the span and not on beat 3.

    • Returns a syncopation index (0–1): proportion of accented notes that fall on weak beats.

      Parameters

      • pattern: number[]

        Array of onset positions (beat positions, 0-indexed).

      • timeSignature: TimeSignature

        The meter context.

      Returns number

    • Detects if the pattern matches the Tresillo (3+3+2 over 8 steps).

      Parameters

      • pattern: number[]

      Returns boolean

    • Strong beats of a meter, 0-indexed: the start of each group in an additive meter (3+2+2 → 0, 3, 5); every third beat in a compound meter (6/8 → 0, 3; 9/8; 12/8); every other beat in a duple or quadruple one (2/4, 4/4 → 0, 2); only the downbeat in a triple one (3/4) or an irregular one.

      Parameters

      Returns number[]