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

    Class SetTheory

    Allen Forte set-class analysis for any pitch-class collection.

    Index

    Constructors

    Methods

    • Returns all subsets of pcs with the given cardinality.

      Parameters

      • pcs: number[]
      • cardinality: number

      Returns number[][]

    • Returns the complement of a pitch class set (all PCs not in the set).

      Parameters

      • pcs: number[]

        Pitch class integers.

      • octave: number = 12

        Octave modulus (default 12).

      Returns number[]

    • Returns the Allen Forte set-class number for a pitch class set. Uses C=0 convention (same as standard set theory literature). Covers every set class of 1–12 pitch classes; returns 'unknown' for the empty set.

      Parameters

      • pcs: number[]

      Returns string

    • Extracts unique pitch classes from an array of notes. Uses the tuning system's octaveSteps as the modulus - works for any EDO. Returns integers 0 to (octaveSteps - 1) where 0 = A (the library's coordinate origin).

      Parameters

      Returns number[]

    • Like getPitchClasses, but as 12-TET pitch classes from C = 0 (standard set-theory convention). C=0, C#=1, D=2, ..., B=11. Notes in other tunings count for the nearest 12-TET pitch class.

      Parameters

      Returns number[]

    • Returns all prime forms that share the same interval vector as pcs (Z-related sets). Z-related sets have identical interval vectors but are not related by transposition or inversion. Returns an empty array if no Z-relation exists or the set is not in the Forte table.

      Parameters

      • pcs: number[]

        Pitch classes in C=0 space (0–11).

      Returns number[][]

      Array of prime forms (each an array of pitch classes in C=0 space) that are Z-related to pcs.

    • Calculates the Interval Vector of a pitch class set. Returns an array of length floor(octave / 2) counting interval class occurrences.

      Parameters

      • pcs: number[]

        Array of pitch class integers.

      • octave: number = 12

        Steps per octave (default 12).

      Returns number[]

    • Returns true if a is a subset of b (every PC in a is also in b).

      Parameters

      • a: number[]
      • b: number[]
      • octave: number = 12

      Returns boolean

    • Returns true if a is a superset of b (every PC in b is also in a).

      Parameters

      • a: number[]
      • b: number[]
      • octave: number = 12

      Returns boolean

    • Calculates the Normal Form of a pitch class set. The most compact arrangement of the set. Ties in span are broken as in Rahn (1980): the rotation whose second-to-last note is closest to the first wins, then the third-to-last… (Forte compares from the bottom instead; the two differ in a few set classes).

      Parameters

      • pcs: number[]

        Array of pitch class integers.

      • octave: number = 12

        Steps per octave (default 12). Pass tuningSystem.octaveSteps for non-12-TET.

      Returns number[]

    • Calculates the Prime Form of a pitch class set. The standard representative of a set class (transpositionally and inversionally equivalent).

      Parameters

      • pcs: number[]

        Array of pitch class integers.

      • octave: number = 12

        Steps per octave (default 12).

      Returns number[]

    • Transposition operator Tn - transposes all pitch classes by n.

      Parameters

      • pcs: number[]
      • n: number
      • octave: number = 12

      Returns number[]

    • Transposition + inversion operator TnI - inverts then transposes.

      Parameters

      • pcs: number[]
      • n: number
      • octave: number = 12

      Returns number[]