Class Music

Music implements some standard music theory routines.

Hierarchy

  • Music

Constructors

Accessors

  • get NUM_TONES(): number
  • Number of an canonical notes (12).

    Returns number

  • get accidentals(): string[]
  • Accidentals abbreviations.

    Returns string[]

  • get canonical_notes(): string[]
  • Names of canonical notes ('c', 'c#', 'd',...).

    Returns string[]

  • get diatonic_accidentals(): Record<string, NoteAccidental>
  • NoteAccidental associated to diatonic intervals.

    Returns Record<string, NoteAccidental>

  • get diatonic_intervals(): string[]
  • Names of diatonic intervals ('unison', 'm2', 'M2',...).

    Returns string[]

  • get intervals(): Record<string, number>
  • Semitones shift associated to intervals .

    Returns Record<string, number>

  • get noteValues(): Record<string, Key>
  • Note values.

    Returns Record<string, Key>

  • get root_indices(): Record<string, RootValue>
  • Indices of the root notes.

    Returns Record<string, RootValue>

  • get roots(): string[]
  • Names of root notes ('c', 'd',...)

    Returns string[]

  • get scaleTypes(): Record<string, number[]>
  • Scales associated with m (minor) and M (major).

    Returns Record<string, number[]>

  • get scales(): Record<string, number[]>
  • Semitones shifts associated with scales.

    Returns Record<string, number[]>

Methods

  • Create a scale map that represents the pitch state for a keySignature. For example, passing a G to keySignature would return a scale map with every note naturalized except for F which has an F# state.

    Parameters

    • keySignature: string

    Returns Record<string, string>

  • Interval name associated to a value.

    Parameters

    • intervalValue: number

    Returns string

  • Canonical note name associated to a value.

    Parameters

    • noteValue: number

    Returns string

  • Return the interval of a note, given a diatonic scale. e.g., given the scale C, and the note E, returns M3.

    Parameters

    • note1: number
    • note2: number
    • direction: number = 1

    Returns number

  • Interval value associated to an interval name.

    Parameters

    • intervalString: string

    Returns number

  • Return root, accidental and type associated to a key.

    Parameters

    • keyString: string

    Returns KeyParts

  • Return root and accidental associated to a note.

    Parameters

    • noteString: string

    Returns NoteParts

  • Note value associated to a note name.

    Parameters

    • noteString: string

    Returns number

  • Given a root and note value, produce the relative note name.

    Parameters

    • root: string
    • noteValue: number

    Returns string

  • Given a note, interval, and interval direction, produce the relative note.

    Parameters

    • noteValue: number
    • intervalValue: number
    • direction: number = 1

    Returns number

  • Return scale tones, given intervals. Each successive interval is relative to the previous one, e.g., Major Scale:

    TTSTTTS = [2,2,1,2,2,2,1]

    When used with key = 0, returns C scale (which is isomorphic to interval list).

    Parameters

    • key: number
    • intervals: number[]

    Returns number[]