Class: Key

music21.key. Key

new Key(keyName, mode)

Create a Key object. Like a KeySignature but with ideas about Tonic, Dominant, etc.

TODO: allow keyName to be a music21.pitch.Pitch
TODO: Scale mixin.

Parameters:
Name Type Argument Description
keyName string
  • a pitch name representing the key (w/ "-" for flat)
mode string <optional>
  • if not given then the CASE of the keyName will be used ("C" => "major", "c" => "minor")
Source:

Extends

Members

<readonly> alteredPitches :Array.<music21.pitch.Pitch>

An Array of Altered Pitches in KeySignature order (i.e., for flats, Bb, Eb, etc.)

Type:
Inherited From:
Source:
Example
var ks = new music21.key.KeySignature(3)
var ap = ks.alteredPitches
var apName = [];
for (var i = 0; i < ap.length; i++) {
    apName.push(ap[i].name);
}
apName
// ["F#", "C#", "G#"]

<readonly> width :number

Gives the width in pixels necessary to represent the key signature.

Type:
  • number
Inherited From:
Source:

Methods

<static> Key#getScale(scaleType) → {object}

returns a music21.scale.MajorScale or music21.scale.MinorScale
object from the pitch object.

Parameters:
Name Type Argument Default Description
scaleType string | undefined <optional>
this.mode

the type of scale, or the mode.

Source:
Returns:

A music21.scale.Scale subclass.

Type
object
Music21j, Copyright © 2013-2018 Michael Scott Cuthbert and cuthbertLab.
Documentation generated by JSDoc 3.5.5 on Wed Jul 4th 2018 using the DocStrap template.