New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tonal-key

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tonal-key - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

44

build/es5.js

@@ -16,4 +16,15 @@ 'use strict';

var NOTES = "C D E F G A B".split(" ");
var CHORDS = "Maj7 m7 m7 Maj7 7 m7 m7b5".split(" ");
var TRIADS = "M m m M 7 m mb5".split(" ");
/**
* A lead-sheet symbol begins with a capital letter (and, if necessary,
* an accidental) denoting the root of the chord.
* That letter is followed by information about a chord’s quality:
*
* -major triad: no quality symbol is added
* -minor triad: lower-case “m”
* -diminished triad: lower-case “dim” or a degree sign “°”
* -augmented triad: lower-case “aug” or a plus sign “+”
*/
var TRIADS = ["", "m", "m", "", "", "m", "dim"];
var SEVENTHS = "Maj7 m7 m7 Maj7 7 m7 m7b5".split(" ");
var DEGREES = "I II III IV V VI VII".split(" ");

@@ -136,3 +147,3 @@ var FIFTHS = [0, 2, 4, -1, 1, 3, 5, 0, 3];

if (p.name === null) { return []; }
var chords = tonalArray.rotate(p.modenum, CHORDS);
var chords = tonalArray.rotate(p.modenum, SEVENTHS);
return chords.map(function (chord, i) {

@@ -165,8 +176,24 @@ var deg = DEGREES[i];

var getChords = function (chords) { return function (keyName) {
/**
* Get a lead-sheet symbols for a given key name
*
* This function is currified (so can be partially applied)
*
* @param {Array<String>} symbols - an array of symbols in major scale order
* @param {String} keyName - the name of the key you want the symbols for
* @return {function}
* @see Key.chords
* @see Key.triads
*
* @example
* const chords = Key.leadsheetSymbols(["M", "m", "m", "M", "7", "m", "dim"])
* chords("D dorian") //=> ["Dm", "Em", "FM", "G7", "Am", "Bdim", "CM"]
*/
function leadsheetSymbols(symbols, keyName) {
if (arguments.length === 1) { return function (name) { return leadsheetSymbols(symbols, name); }; }
var p = props(keyName);
if (!p.name) { return []; }
var names = tonalArray.rotate(p.modenum, chords);
var names = tonalArray.rotate(p.modenum, symbols);
return p.scale.map(function (tonic, i) { return tonic + names[i]; });
}; };
}

@@ -183,3 +210,3 @@ /**

*/
var chords = getChords(CHORDS);
var chords = leadsheetSymbols(SEVENTHS);

@@ -196,3 +223,3 @@ /**

*/
var triads = getChords(TRIADS);
var triads = leadsheetSymbols(TRIADS);

@@ -266,2 +293,3 @@ /**

exports.alteredNotes = alteredNotes;
exports.leadsheetSymbols = leadsheetSymbols;
exports.chords = chords;

@@ -268,0 +296,0 @@ exports.triads = triads;

@@ -32,4 +32,15 @@

var NOTES = "C D E F G A B".split(" ");
var CHORDS = "Maj7 m7 m7 Maj7 7 m7 m7b5".split(" ");
var TRIADS = "M m m M 7 m mb5".split(" ");
/**
* A lead-sheet symbol begins with a capital letter (and, if necessary,
* an accidental) denoting the root of the chord.
* That letter is followed by information about a chord’s quality:
*
* -major triad: no quality symbol is added
* -minor triad: lower-case “m”
* -diminished triad: lower-case “dim” or a degree sign “°”
* -augmented triad: lower-case “aug” or a plus sign “+”
*/
var TRIADS = ["", "m", "m", "", "", "m", "dim"];
var SEVENTHS = "Maj7 m7 m7 Maj7 7 m7 m7b5".split(" ");
var DEGREES = "I II III IV V VI VII".split(" ");

@@ -152,3 +163,3 @@ var FIFTHS = [0, 2, 4, -1, 1, 3, 5, 0, 3];

if (p.name === null) { return []; }
var chords = rotate(p.modenum, CHORDS);
var chords = rotate(p.modenum, SEVENTHS);
return chords.map(function (chord, i) {

@@ -181,8 +192,24 @@ var deg = DEGREES[i];

var getChords = function (chords) { return function (keyName) {
/**
* Get a lead-sheet symbols for a given key name
*
* This function is currified (so can be partially applied)
*
* @param {Array<String>} symbols - an array of symbols in major scale order
* @param {String} keyName - the name of the key you want the symbols for
* @return {function}
* @see Key.chords
* @see Key.triads
*
* @example
* const chords = Key.leadsheetSymbols(["M", "m", "m", "M", "7", "m", "dim"])
* chords("D dorian") //=> ["Dm", "Em", "FM", "G7", "Am", "Bdim", "CM"]
*/
export function leadsheetSymbols(symbols, keyName) {
if (arguments.length === 1) { return function (name) { return leadsheetSymbols(symbols, name); }; }
var p = props(keyName);
if (!p.name) { return []; }
var names = rotate(p.modenum, chords);
var names = rotate(p.modenum, symbols);
return p.scale.map(function (tonic, i) { return tonic + names[i]; });
}; };
}

@@ -199,3 +226,3 @@ /**

*/
export var chords = getChords(CHORDS);
export var chords = leadsheetSymbols(SEVENTHS);

@@ -212,3 +239,3 @@ /**

*/
export var triads = getChords(TRIADS);
export var triads = leadsheetSymbols(TRIADS);

@@ -215,0 +242,0 @@ /**

2

coverage/coverage-final.json

@@ -1,2 +0,2 @@

{"/Users/dani/Code/Music/tonal/extensions/key/index.js": {"path":"/Users/dani/Code/Music/tonal/extensions/key/index.js","statementMap":{"0":{"start":{"line":25,"column":14},"end":{"line":27,"column":1}},"1":{"start":{"line":28,"column":13},"end":{"line":28,"column":40}},"2":{"start":{"line":29,"column":14},"end":{"line":29,"column":40}},"3":{"start":{"line":42,"column":15},"end":{"line":42,"column":49}},"4":{"start":{"line":43,"column":17},"end":{"line":43,"column":55}},"5":{"start":{"line":44,"column":16},"end":{"line":44,"column":49}},"6":{"start":{"line":45,"column":15},"end":{"line":45,"column":43}},"7":{"start":{"line":47,"column":16},"end":{"line":47,"column":49}},"8":{"start":{"line":47,"column":24},"end":{"line":47,"column":49}},"9":{"start":{"line":62,"column":25},"end":{"line":63,"column":54}},"10":{"start":{"line":63,"column":2},"end":{"line":63,"column":54}},"11":{"start":{"line":74,"column":25},"end":{"line":74,"column":57}},"12":{"start":{"line":74,"column":30},"end":{"line":74,"column":57}},"13":{"start":{"line":76,"column":21},"end":{"line":81,"column":1}},"14":{"start":{"line":77,"column":2},"end":{"line":77,"column":22}},"15":{"start":{"line":78,"column":17},"end":{"line":78,"column":19}},"16":{"start":{"line":79,"column":2},"end":{"line":79,"column":62}},"17":{"start":{"line":79,"column":36},"end":{"line":79,"column":62}},"18":{"start":{"line":80,"column":2},"end":{"line":80,"column":16}},"19":{"start":{"line":83,"column":15},"end":{"line":92,"column":2}},"20":{"start":{"line":94,"column":19},"end":{"line":106,"column":1}},"21":{"start":{"line":95,"column":12},"end":{"line":95,"column":26}},"22":{"start":{"line":96,"column":2},"end":{"line":96,"column":35}},"23":{"start":{"line":96,"column":21},"end":{"line":96,"column":35}},"24":{"start":{"line":97,"column":12},"end":{"line":97,"column":39}},"25":{"start":{"line":98,"column":2},"end":{"line":98,"column":34}},"26":{"start":{"line":99,"column":2},"end":{"line":99,"column":30}},"27":{"start":{"line":100,"column":13},"end":{"line":100,"column":37}},"28":{"start":{"line":101,"column":2},"end":{"line":101,"column":63}},"29":{"start":{"line":102,"column":2},"end":{"line":102,"column":26}},"30":{"start":{"line":103,"column":2},"end":{"line":103,"column":40}},"31":{"start":{"line":104,"column":2},"end":{"line":104,"column":48}},"32":{"start":{"line":105,"column":2},"end":{"line":105,"column":26}},"33":{"start":{"line":108,"column":13},"end":{"line":108,"column":76}},"34":{"start":{"line":108,"column":33},"end":{"line":108,"column":76}},"35":{"start":{"line":108,"column":40},"end":{"line":108,"column":76}},"36":{"start":{"line":129,"column":21},"end":{"line":129,"column":37}},"37":{"start":{"line":144,"column":21},"end":{"line":144,"column":44}},"38":{"start":{"line":144,"column":28},"end":{"line":144,"column":44}},"39":{"start":{"line":153,"column":23},"end":{"line":161,"column":1}},"40":{"start":{"line":154,"column":12},"end":{"line":154,"column":22}},"41":{"start":{"line":155,"column":2},"end":{"line":155,"column":33}},"42":{"start":{"line":155,"column":23},"end":{"line":155,"column":33}},"43":{"start":{"line":156,"column":17},"end":{"line":156,"column":44}},"44":{"start":{"line":157,"column":2},"end":{"line":160,"column":5}},"45":{"start":{"line":158,"column":16},"end":{"line":158,"column":26}},"46":{"start":{"line":159,"column":4},"end":{"line":159,"column":54}},"47":{"start":{"line":174,"column":28},"end":{"line":182,"column":1}},"48":{"start":{"line":175,"column":14},"end":{"line":175,"column":29}},"49":{"start":{"line":176,"column":2},"end":{"line":176,"column":32}},"50":{"start":{"line":176,"column":20},"end":{"line":176,"column":32}},"51":{"start":{"line":177,"column":2},"end":{"line":181,"column":42}},"52":{"start":{"line":199,"column":2},"end":{"line":199,"column":77}},"53":{"start":{"line":199,"column":30},"end":{"line":199,"column":77}},"54":{"start":{"line":199,"column":45},"end":{"line":199,"column":76}},"55":{"start":{"line":200,"column":12},"end":{"line":200,"column":26}},"56":{"start":{"line":201,"column":2},"end":{"line":201,"column":25}},"57":{"start":{"line":201,"column":15},"end":{"line":201,"column":25}},"58":{"start":{"line":202,"column":16},"end":{"line":202,"column":42}},"59":{"start":{"line":203,"column":2},"end":{"line":203,"column":53}},"60":{"start":{"line":203,"column":35},"end":{"line":203,"column":51}},"61":{"start":{"line":216,"column":22},"end":{"line":216,"column":48}},"62":{"start":{"line":228,"column":22},"end":{"line":228,"column":46}},"63":{"start":{"line":241,"column":28},"end":{"line":245,"column":1}},"64":{"start":{"line":242,"column":12},"end":{"line":242,"column":23}},"65":{"start":{"line":243,"column":2},"end":{"line":243,"column":25}},"66":{"start":{"line":243,"column":15},"end":{"line":243,"column":25}},"67":{"start":{"line":244,"column":2},"end":{"line":244,"column":52}},"68":{"start":{"line":244,"column":26},"end":{"line":244,"column":50}},"69":{"start":{"line":264,"column":24},"end":{"line":271,"column":1}},"70":{"start":{"line":265,"column":2},"end":{"line":265,"column":64}},"71":{"start":{"line":265,"column":30},"end":{"line":265,"column":64}},"72":{"start":{"line":265,"column":44},"end":{"line":265,"column":63}},"73":{"start":{"line":266,"column":14},"end":{"line":266,"column":41}},"74":{"start":{"line":267,"column":2},"end":{"line":267,"column":37}},"75":{"start":{"line":267,"column":25},"end":{"line":267,"column":37}},"76":{"start":{"line":268,"column":12},"end":{"line":268,"column":22}},"77":{"start":{"line":269,"column":2},"end":{"line":269,"column":35}},"78":{"start":{"line":269,"column":23},"end":{"line":269,"column":35}},"79":{"start":{"line":270,"column":2},"end":{"line":270,"column":73}},"80":{"start":{"line":283,"column":24},"end":{"line":288,"column":1}},"81":{"start":{"line":284,"column":12},"end":{"line":284,"column":23}},"82":{"start":{"line":285,"column":2},"end":{"line":285,"column":28}},"83":{"start":{"line":286,"column":2},"end":{"line":286,"column":69}},"84":{"start":{"line":286,"column":49},"end":{"line":286,"column":69}},"85":{"start":{"line":287,"column":2},"end":{"line":287,"column":29}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":47,"column":16},"end":{"line":47,"column":17}},"loc":{"start":{"line":47,"column":24},"end":{"line":47,"column":49}},"line":47},"1":{"name":"(anonymous_1)","decl":{"start":{"line":62,"column":25},"end":{"line":62,"column":26}},"loc":{"start":{"line":63,"column":2},"end":{"line":63,"column":54}},"line":63},"2":{"name":"(anonymous_2)","decl":{"start":{"line":74,"column":25},"end":{"line":74,"column":26}},"loc":{"start":{"line":74,"column":30},"end":{"line":74,"column":57}},"line":74},"3":{"name":"(anonymous_3)","decl":{"start":{"line":76,"column":21},"end":{"line":76,"column":22}},"loc":{"start":{"line":76,"column":34},"end":{"line":81,"column":1}},"line":76},"4":{"name":"(anonymous_4)","decl":{"start":{"line":94,"column":19},"end":{"line":94,"column":20}},"loc":{"start":{"line":94,"column":27},"end":{"line":106,"column":1}},"line":94},"5":{"name":"(anonymous_5)","decl":{"start":{"line":108,"column":13},"end":{"line":108,"column":14}},"loc":{"start":{"line":108,"column":33},"end":{"line":108,"column":76}},"line":108},"6":{"name":"(anonymous_6)","decl":{"start":{"line":108,"column":33},"end":{"line":108,"column":34}},"loc":{"start":{"line":108,"column":40},"end":{"line":108,"column":76}},"line":108},"7":{"name":"(anonymous_7)","decl":{"start":{"line":144,"column":21},"end":{"line":144,"column":22}},"loc":{"start":{"line":144,"column":28},"end":{"line":144,"column":44}},"line":144},"8":{"name":"(anonymous_8)","decl":{"start":{"line":153,"column":23},"end":{"line":153,"column":24}},"loc":{"start":{"line":153,"column":30},"end":{"line":161,"column":1}},"line":153},"9":{"name":"(anonymous_9)","decl":{"start":{"line":157,"column":20},"end":{"line":157,"column":21}},"loc":{"start":{"line":157,"column":34},"end":{"line":160,"column":3}},"line":157},"10":{"name":"(anonymous_10)","decl":{"start":{"line":174,"column":28},"end":{"line":174,"column":29}},"loc":{"start":{"line":174,"column":36},"end":{"line":182,"column":1}},"line":174},"11":{"name":"leadsheetSymbols","decl":{"start":{"line":198,"column":16},"end":{"line":198,"column":32}},"loc":{"start":{"line":198,"column":51},"end":{"line":204,"column":1}},"line":198},"12":{"name":"(anonymous_12)","decl":{"start":{"line":199,"column":37},"end":{"line":199,"column":38}},"loc":{"start":{"line":199,"column":45},"end":{"line":199,"column":76}},"line":199},"13":{"name":"(anonymous_13)","decl":{"start":{"line":203,"column":21},"end":{"line":203,"column":22}},"loc":{"start":{"line":203,"column":35},"end":{"line":203,"column":51}},"line":203},"14":{"name":"(anonymous_14)","decl":{"start":{"line":241,"column":28},"end":{"line":241,"column":29}},"loc":{"start":{"line":241,"column":36},"end":{"line":245,"column":1}},"line":241},"15":{"name":"(anonymous_15)","decl":{"start":{"line":244,"column":21},"end":{"line":244,"column":22}},"loc":{"start":{"line":244,"column":26},"end":{"line":244,"column":50}},"line":244},"16":{"name":"(anonymous_16)","decl":{"start":{"line":264,"column":24},"end":{"line":264,"column":25}},"loc":{"start":{"line":264,"column":39},"end":{"line":271,"column":1}},"line":264},"17":{"name":"(anonymous_17)","decl":{"start":{"line":265,"column":37},"end":{"line":265,"column":38}},"loc":{"start":{"line":265,"column":44},"end":{"line":265,"column":63}},"line":265},"18":{"name":"(anonymous_18)","decl":{"start":{"line":283,"column":24},"end":{"line":283,"column":25}},"loc":{"start":{"line":283,"column":32},"end":{"line":288,"column":1}},"line":283}},"branchMap":{"0":{"loc":{"start":{"line":63,"column":2},"end":{"line":63,"column":54}},"type":"cond-expr","locations":[{"start":{"line":63,"column":21},"end":{"line":63,"column":34}},{"start":{"line":63,"column":37},"end":{"line":63,"column":54}}],"line":63},"1":{"loc":{"start":{"line":76,"column":22},"end":{"line":76,"column":29}},"type":"default-arg","locations":[{"start":{"line":76,"column":28},"end":{"line":76,"column":29}}],"line":76},"2":{"loc":{"start":{"line":96,"column":2},"end":{"line":96,"column":35}},"type":"if","locations":[{"start":{"line":96,"column":2},"end":{"line":96,"column":35}},{"start":{"line":96,"column":2},"end":{"line":96,"column":35}}],"line":96},"3":{"loc":{"start":{"line":108,"column":18},"end":{"line":108,"column":28}},"type":"default-arg","locations":[{"start":{"line":108,"column":26},"end":{"line":108,"column":28}}],"line":108},"4":{"loc":{"start":{"line":108,"column":40},"end":{"line":108,"column":76}},"type":"binary-expr","locations":[{"start":{"line":108,"column":40},"end":{"line":108,"column":50}},{"start":{"line":108,"column":55},"end":{"line":108,"column":75}}],"line":108},"5":{"loc":{"start":{"line":155,"column":2},"end":{"line":155,"column":33}},"type":"if","locations":[{"start":{"line":155,"column":2},"end":{"line":155,"column":33}},{"start":{"line":155,"column":2},"end":{"line":155,"column":33}}],"line":155},"6":{"loc":{"start":{"line":159,"column":11},"end":{"line":159,"column":53}},"type":"cond-expr","locations":[{"start":{"line":159,"column":30},"end":{"line":159,"column":47}},{"start":{"line":159,"column":50},"end":{"line":159,"column":53}}],"line":159},"7":{"loc":{"start":{"line":176,"column":2},"end":{"line":176,"column":32}},"type":"if","locations":[{"start":{"line":176,"column":2},"end":{"line":176,"column":32}},{"start":{"line":176,"column":2},"end":{"line":176,"column":32}}],"line":176},"8":{"loc":{"start":{"line":177,"column":9},"end":{"line":181,"column":41}},"type":"cond-expr","locations":[{"start":{"line":178,"column":6},"end":{"line":178,"column":8}},{"start":{"line":179,"column":6},"end":{"line":181,"column":41}}],"line":177},"9":{"loc":{"start":{"line":179,"column":6},"end":{"line":181,"column":41}},"type":"cond-expr","locations":[{"start":{"line":180,"column":8},"end":{"line":180,"column":40}},{"start":{"line":181,"column":8},"end":{"line":181,"column":41}}],"line":179},"10":{"loc":{"start":{"line":199,"column":2},"end":{"line":199,"column":77}},"type":"if","locations":[{"start":{"line":199,"column":2},"end":{"line":199,"column":77}},{"start":{"line":199,"column":2},"end":{"line":199,"column":77}}],"line":199},"11":{"loc":{"start":{"line":201,"column":2},"end":{"line":201,"column":25}},"type":"if","locations":[{"start":{"line":201,"column":2},"end":{"line":201,"column":25}},{"start":{"line":201,"column":2},"end":{"line":201,"column":25}}],"line":201},"12":{"loc":{"start":{"line":243,"column":2},"end":{"line":243,"column":25}},"type":"if","locations":[{"start":{"line":243,"column":2},"end":{"line":243,"column":25}},{"start":{"line":243,"column":2},"end":{"line":243,"column":25}}],"line":243},"13":{"loc":{"start":{"line":265,"column":2},"end":{"line":265,"column":64}},"type":"if","locations":[{"start":{"line":265,"column":2},"end":{"line":265,"column":64}},{"start":{"line":265,"column":2},"end":{"line":265,"column":64}}],"line":265},"14":{"loc":{"start":{"line":267,"column":2},"end":{"line":267,"column":37}},"type":"if","locations":[{"start":{"line":267,"column":2},"end":{"line":267,"column":37}},{"start":{"line":267,"column":2},"end":{"line":267,"column":37}}],"line":267},"15":{"loc":{"start":{"line":269,"column":2},"end":{"line":269,"column":35}},"type":"if","locations":[{"start":{"line":269,"column":2},"end":{"line":269,"column":35}},{"start":{"line":269,"column":2},"end":{"line":269,"column":35}}],"line":269},"16":{"loc":{"start":{"line":286,"column":2},"end":{"line":286,"column":69}},"type":"if","locations":[{"start":{"line":286,"column":2},"end":{"line":286,"column":69}},{"start":{"line":286,"column":2},"end":{"line":286,"column":69}}],"line":286},"17":{"loc":{"start":{"line":286,"column":6},"end":{"line":286,"column":47}},"type":"binary-expr","locations":[{"start":{"line":286,"column":6},"end":{"line":286,"column":17}},{"start":{"line":286,"column":21},"end":{"line":286,"column":47}}],"line":286}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":22,"9":1,"10":3,"11":1,"12":10,"13":1,"14":2,"15":2,"16":2,"17":10,"18":2,"19":1,"20":1,"21":20,"22":20,"23":1,"24":19,"25":19,"26":19,"27":19,"28":19,"29":19,"30":19,"31":19,"32":19,"33":1,"34":1,"35":30,"36":1,"37":1,"38":1,"39":1,"40":2,"41":2,"42":0,"43":2,"44":2,"45":14,"46":14,"47":1,"48":2,"49":2,"50":0,"51":2,"52":8,"53":2,"54":4,"55":6,"56":6,"57":0,"58":6,"59":6,"60":42,"61":1,"62":1,"63":1,"64":1,"65":1,"66":0,"67":1,"68":7,"69":1,"70":3,"71":0,"72":0,"73":3,"74":3,"75":0,"76":3,"77":3,"78":0,"79":3,"80":1,"81":25,"82":25,"83":25,"84":3,"85":22},"f":{"0":22,"1":3,"2":10,"3":2,"4":20,"5":1,"6":30,"7":1,"8":2,"9":14,"10":2,"11":8,"12":4,"13":42,"14":1,"15":7,"16":3,"17":0,"18":25},"b":{"0":[1,2],"1":[1],"2":[1,19],"3":[1],"4":[30,20],"5":[0,2],"6":[8,6],"7":[0,2],"8":[0,2],"9":[1,1],"10":[2,6],"11":[0,6],"12":[0,1],"13":[0,3],"14":[0,3],"15":[0,3],"16":[3,22],"17":[25,24]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"1a3a9fb7980273cf105558f1cb8d54be32dcf66c"}
{"/Users/dani/Code/Music/tonal/extensions/key/index.js": {"path":"/Users/dani/Code/Music/tonal/extensions/key/index.js","statementMap":{"0":{"start":{"line":25,"column":14},"end":{"line":27,"column":1}},"1":{"start":{"line":28,"column":13},"end":{"line":28,"column":40}},"2":{"start":{"line":29,"column":14},"end":{"line":29,"column":40}},"3":{"start":{"line":42,"column":15},"end":{"line":42,"column":49}},"4":{"start":{"line":43,"column":17},"end":{"line":43,"column":55}},"5":{"start":{"line":44,"column":16},"end":{"line":44,"column":49}},"6":{"start":{"line":45,"column":15},"end":{"line":45,"column":43}},"7":{"start":{"line":47,"column":16},"end":{"line":47,"column":49}},"8":{"start":{"line":47,"column":24},"end":{"line":47,"column":49}},"9":{"start":{"line":62,"column":25},"end":{"line":63,"column":54}},"10":{"start":{"line":63,"column":2},"end":{"line":63,"column":54}},"11":{"start":{"line":74,"column":25},"end":{"line":74,"column":57}},"12":{"start":{"line":74,"column":30},"end":{"line":74,"column":57}},"13":{"start":{"line":76,"column":21},"end":{"line":81,"column":1}},"14":{"start":{"line":77,"column":2},"end":{"line":77,"column":22}},"15":{"start":{"line":78,"column":17},"end":{"line":78,"column":19}},"16":{"start":{"line":79,"column":2},"end":{"line":79,"column":62}},"17":{"start":{"line":79,"column":36},"end":{"line":79,"column":62}},"18":{"start":{"line":80,"column":2},"end":{"line":80,"column":16}},"19":{"start":{"line":83,"column":15},"end":{"line":92,"column":2}},"20":{"start":{"line":94,"column":19},"end":{"line":106,"column":1}},"21":{"start":{"line":95,"column":12},"end":{"line":95,"column":26}},"22":{"start":{"line":96,"column":2},"end":{"line":96,"column":35}},"23":{"start":{"line":96,"column":21},"end":{"line":96,"column":35}},"24":{"start":{"line":97,"column":12},"end":{"line":97,"column":39}},"25":{"start":{"line":98,"column":2},"end":{"line":98,"column":34}},"26":{"start":{"line":99,"column":2},"end":{"line":99,"column":30}},"27":{"start":{"line":100,"column":13},"end":{"line":100,"column":37}},"28":{"start":{"line":101,"column":2},"end":{"line":101,"column":63}},"29":{"start":{"line":102,"column":2},"end":{"line":102,"column":26}},"30":{"start":{"line":103,"column":2},"end":{"line":103,"column":40}},"31":{"start":{"line":104,"column":2},"end":{"line":104,"column":48}},"32":{"start":{"line":105,"column":2},"end":{"line":105,"column":26}},"33":{"start":{"line":108,"column":13},"end":{"line":108,"column":76}},"34":{"start":{"line":108,"column":33},"end":{"line":108,"column":76}},"35":{"start":{"line":108,"column":40},"end":{"line":108,"column":76}},"36":{"start":{"line":129,"column":21},"end":{"line":129,"column":37}},"37":{"start":{"line":144,"column":21},"end":{"line":144,"column":44}},"38":{"start":{"line":144,"column":28},"end":{"line":144,"column":44}},"39":{"start":{"line":153,"column":23},"end":{"line":161,"column":1}},"40":{"start":{"line":154,"column":12},"end":{"line":154,"column":22}},"41":{"start":{"line":155,"column":2},"end":{"line":155,"column":33}},"42":{"start":{"line":155,"column":23},"end":{"line":155,"column":33}},"43":{"start":{"line":156,"column":17},"end":{"line":156,"column":44}},"44":{"start":{"line":157,"column":2},"end":{"line":160,"column":5}},"45":{"start":{"line":158,"column":16},"end":{"line":158,"column":26}},"46":{"start":{"line":159,"column":4},"end":{"line":159,"column":54}},"47":{"start":{"line":174,"column":28},"end":{"line":182,"column":1}},"48":{"start":{"line":175,"column":14},"end":{"line":175,"column":29}},"49":{"start":{"line":176,"column":2},"end":{"line":176,"column":32}},"50":{"start":{"line":176,"column":20},"end":{"line":176,"column":32}},"51":{"start":{"line":177,"column":2},"end":{"line":181,"column":42}},"52":{"start":{"line":200,"column":2},"end":{"line":200,"column":77}},"53":{"start":{"line":200,"column":30},"end":{"line":200,"column":77}},"54":{"start":{"line":200,"column":45},"end":{"line":200,"column":76}},"55":{"start":{"line":201,"column":12},"end":{"line":201,"column":26}},"56":{"start":{"line":202,"column":2},"end":{"line":202,"column":25}},"57":{"start":{"line":202,"column":15},"end":{"line":202,"column":25}},"58":{"start":{"line":203,"column":16},"end":{"line":203,"column":42}},"59":{"start":{"line":204,"column":2},"end":{"line":204,"column":53}},"60":{"start":{"line":204,"column":35},"end":{"line":204,"column":51}},"61":{"start":{"line":217,"column":22},"end":{"line":217,"column":48}},"62":{"start":{"line":229,"column":22},"end":{"line":229,"column":46}},"63":{"start":{"line":242,"column":28},"end":{"line":246,"column":1}},"64":{"start":{"line":243,"column":12},"end":{"line":243,"column":23}},"65":{"start":{"line":244,"column":2},"end":{"line":244,"column":25}},"66":{"start":{"line":244,"column":15},"end":{"line":244,"column":25}},"67":{"start":{"line":245,"column":2},"end":{"line":245,"column":52}},"68":{"start":{"line":245,"column":26},"end":{"line":245,"column":50}},"69":{"start":{"line":265,"column":24},"end":{"line":272,"column":1}},"70":{"start":{"line":266,"column":2},"end":{"line":266,"column":64}},"71":{"start":{"line":266,"column":30},"end":{"line":266,"column":64}},"72":{"start":{"line":266,"column":44},"end":{"line":266,"column":63}},"73":{"start":{"line":267,"column":14},"end":{"line":267,"column":41}},"74":{"start":{"line":268,"column":2},"end":{"line":268,"column":37}},"75":{"start":{"line":268,"column":25},"end":{"line":268,"column":37}},"76":{"start":{"line":269,"column":12},"end":{"line":269,"column":22}},"77":{"start":{"line":270,"column":2},"end":{"line":270,"column":35}},"78":{"start":{"line":270,"column":23},"end":{"line":270,"column":35}},"79":{"start":{"line":271,"column":2},"end":{"line":271,"column":73}},"80":{"start":{"line":284,"column":24},"end":{"line":289,"column":1}},"81":{"start":{"line":285,"column":12},"end":{"line":285,"column":23}},"82":{"start":{"line":286,"column":2},"end":{"line":286,"column":28}},"83":{"start":{"line":287,"column":2},"end":{"line":287,"column":69}},"84":{"start":{"line":287,"column":49},"end":{"line":287,"column":69}},"85":{"start":{"line":288,"column":2},"end":{"line":288,"column":29}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":47,"column":16},"end":{"line":47,"column":17}},"loc":{"start":{"line":47,"column":24},"end":{"line":47,"column":49}},"line":47},"1":{"name":"(anonymous_1)","decl":{"start":{"line":62,"column":25},"end":{"line":62,"column":26}},"loc":{"start":{"line":63,"column":2},"end":{"line":63,"column":54}},"line":63},"2":{"name":"(anonymous_2)","decl":{"start":{"line":74,"column":25},"end":{"line":74,"column":26}},"loc":{"start":{"line":74,"column":30},"end":{"line":74,"column":57}},"line":74},"3":{"name":"(anonymous_3)","decl":{"start":{"line":76,"column":21},"end":{"line":76,"column":22}},"loc":{"start":{"line":76,"column":34},"end":{"line":81,"column":1}},"line":76},"4":{"name":"(anonymous_4)","decl":{"start":{"line":94,"column":19},"end":{"line":94,"column":20}},"loc":{"start":{"line":94,"column":27},"end":{"line":106,"column":1}},"line":94},"5":{"name":"(anonymous_5)","decl":{"start":{"line":108,"column":13},"end":{"line":108,"column":14}},"loc":{"start":{"line":108,"column":33},"end":{"line":108,"column":76}},"line":108},"6":{"name":"(anonymous_6)","decl":{"start":{"line":108,"column":33},"end":{"line":108,"column":34}},"loc":{"start":{"line":108,"column":40},"end":{"line":108,"column":76}},"line":108},"7":{"name":"(anonymous_7)","decl":{"start":{"line":144,"column":21},"end":{"line":144,"column":22}},"loc":{"start":{"line":144,"column":28},"end":{"line":144,"column":44}},"line":144},"8":{"name":"(anonymous_8)","decl":{"start":{"line":153,"column":23},"end":{"line":153,"column":24}},"loc":{"start":{"line":153,"column":30},"end":{"line":161,"column":1}},"line":153},"9":{"name":"(anonymous_9)","decl":{"start":{"line":157,"column":20},"end":{"line":157,"column":21}},"loc":{"start":{"line":157,"column":34},"end":{"line":160,"column":3}},"line":157},"10":{"name":"(anonymous_10)","decl":{"start":{"line":174,"column":28},"end":{"line":174,"column":29}},"loc":{"start":{"line":174,"column":36},"end":{"line":182,"column":1}},"line":174},"11":{"name":"leadsheetSymbols","decl":{"start":{"line":199,"column":16},"end":{"line":199,"column":32}},"loc":{"start":{"line":199,"column":51},"end":{"line":205,"column":1}},"line":199},"12":{"name":"(anonymous_12)","decl":{"start":{"line":200,"column":37},"end":{"line":200,"column":38}},"loc":{"start":{"line":200,"column":45},"end":{"line":200,"column":76}},"line":200},"13":{"name":"(anonymous_13)","decl":{"start":{"line":204,"column":21},"end":{"line":204,"column":22}},"loc":{"start":{"line":204,"column":35},"end":{"line":204,"column":51}},"line":204},"14":{"name":"(anonymous_14)","decl":{"start":{"line":242,"column":28},"end":{"line":242,"column":29}},"loc":{"start":{"line":242,"column":36},"end":{"line":246,"column":1}},"line":242},"15":{"name":"(anonymous_15)","decl":{"start":{"line":245,"column":21},"end":{"line":245,"column":22}},"loc":{"start":{"line":245,"column":26},"end":{"line":245,"column":50}},"line":245},"16":{"name":"(anonymous_16)","decl":{"start":{"line":265,"column":24},"end":{"line":265,"column":25}},"loc":{"start":{"line":265,"column":39},"end":{"line":272,"column":1}},"line":265},"17":{"name":"(anonymous_17)","decl":{"start":{"line":266,"column":37},"end":{"line":266,"column":38}},"loc":{"start":{"line":266,"column":44},"end":{"line":266,"column":63}},"line":266},"18":{"name":"(anonymous_18)","decl":{"start":{"line":284,"column":24},"end":{"line":284,"column":25}},"loc":{"start":{"line":284,"column":32},"end":{"line":289,"column":1}},"line":284}},"branchMap":{"0":{"loc":{"start":{"line":63,"column":2},"end":{"line":63,"column":54}},"type":"cond-expr","locations":[{"start":{"line":63,"column":21},"end":{"line":63,"column":34}},{"start":{"line":63,"column":37},"end":{"line":63,"column":54}}],"line":63},"1":{"loc":{"start":{"line":76,"column":22},"end":{"line":76,"column":29}},"type":"default-arg","locations":[{"start":{"line":76,"column":28},"end":{"line":76,"column":29}}],"line":76},"2":{"loc":{"start":{"line":96,"column":2},"end":{"line":96,"column":35}},"type":"if","locations":[{"start":{"line":96,"column":2},"end":{"line":96,"column":35}},{"start":{"line":96,"column":2},"end":{"line":96,"column":35}}],"line":96},"3":{"loc":{"start":{"line":108,"column":18},"end":{"line":108,"column":28}},"type":"default-arg","locations":[{"start":{"line":108,"column":26},"end":{"line":108,"column":28}}],"line":108},"4":{"loc":{"start":{"line":108,"column":40},"end":{"line":108,"column":76}},"type":"binary-expr","locations":[{"start":{"line":108,"column":40},"end":{"line":108,"column":50}},{"start":{"line":108,"column":55},"end":{"line":108,"column":75}}],"line":108},"5":{"loc":{"start":{"line":155,"column":2},"end":{"line":155,"column":33}},"type":"if","locations":[{"start":{"line":155,"column":2},"end":{"line":155,"column":33}},{"start":{"line":155,"column":2},"end":{"line":155,"column":33}}],"line":155},"6":{"loc":{"start":{"line":159,"column":11},"end":{"line":159,"column":53}},"type":"cond-expr","locations":[{"start":{"line":159,"column":30},"end":{"line":159,"column":47}},{"start":{"line":159,"column":50},"end":{"line":159,"column":53}}],"line":159},"7":{"loc":{"start":{"line":176,"column":2},"end":{"line":176,"column":32}},"type":"if","locations":[{"start":{"line":176,"column":2},"end":{"line":176,"column":32}},{"start":{"line":176,"column":2},"end":{"line":176,"column":32}}],"line":176},"8":{"loc":{"start":{"line":177,"column":9},"end":{"line":181,"column":41}},"type":"cond-expr","locations":[{"start":{"line":178,"column":6},"end":{"line":178,"column":8}},{"start":{"line":179,"column":6},"end":{"line":181,"column":41}}],"line":177},"9":{"loc":{"start":{"line":179,"column":6},"end":{"line":181,"column":41}},"type":"cond-expr","locations":[{"start":{"line":180,"column":8},"end":{"line":180,"column":40}},{"start":{"line":181,"column":8},"end":{"line":181,"column":41}}],"line":179},"10":{"loc":{"start":{"line":200,"column":2},"end":{"line":200,"column":77}},"type":"if","locations":[{"start":{"line":200,"column":2},"end":{"line":200,"column":77}},{"start":{"line":200,"column":2},"end":{"line":200,"column":77}}],"line":200},"11":{"loc":{"start":{"line":202,"column":2},"end":{"line":202,"column":25}},"type":"if","locations":[{"start":{"line":202,"column":2},"end":{"line":202,"column":25}},{"start":{"line":202,"column":2},"end":{"line":202,"column":25}}],"line":202},"12":{"loc":{"start":{"line":244,"column":2},"end":{"line":244,"column":25}},"type":"if","locations":[{"start":{"line":244,"column":2},"end":{"line":244,"column":25}},{"start":{"line":244,"column":2},"end":{"line":244,"column":25}}],"line":244},"13":{"loc":{"start":{"line":266,"column":2},"end":{"line":266,"column":64}},"type":"if","locations":[{"start":{"line":266,"column":2},"end":{"line":266,"column":64}},{"start":{"line":266,"column":2},"end":{"line":266,"column":64}}],"line":266},"14":{"loc":{"start":{"line":268,"column":2},"end":{"line":268,"column":37}},"type":"if","locations":[{"start":{"line":268,"column":2},"end":{"line":268,"column":37}},{"start":{"line":268,"column":2},"end":{"line":268,"column":37}}],"line":268},"15":{"loc":{"start":{"line":270,"column":2},"end":{"line":270,"column":35}},"type":"if","locations":[{"start":{"line":270,"column":2},"end":{"line":270,"column":35}},{"start":{"line":270,"column":2},"end":{"line":270,"column":35}}],"line":270},"16":{"loc":{"start":{"line":287,"column":2},"end":{"line":287,"column":69}},"type":"if","locations":[{"start":{"line":287,"column":2},"end":{"line":287,"column":69}},{"start":{"line":287,"column":2},"end":{"line":287,"column":69}}],"line":287},"17":{"loc":{"start":{"line":287,"column":6},"end":{"line":287,"column":47}},"type":"binary-expr","locations":[{"start":{"line":287,"column":6},"end":{"line":287,"column":17}},{"start":{"line":287,"column":21},"end":{"line":287,"column":47}}],"line":287}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":1,"8":22,"9":1,"10":3,"11":1,"12":10,"13":1,"14":2,"15":2,"16":2,"17":10,"18":2,"19":1,"20":1,"21":20,"22":20,"23":1,"24":19,"25":19,"26":19,"27":19,"28":19,"29":19,"30":19,"31":19,"32":19,"33":1,"34":1,"35":29,"36":1,"37":1,"38":1,"39":1,"40":2,"41":2,"42":0,"43":2,"44":2,"45":14,"46":14,"47":1,"48":2,"49":2,"50":0,"51":2,"52":7,"53":2,"54":4,"55":5,"56":5,"57":0,"58":5,"59":5,"60":35,"61":1,"62":1,"63":1,"64":1,"65":1,"66":0,"67":1,"68":7,"69":1,"70":3,"71":0,"72":0,"73":3,"74":3,"75":0,"76":3,"77":3,"78":0,"79":3,"80":1,"81":25,"82":25,"83":25,"84":3,"85":22},"f":{"0":22,"1":3,"2":10,"3":2,"4":20,"5":1,"6":29,"7":1,"8":2,"9":14,"10":2,"11":7,"12":4,"13":35,"14":1,"15":7,"16":3,"17":0,"18":25},"b":{"0":[1,2],"1":[1],"2":[1,19],"3":[1],"4":[29,20],"5":[0,2],"6":[8,6],"7":[0,2],"8":[0,2],"9":[1,1],"10":[2,5],"11":[0,5],"12":[0,1],"13":[0,3],"14":[0,3],"15":[0,3],"16":[3,22],"17":[25,24]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"b8f6d1adddbbef86fccfbca16ab9819d7bce4d79"}
}

@@ -32,3 +32,2 @@ /**

/**
*
* A lead-sheet symbol begins with a capital letter (and, if necessary,

@@ -35,0 +34,0 @@ * an accidental) denoting the root of the chord.

{
"name": "tonal-key",
"version": "2.1.0",
"version": "2.1.1",
"description": "Conversion between key numbers and note names",

@@ -5,0 +5,0 @@ "repository": "https://github.com/danigb/tonal/extensions/key",

<a name="module_Key"></a>
# Key
[![npm version](https://img.shields.io/npm/v/tonal-Key.svg?style=flat-square)](https://www.npmjs.com/package/tonal-key)

@@ -12,30 +11,29 @@ [![tonal](https://img.shields.io/badge/tonal-key-yellow.svg?style=flat-square)](https://www.npmjs.com/browse/keyword/tonal)

**Example**
**Example**
```js
// es6
import * as Key from "tonal-key";
import * as Key from "tonal-key"
// es5
const Key = require("tonal-key");
const Key = require("tonal-key")
```
**Example**
**Example**
```js
Key.scale("E mixolydian"); // => [ "E", "F#", "G#", "A", "B", "C#", "D" ]
Key.relative("minor", "C major"); // => "A minor"
Key.scale("E mixolydian") // => [ "E", "F#", "G#", "A", "B", "C#", "D" ]
Key.relative("minor", "C major") // => "A minor"
```
- [Key](#module_Key)
- [`.degrees`](#module_Key.degrees) ⇒ <code>Array</code>
- [`.modeNames(alias)`](#module_Key.modeNames) ⇒ <code>Array</code>
- [`.fromAlter(alt)`](#module_Key.fromAlter) ⇒ <code>Key</code>
- [`.props(name)`](#module_Key.props) ⇒ <code>Object</code>
- [`.scale(key)`](#module_Key.scale) ⇒ <code>Array</code>
- [`.alteredNotes(key)`](#module_Key.alteredNotes) ⇒ <code>Array</code>
- [`.chords(name)`](#module_Key.chords) ⇒ <code>Array</code>
- [`.triads(name)`](#module_Key.triads) ⇒ <code>Array</code>
- [`.secDomChords(name)`](#module_Key.secDomChords) ⇒ <code>Array</code>
- [`.relative(mode, key)`](#module_Key.relative)
- [`.tokenize(name)`](#module_Key.tokenize) ⇒ <code>Array</code>
* [Key](#module_Key)
* [`.degrees`](#module_Key.degrees) ⇒ <code>Array</code>
* [`.modeNames(alias)`](#module_Key.modeNames) ⇒ <code>Array</code>
* [`.fromAlter(alt)`](#module_Key.fromAlter) ⇒ <code>Key</code>
* [`.props(name)`](#module_Key.props) ⇒ <code>Object</code>
* [`.scale(key)`](#module_Key.scale) ⇒ <code>Array</code>
* [`.alteredNotes(key)`](#module_Key.alteredNotes) ⇒ <code>Array</code>
* [`.leadsheetSymbols(symbols, keyName)`](#module_Key.leadsheetSymbols) ⇒ <code>function</code>
* [`.chords(name)`](#module_Key.chords) ⇒ <code>Array</code>
* [`.triads(name)`](#module_Key.triads) ⇒ <code>Array</code>
* [`.secDomChords(name)`](#module_Key.secDomChords) ⇒ <code>Array</code>
* [`.relative(mode, key)`](#module_Key.relative)
* [`.tokenize(name)`](#module_Key.tokenize) ⇒ <code>Array</code>
* [`~TRIADS`](#module_Key..TRIADS)

@@ -45,21 +43,17 @@ <a name="module_Key.degrees"></a>

## `Key.degrees` ⇒ <code>Array</code>
Get a list of key scale degrees
**Kind**: static constant of [<code>Key</code>](#module_Key)
**Kind**: static constant of [<code>Key</code>](#module_Key)
| Param | Type |
| ------- | ------------------- |
| keyName | <code>String</code> |
| Param | Type |
| --- | --- |
| keyName | <code>String</code> |
**Example**
**Example**
```js
Key.degrees("C major") => ["I", "ii", "iii", "IV", "V", "vi", "vii"]
```
<a name="module_Key.modeNames"></a>
## `Key.modeNames(alias)` ⇒ <code>Array</code>
Get a list of valid mode names. The list of modes will be always in

@@ -69,40 +63,34 @@ increasing order (ionian to locrian)

**Kind**: static method of [<code>Key</code>](#module_Key)
**Returns**: <code>Array</code> - an array of strings
**Returns**: <code>Array</code> - an array of strings
| Param | Type | Description |
| ----- | -------------------- | ------------------------- |
| Param | Type | Description |
| --- | --- | --- |
| alias | <code>Boolean</code> | true to get aliases names |
**Example**
**Example**
```js
Key.modes(); // => [ "ionian", "dorian", "phrygian", "lydian",
Key.modes() // => [ "ionian", "dorian", "phrygian", "lydian",
// "mixolydian", "aeolian", "locrian" ]
Key.modes(true); // => [ "ionian", "dorian", "phrygian", "lydian",
Key.modes(true) // => [ "ionian", "dorian", "phrygian", "lydian",
// "mixolydian", "aeolian", "locrian", "major", "minor" ]
```
<a name="module_Key.fromAlter"></a>
## `Key.fromAlter(alt)` ⇒ <code>Key</code>
Create a major key from alterations
**Kind**: static method of [<code>Key</code>](#module_Key)
**Returns**: <code>Key</code> - the key object
**Returns**: <code>Key</code> - the key object
| Param | Type | Description |
| ----- | -------------------- | ------------------------------------------------------- |
| alt | <code>Integer</code> | the alteration number (positive sharps, negative flats) |
| Param | Type | Description |
| --- | --- | --- |
| alt | <code>Integer</code> | the alteration number (positive sharps, negative flats) |
**Example**
**Example**
```js
Key.fromAlter(2); // => "D major"
Key.fromAlter(2) // => "D major"
```
<a name="module_Key.props"></a>
## `Key.props(name)` ⇒ <code>Object</code>
Return the a key properties object with the following information:

@@ -120,113 +108,119 @@

**Kind**: static method of [<code>Key</code>](#module_Key)
**Returns**: <code>Object</code> - the key properties object or null if not a valid key
**Returns**: <code>Object</code> - the key properties object or null if not a valid key
| Param | Type | Description |
| ----- | ------------------- | ------------ |
| name | <code>String</code> | the key name |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>String</code> | the key name |
**Example**
**Example**
```js
Key.props("C3 dorian"); // => { tonic: "C", mode: "dorian", ... }
Key.props("C3 dorian") // => { tonic: "C", mode: "dorian", ... }
```
<a name="module_Key.scale"></a>
## `Key.scale(key)` ⇒ <code>Array</code>
Get scale of a key
**Kind**: static method of [<code>Key</code>](#module_Key)
**Returns**: <code>Array</code> - the key scale
**Returns**: <code>Array</code> - the key scale
| Param | Type |
| ----- | ------------------------------------------ |
| key | <code>String</code> \| <code>Object</code> |
| Param | Type |
| --- | --- |
| key | <code>String</code> \| <code>Object</code> |
**Example**
**Example**
```js
Key.scale("A major"); // => [ "A", "B", "C#", "D", "E", "F#", "G#" ]
Key.scale("Bb minor"); // => [ "Bb", "C", "Db", "Eb", "F", "Gb", "Ab" ]
Key.scale("C dorian"); // => [ "C", "D", "Eb", "F", "G", "A", "Bb" ]
Key.scale("E mixolydian"); // => [ "E", "F#", "G#", "A", "B", "C#", "D" ]
Key.scale("A major") // => [ "A", "B", "C#", "D", "E", "F#", "G#" ]
Key.scale("Bb minor") // => [ "Bb", "C", "Db", "Eb", "F", "Gb", "Ab" ]
Key.scale("C dorian") // => [ "C", "D", "Eb", "F", "G", "A", "Bb" ]
Key.scale("E mixolydian") // => [ "E", "F#", "G#", "A", "B", "C#", "D" ]
```
<a name="module_Key.alteredNotes"></a>
## `Key.alteredNotes(key)` ⇒ <code>Array</code>
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 [<code>Key</code>](#module_Key)
**Kind**: static method of [<code>Key</code>](#module_Key)
| Param | Type | Description |
| ----- | ------------------- | ------------ |
| key | <code>String</code> | the key name |
| Param | Type | Description |
| --- | --- | --- |
| key | <code>String</code> | the key name |
**Example**
**Example**
```js
Key.alteredNotes("Eb major") // => [ "Bb", "Eb", "Ab" ]
```
<a name="module_Key.leadsheetSymbols"></a>
## `Key.leadsheetSymbols(symbols, keyName)` ⇒ <code>function</code>
Get a lead-sheet symbols for a given key name
This function is currified (so can be partially applied)
**Kind**: static method of [<code>Key</code>](#module_Key)
**See**
- Key.chords
- Key.triads
| Param | Type | Description |
| --- | --- | --- |
| symbols | <code>Array.&lt;String&gt;</code> | an array of symbols in major scale order |
| keyName | <code>String</code> | the name of the key you want the symbols for |
**Example**
```js
Key.alteredNotes("Eb major"); // => [ "Bb", "Eb", "Ab" ]
const chords = Key.leadsheetSymbols(["M", "m", "m", "M", "7", "m", "dim"])
chords("D dorian") //=> ["Dm", "Em", "FM", "G7", "Am", "Bdim", "CM"]
```
<a name="module_Key.chords"></a>
## `Key.chords(name)` ⇒ <code>Array</code>
Get key chords
**Kind**: static method of [<code>Key</code>](#module_Key)
**Kind**: static method of [<code>Key</code>](#module_Key)
| Param | Type | Description |
| ----- | ------------------- | ------------ |
| name | <code>String</code> | the key name |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>String</code> | the key name |
**Example**
**Example**
```js
Key.chords("A major"); // => ["AMaj7", "Bm7", "C#m7", "DMaj7", ..,]
Key.chords("A major") // => ["AMaj7", "Bm7", "C#m7", "DMaj7", ..,]
```
<a name="module_Key.triads"></a>
## `Key.triads(name)` ⇒ <code>Array</code>
Get key triads
**Kind**: static method of [<code>Key</code>](#module_Key)
**Kind**: static method of [<code>Key</code>](#module_Key)
| Param | Type | Description |
| ----- | ------------------- | ------------ |
| name | <code>String</code> | the key name |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>String</code> | the key name |
**Example**
**Example**
```js
Key.triads("A major"); // => ["AM", "Bm", "C#m", "DM", "E7", "F#m", "G#mb5"]
Key.triads("A major") // => ["AM", "Bm", "C#m", "DM", "E7", "F#m", "G#mb5"]
```
<a name="module_Key.secDomChords"></a>
## `Key.secDomChords(name)` ⇒ <code>Array</code>
Get secondary dominant key chords
**Kind**: static method of [<code>Key</code>](#module_Key)
**Kind**: static method of [<code>Key</code>](#module_Key)
| Param | Type | Description |
| ----- | ------------------- | ------------ |
| name | <code>String</code> | the key name |
| Param | Type | Description |
| --- | --- | --- |
| name | <code>String</code> | the key name |
**Example**
**Example**
```js
Key.secDomChords("A major"); // => ["E7", "F#7", ...]
Key.secDomChords("A major") // => ["E7", "F#7", ...]
```
<a name="module_Key.relative"></a>
## `Key.relative(mode, key)`
Get relative of a key. Two keys are relative when the have the same

@@ -237,36 +231,45 @@ key signature (for example C major and A minor)

**Kind**: static method of [<code>Key</code>](#module_Key)
**Kind**: static method of [<code>Key</code>](#module_Key)
| Param | Type | Description |
| ----- | ------------------- | ------------------------ |
| mode | <code>String</code> | the relative destination |
| key | <code>String</code> | the key source |
| Param | Type | Description |
| --- | --- | --- |
| mode | <code>String</code> | the relative destination |
| key | <code>String</code> | the key source |
**Example**
**Example**
```js
Key.relative("dorian", "B major"); // => "C# dorian"
Key.relative("dorian", "B major") // => "C# dorian"
// partial application
var minor = Key.relative("minor");
minor("C major"); // => "A minor"
minor("E major"); // => "C# minor"
var minor = Key.relative("minor")
minor("C major") // => "A minor"
minor("E major") // => "C# minor"
```
<a name="module_Key.tokenize"></a>
## `Key.tokenize(name)` ⇒ <code>Array</code>
Split the key name into its components (pitch class tonic and mode name)
**Kind**: static method of [<code>Key</code>](#module_Key)
**Returns**: <code>Array</code> - an array in the form [tonic, key]
**Returns**: <code>Array</code> - an array in the form [tonic, key]
| Param | Type |
| ----- | ------------------- |
| name | <code>String</code> |
| Param | Type |
| --- | --- |
| name | <code>String</code> |
**Example**
**Example**
```js
Key.tokenize("C major"); // => ["C", "major"]
Key.tokenize("C major") // => ["C", "major"]
```
<a name="module_Key..TRIADS"></a>
## `Key~TRIADS`
A lead-sheet symbol begins with a capital letter (and, if necessary,
an accidental) denoting the root of the chord.
That letter is followed by information about a chord’s quality:
-major triad: no quality symbol is added
-minor triad: lower-case “m”
-diminished triad: lower-case “dim” or a degree sign “°”
-augmented triad: lower-case “aug” or a plus sign “+”
**Kind**: inner constant of [<code>Key</code>](#module_Key)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc