Class ScaleTemplate

The ScaleTemplate class represents a scale in abstract, before it has been associated with any specific root. It instead defines some of the qualities of any scale to be created from it.

The expected usage of this is to use one of the pre-defined scale templates already provided to generate scale objects, for example: shimi.ScaleTemplate.major.create(shimi.pitch('D'))

However, you can also use this class to define your own custom scale types, for example:

const myScaleType = new shimi.ScaleTemplate('James Minor', [0,2,3,5,7,8,9], -3);
const eJamesMinor = myScaleType.create(shimi.pitch('E'));

Hierarchy

  • ScaleTemplate

Constructors

  • Parameters

    • name: string

      The name of the scale type, e.g. 'Major', 'Harmonic Minor', 'Phrygian', 'My Special Scale', etc.

    • shape: number[]

      The shape property defines which notes make up a scale of this type.

      For example, the major scale would have shape [0,2,4,5,7,9,11], because when you create a major scale, it will have a note 2 semi-tones above the root, a note 4 semi-tones above the root, etc.

      If 0 is omitted from the shape, then it will automatically be added, so the above example could also be expressed as [2,4,5,7,9,11].

    • relativityToMajor: number

      The relativityToMajor property is used by some of the functions for fetching related scales. For example, the natural minor scale would have relativityToMajor = -3 (or 9), because the root of the natural minor scale is expected to be 3 semi-tones below (or 9 above) the root of its relative major scale. Meanwhile Dorian would have relativityToMajor = 2.

    Returns ScaleTemplate

Accessors

  • get name(): string
  • The name of the scale type, e.g. 'Major', 'Harmonic Minor', 'Phrygian', 'My Special Scale', etc.

    Returns string

  • set name(value: string): void
  • Parameters

    • value: string

    Returns void

  • get relativityToMajor(): number
  • The relativityToMajor property is used by some of the functions for fetching related scales. For example, the natural minor scale would have relativityToMajor = -3 (or 9), because the root of the natural minor scale is expected to be 3 semi-tones below (or 9 above) the root of its relative major scale. Meanwhile Dorian would have relativityToMajor = 2.

    Returns number

  • set relativityToMajor(value: number): void
  • Parameters

    • value: number

    Returns void

  • get shape(): number[]
  • The shape property defines which notes make up a scale of this type.

    For example, the major scale would have shape [0,2,4,5,7,9,11], because when you create a major scale, it will have a note 2 semi-tones above the root, a note 4 semi-tones above the root, etc.

    Returns number[]

  • get typeName(): string
  • Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable.

    Returns string

  • get aeolian(): ScaleTemplate
  • Same as ScaleTemplate.naturalMinor, but more old school.

    Returns ScaleTemplate

  • get harmonicMinor(): ScaleTemplate
  • The pre-defined harmonic minor scale template.

    Returns ScaleTemplate

  • get ionian(): ScaleTemplate
  • Same as ScaleTemplate.major, but more old school.

    Returns ScaleTemplate

  • get majorPentatonic(): ScaleTemplate
  • The pre-defined major pentatonic scale template.

    Returns ScaleTemplate

  • get melodicMinor(): ScaleTemplate
  • The pre-defined melodic minor scale template. Note, this is the jazz version of the scale, since shimi has no concept of scales being different when ascending vs descending.

    Returns ScaleTemplate

  • get minorPentatonic(): ScaleTemplate
  • The pre-defined minor pentatonic scale template.

    Returns ScaleTemplate

  • get naturalMinor(): ScaleTemplate
  • The pre-defined natural minor scale template.

    Returns ScaleTemplate

Methods

  • Returns a new Scale object for a specific root, with properties inherited from the Template that created it.

    Returns

    Parameters

    • root: string | number

      The root of the new Scale object. Can also take pitch names, see the pitch method for more information.

    Returns Scale

Generated using TypeDoc