Key
tonal-key
is a collection of functions to query about tonal keys.
This is part of tonal music theory library.
Example
import * as Key from "tonal-key"
const Key = require("tonal-key")
Example
Key.scale("E mixolydian")
Key.relative("minor", "C major")
Key.degrees
⇒ Array
Get a list of key scale degrees
Kind: static constant of Key
Example
Key.degrees("C major") => ["I", "ii", "iii", "IV", "V", "vi", "vii"]
Key.modeNames(alias)
⇒ Array
Get a list of valid mode names. The list of modes will be always in
increasing order (ionian to locrian)
Kind: static method of Key
Returns: Array
- an array of strings
Param | Type | Description |
---|
alias | Boolean | true to get aliases names |
Example
Key.modes()
Key.modes(true)
Key.fromAlter(alt)
⇒ Key
Create a major key from alterations
Kind: static method of Key
Returns: Key
- the key object
Param | Type | Description |
---|
alt | Integer | the alteration number (positive sharps, negative flats) |
Example
Key.fromAlter(2)
Key.props(name)
⇒ Object
Return the a key properties object with the following information:
- name {String}: name
- tonic {String}: key tonic
- mode {String}: key mode
- modenum {Number}: mode number (0 major, 1 dorian, ...)
- intervals {Array}: the scale intervals
- scale {Array}: the scale notes
- acc {String}: accidentals of the key signature
- alt {Number}: alteration number (a numeric representation of accidentals)
Kind: static method of Key
Returns: Object
- the key properties object or null if not a valid key
Param | Type | Description |
---|
name | String | the key name |
Example
Key.props("C3 dorian")
Key.scale(key)
⇒ Array
Get scale of a key
Kind: static method of Key
Returns: Array
- the key scale
Param | Type |
---|
key | String | Object |
Example
Key.scale("A major")
Key.scale("Bb minor")
Key.scale("C dorian")
Key.scale("E mixolydian")
Key.alteredNotes(key)
⇒ Array
Get a list of the altered notes of a given Key. The notes will be in
the same order than in the key signature.
Kind: static method of Key
Param | Type | Description |
---|
key | String | the key name |
Example
Key.alteredNotes("Eb major")
Key.chords(name)
⇒ Array
Get key chords
Kind: static method of Key
Param | Type | Description |
---|
name | String | the key name |
Example
Key.chords("A major")
Key.secDomChords(name)
⇒ Array
Get secondary dominant key chords
Kind: static method of Key
Param | Type | Description |
---|
name | String | the key name |
Example
Key.secDomChords("A major")
Key.relative(mode, key)
Get relative of a key. Two keys are relative when the have the same
key signature (for example C major and A minor)
It can be partially applied.
Kind: static method of Key
Param | Type | Description |
---|
mode | String | the relative destination |
key | String | the key source |
Example
Key.relative("dorian", "B major")
var minor = Key.relative("minor")
minor("C major")
minor("E major")
Key.tokenize(name)
⇒ Array
Split the key name into its components (pitch class tonic and mode name)
Kind: static method of Key
Returns: Array
- an array in the form [tonic, key]
Example
Key.tokenize("C major")