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

    Class JustIntonation

    Just Intonation - pitch classes defined by exact frequency ratios within one octave. The octave (2:1) is implied and not included in the ratios array.

    Example: 5-limit JI major scale

    new JustIntonation('5-limit Major', [[9,8],[5,4],[4,3],[3,2],[5,3],[15,8]])
    

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • name: string
      • ratios: Ratio[]

        Frequency ratios for the pitch classes above the tonic (unison excluded). At least one ratio is required. The unison (1:1) is prepended automatically if absent.

      • baseFrequency: number = 440

      Returns JustIntonation

    Properties

    baseFrequency: number = 440

    Reference frequency for step 0 (A4). Default: 440 Hz.

    intervals: Interval[]

    Resolved interval objects including the implicit unison at index 0.

    name: string

    Display name: '12-TET', 'Ptolemaic Just Intonation', 'Werckmeister III'.

    Accessors

    • get octaveSteps(): number

      Number of steps that constitute one period (usually one octave, 2:1). For non-octave tunings (e.g. Bohlen-Pierce) this is steps per tritave.

      Returns number

    Methods

    • Returns the frequency in Hz for a given step offset from A4.

      Parameters

      • steps: number

      Returns number

    • Returns a note name for the given step: the 12-TET name of the note the step stands for (getStandardStep), in sharps ("C#4", "A4"), or "Step N" when it stands for none.

      Parameters

      • step: number

      Returns string

    • Converts a 12-TET step pattern (successive steps, e.g. major [2, 2, 1, 2, 2, 2, 1]) to this tuning. Each note's position above the first is mapped, not each step, so the pattern keeps its span: in 22-EDO the major scale spans 22 steps (rounding each step would give 24), and in a 7-note JI scale a semitone does not collapse to 0 steps. A step comes out 0 only when two notes land on the same step of this tuning.

      Parameters

      • pattern: readonly number[]

      Returns number[]

    • The 12-TET note a step stands for: the 12-TET step (A4 = 0) nearest in cents, when getStepFromStandard maps that note back to this step. Names, chord qualities and Roman numerals in any tuning are read through it.

      • In a tuning with 12 steps per octave (12-TET, Werckmeister III, 5-limit JI) every step stands for itself.
      • In 19- or 31-EDO the steps that stand for a note are the meantone images of the 12 notes; in 31-EDO C is step -23 and C# step -21, and steps -22 and -20 stand for none (spelled notes, where the 31-EDO D flat is step -20, are not modelled yet).
      • A quarter tone in 24-EDO stands for none.

      Parameters

      • step: number

      Returns number | null

      The 12-TET step, or null when the step stands for no 12-TET note, and always in a tuning that does not repeat at the octave.

    • Maps a 12-TET step to this JI tuning's nearest step index by cents proximity. For 12-pitch-class JI the mapping is exact (identity). For other sizes, each 12-TET semitone maps to the JI pitch class closest in cents (100¢ per semitone approximation). If the JI scale lacks a chromatic pitch class (e.g. a diatonic 7-note scale), adjacent semitones may collapse to the same step.

      Parameters

      • standardStep: number

      Returns number

    • The step of target that stands for the same 12-TET note as step does here (getStandardStep on both sides): C4 is step -9 in 12-TET and step -23 in 31-EDO.

      Parameters

      Returns number | null

      The step in target, or null when step stands for no note or target has no step for it.