v5.0.0
    Preparing search index...

    Class Music

    Music implements some standard music theory routines.

    Index

    Constructors

    Accessors

    • get canonicalNotes(): string[]

      Names of canonical notes ('c', 'c#', 'd',...).

      Returns string[]

    • get diatonicIntervals(): 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 scales(): Record<string, number[]>

      Semitones shifts associated with scales.

      Returns Record<string, number[]>

    • get scaleTypes(): Record<string, number[]>

      Scales associated with m (minor) and M (major).

      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

    • 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[]

    • Parameters

      • interval: number

      Returns boolean