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

    Class Polyrhythm

    Polyrhythm generation and Euclidean rhythm distribution.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Calculates the Euclidean rhythm (distributing k pulses as evenly as possible over n steps). Popular in African, Latin, and electronic music (e.g., E(3,8) is the Tresillo).

      Parameters

      • pulses: number
      • steps: number

      Returns boolean[]

    • Generates a polyrhythm between multiple voices.

      Parameters

      • voices: number[]

        Array of pulse counts (e.g., [3, 4] for 3-against-4)

      • totalDuration: number = 1

        The total duration of the cycle in whole notes (default 1)

      Returns number[][]

      An array of voices, each containing an array of timestamps (fractions of totalDuration) where pulses occur.