Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Music

Music implements some standard music theory routines.

Hierarchy

  • Music

Index

Constructors

constructor

Accessors

Static NUM_TONES

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

    Returns number

Static accidentals

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

    Returns string[]

Static canonical_notes

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

    Returns string[]

Static diatonic_accidentals

  • NoteAccidental associated to diatonic intervals.

    Returns Record<string, NoteAccidental>

Static diatonic_intervals

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

    Returns string[]

Static intervals

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

    Returns Record<string, number>

Static noteValues

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

    Returns Record<string, Key>

Static root_indices

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

    Returns Record<string, RootValue>

Static root_values

  • Values of the root notes.

    Returns KeyValue[]

Static roots

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

    Returns string[]

Static scaleTypes

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

    Returns Record<string, number[]>

Static scales

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

    Returns Record<string, number[]>

Methods

createScaleMap

  • createScaleMap(keySignature: string): Record<string, string>
  • 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>

getCanonicalIntervalName

  • getCanonicalIntervalName(intervalValue: number): string
  • Interval name associated to a value.

    Parameters

    • intervalValue: number

    Returns string

getCanonicalNoteName

  • getCanonicalNoteName(noteValue: number): string
  • Canonical note name associated to a value.

    Parameters

    • noteValue: number

    Returns string

getIntervalBetween

  • getIntervalBetween(note1: number, note2: number, direction?: number): number
  • 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

getIntervalValue

  • getIntervalValue(intervalString: string): number
  • Interval value associated to an interval name.

    Parameters

    • intervalString: string

    Returns number

getKeyParts

  • getKeyParts(keyString: string): KeyParts
  • Return root, accidental and type associated to a key.

    Parameters

    • keyString: string

    Returns KeyParts

getNoteParts

  • Return root and accidental associated to a note.

    Parameters

    • noteString: string

    Returns NoteParts

getNoteValue

  • getNoteValue(noteString: string): number
  • Note value associated to a note name.

    Parameters

    • noteString: string

    Returns number

getRelativeNoteName

  • getRelativeNoteName(root: string, noteValue: number): string
  • Given a root and note value, produce the relative note name.

    Parameters

    • root: string
    • noteValue: number

    Returns string

getRelativeNoteValue

  • getRelativeNoteValue(noteValue: number, intervalValue: number, direction?: number): number
  • Given a note, interval, and interval direction, produce the relative note.

    Parameters

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

    Returns number

getScaleTones

  • getScaleTones(key: number, intervals: number[]): 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[]