Comparing version 2.1.1 to 2.1.2
@@ -17,12 +17,2 @@ 'use strict'; | ||
/** | ||
* 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"]; | ||
@@ -180,2 +170,13 @@ var SEVENTHS = "Maj7 m7 m7 Maj7 7 m7 m7b5".split(" "); | ||
* | ||
* From http://openmusictheory.com/triads.html | ||
* | ||
* 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 “+” | ||
* | ||
* @param {Array<String>} symbols - an array of symbols in major scale order | ||
@@ -182,0 +183,0 @@ * @param {String} keyName - the name of the key you want the symbols for |
var arguments$1 = arguments; | ||
/** | ||
* [![npm version](https://img.shields.io/npm/v/tonal-Key.svg?style=flat-square)](https://www.npmjs.com/package/tonal-key) | ||
* [![npm version](https://img.shields.io/npm/v/tonal-key.svg?style=flat-square)](https://www.npmjs.com/package/tonal-key) | ||
* [![tonal](https://img.shields.io/badge/tonal-key-yellow.svg?style=flat-square)](https://www.npmjs.com/browse/keyword/tonal) | ||
@@ -33,12 +33,2 @@ * | ||
/** | ||
* 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"]; | ||
@@ -196,2 +186,13 @@ var SEVENTHS = "Maj7 m7 m7 Maj7 7 m7 m7b5".split(" "); | ||
* | ||
* From http://openmusictheory.com/triads.html | ||
* | ||
* 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 “+” | ||
* | ||
* @param {Array<String>} symbols - an array of symbols in major scale order | ||
@@ -198,0 +199,0 @@ * @param {String} keyName - the name of the key you want the symbols for |
@@ -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":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"} | ||
{"/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":31,"column":15},"end":{"line":31,"column":49}},"4":{"start":{"line":32,"column":17},"end":{"line":32,"column":55}},"5":{"start":{"line":33,"column":16},"end":{"line":33,"column":49}},"6":{"start":{"line":34,"column":15},"end":{"line":34,"column":43}},"7":{"start":{"line":36,"column":16},"end":{"line":36,"column":49}},"8":{"start":{"line":36,"column":24},"end":{"line":36,"column":49}},"9":{"start":{"line":51,"column":25},"end":{"line":52,"column":54}},"10":{"start":{"line":52,"column":2},"end":{"line":52,"column":54}},"11":{"start":{"line":63,"column":25},"end":{"line":63,"column":57}},"12":{"start":{"line":63,"column":30},"end":{"line":63,"column":57}},"13":{"start":{"line":65,"column":21},"end":{"line":70,"column":1}},"14":{"start":{"line":66,"column":2},"end":{"line":66,"column":22}},"15":{"start":{"line":67,"column":17},"end":{"line":67,"column":19}},"16":{"start":{"line":68,"column":2},"end":{"line":68,"column":62}},"17":{"start":{"line":68,"column":36},"end":{"line":68,"column":62}},"18":{"start":{"line":69,"column":2},"end":{"line":69,"column":16}},"19":{"start":{"line":72,"column":15},"end":{"line":81,"column":2}},"20":{"start":{"line":83,"column":19},"end":{"line":95,"column":1}},"21":{"start":{"line":84,"column":12},"end":{"line":84,"column":26}},"22":{"start":{"line":85,"column":2},"end":{"line":85,"column":35}},"23":{"start":{"line":85,"column":21},"end":{"line":85,"column":35}},"24":{"start":{"line":86,"column":12},"end":{"line":86,"column":39}},"25":{"start":{"line":87,"column":2},"end":{"line":87,"column":34}},"26":{"start":{"line":88,"column":2},"end":{"line":88,"column":30}},"27":{"start":{"line":89,"column":13},"end":{"line":89,"column":37}},"28":{"start":{"line":90,"column":2},"end":{"line":90,"column":63}},"29":{"start":{"line":91,"column":2},"end":{"line":91,"column":26}},"30":{"start":{"line":92,"column":2},"end":{"line":92,"column":40}},"31":{"start":{"line":93,"column":2},"end":{"line":93,"column":48}},"32":{"start":{"line":94,"column":2},"end":{"line":94,"column":26}},"33":{"start":{"line":97,"column":13},"end":{"line":97,"column":76}},"34":{"start":{"line":97,"column":33},"end":{"line":97,"column":76}},"35":{"start":{"line":97,"column":40},"end":{"line":97,"column":76}},"36":{"start":{"line":118,"column":21},"end":{"line":118,"column":37}},"37":{"start":{"line":133,"column":21},"end":{"line":133,"column":44}},"38":{"start":{"line":133,"column":28},"end":{"line":133,"column":44}},"39":{"start":{"line":142,"column":23},"end":{"line":150,"column":1}},"40":{"start":{"line":143,"column":12},"end":{"line":143,"column":22}},"41":{"start":{"line":144,"column":2},"end":{"line":144,"column":33}},"42":{"start":{"line":144,"column":23},"end":{"line":144,"column":33}},"43":{"start":{"line":145,"column":17},"end":{"line":145,"column":44}},"44":{"start":{"line":146,"column":2},"end":{"line":149,"column":5}},"45":{"start":{"line":147,"column":16},"end":{"line":147,"column":26}},"46":{"start":{"line":148,"column":4},"end":{"line":148,"column":54}},"47":{"start":{"line":163,"column":28},"end":{"line":171,"column":1}},"48":{"start":{"line":164,"column":14},"end":{"line":164,"column":29}},"49":{"start":{"line":165,"column":2},"end":{"line":165,"column":32}},"50":{"start":{"line":165,"column":20},"end":{"line":165,"column":32}},"51":{"start":{"line":166,"column":2},"end":{"line":170,"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":36,"column":16},"end":{"line":36,"column":17}},"loc":{"start":{"line":36,"column":24},"end":{"line":36,"column":49}},"line":36},"1":{"name":"(anonymous_1)","decl":{"start":{"line":51,"column":25},"end":{"line":51,"column":26}},"loc":{"start":{"line":52,"column":2},"end":{"line":52,"column":54}},"line":52},"2":{"name":"(anonymous_2)","decl":{"start":{"line":63,"column":25},"end":{"line":63,"column":26}},"loc":{"start":{"line":63,"column":30},"end":{"line":63,"column":57}},"line":63},"3":{"name":"(anonymous_3)","decl":{"start":{"line":65,"column":21},"end":{"line":65,"column":22}},"loc":{"start":{"line":65,"column":34},"end":{"line":70,"column":1}},"line":65},"4":{"name":"(anonymous_4)","decl":{"start":{"line":83,"column":19},"end":{"line":83,"column":20}},"loc":{"start":{"line":83,"column":27},"end":{"line":95,"column":1}},"line":83},"5":{"name":"(anonymous_5)","decl":{"start":{"line":97,"column":13},"end":{"line":97,"column":14}},"loc":{"start":{"line":97,"column":33},"end":{"line":97,"column":76}},"line":97},"6":{"name":"(anonymous_6)","decl":{"start":{"line":97,"column":33},"end":{"line":97,"column":34}},"loc":{"start":{"line":97,"column":40},"end":{"line":97,"column":76}},"line":97},"7":{"name":"(anonymous_7)","decl":{"start":{"line":133,"column":21},"end":{"line":133,"column":22}},"loc":{"start":{"line":133,"column":28},"end":{"line":133,"column":44}},"line":133},"8":{"name":"(anonymous_8)","decl":{"start":{"line":142,"column":23},"end":{"line":142,"column":24}},"loc":{"start":{"line":142,"column":30},"end":{"line":150,"column":1}},"line":142},"9":{"name":"(anonymous_9)","decl":{"start":{"line":146,"column":20},"end":{"line":146,"column":21}},"loc":{"start":{"line":146,"column":34},"end":{"line":149,"column":3}},"line":146},"10":{"name":"(anonymous_10)","decl":{"start":{"line":163,"column":28},"end":{"line":163,"column":29}},"loc":{"start":{"line":163,"column":36},"end":{"line":171,"column":1}},"line":163},"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":52,"column":2},"end":{"line":52,"column":54}},"type":"cond-expr","locations":[{"start":{"line":52,"column":21},"end":{"line":52,"column":34}},{"start":{"line":52,"column":37},"end":{"line":52,"column":54}}],"line":52},"1":{"loc":{"start":{"line":65,"column":22},"end":{"line":65,"column":29}},"type":"default-arg","locations":[{"start":{"line":65,"column":28},"end":{"line":65,"column":29}}],"line":65},"2":{"loc":{"start":{"line":85,"column":2},"end":{"line":85,"column":35}},"type":"if","locations":[{"start":{"line":85,"column":2},"end":{"line":85,"column":35}},{"start":{"line":85,"column":2},"end":{"line":85,"column":35}}],"line":85},"3":{"loc":{"start":{"line":97,"column":18},"end":{"line":97,"column":28}},"type":"default-arg","locations":[{"start":{"line":97,"column":26},"end":{"line":97,"column":28}}],"line":97},"4":{"loc":{"start":{"line":97,"column":40},"end":{"line":97,"column":76}},"type":"binary-expr","locations":[{"start":{"line":97,"column":40},"end":{"line":97,"column":50}},{"start":{"line":97,"column":55},"end":{"line":97,"column":75}}],"line":97},"5":{"loc":{"start":{"line":144,"column":2},"end":{"line":144,"column":33}},"type":"if","locations":[{"start":{"line":144,"column":2},"end":{"line":144,"column":33}},{"start":{"line":144,"column":2},"end":{"line":144,"column":33}}],"line":144},"6":{"loc":{"start":{"line":148,"column":11},"end":{"line":148,"column":53}},"type":"cond-expr","locations":[{"start":{"line":148,"column":30},"end":{"line":148,"column":47}},{"start":{"line":148,"column":50},"end":{"line":148,"column":53}}],"line":148},"7":{"loc":{"start":{"line":165,"column":2},"end":{"line":165,"column":32}},"type":"if","locations":[{"start":{"line":165,"column":2},"end":{"line":165,"column":32}},{"start":{"line":165,"column":2},"end":{"line":165,"column":32}}],"line":165},"8":{"loc":{"start":{"line":166,"column":9},"end":{"line":170,"column":41}},"type":"cond-expr","locations":[{"start":{"line":167,"column":6},"end":{"line":167,"column":8}},{"start":{"line":168,"column":6},"end":{"line":170,"column":41}}],"line":166},"9":{"loc":{"start":{"line":168,"column":6},"end":{"line":170,"column":41}},"type":"cond-expr","locations":[{"start":{"line":169,"column":8},"end":{"line":169,"column":40}},{"start":{"line":170,"column":8},"end":{"line":170,"column":41}}],"line":168},"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":"0c308eda1d4e951197f25eaabc2b54f8fde42d02"} | ||
} |
23
index.js
/** | ||
* [![npm version](https://img.shields.io/npm/v/tonal-Key.svg?style=flat-square)](https://www.npmjs.com/package/tonal-key) | ||
* [![npm version](https://img.shields.io/npm/v/tonal-key.svg?style=flat-square)](https://www.npmjs.com/package/tonal-key) | ||
* [![tonal](https://img.shields.io/badge/tonal-key-yellow.svg?style=flat-square)](https://www.npmjs.com/browse/keyword/tonal) | ||
@@ -31,12 +31,2 @@ * | ||
/** | ||
* 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 “+” | ||
*/ | ||
const TRIADS = ["", "m", "m", "", "", "m", "dim"]; | ||
@@ -189,2 +179,13 @@ const SEVENTHS = "Maj7 m7 m7 Maj7 7 m7 m7b5".split(" "); | ||
* | ||
* From http://openmusictheory.com/triads.html | ||
* | ||
* 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 “+” | ||
* | ||
* @param {Array<String>} symbols - an array of symbols in major scale order | ||
@@ -191,0 +192,0 @@ * @param {String} keyName - the name of the key you want the symbols for |
{ | ||
"name": "tonal-key", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Conversion between key numbers and note names", | ||
@@ -13,3 +13,6 @@ "repository": "https://github.com/danigb/tonal/extensions/key", | ||
"docs": "jsdoc2md -d 1 --name-format --member-index-format list index.js > README.md", | ||
"test": "jest --coverage" | ||
"test": "jest --coverage", | ||
"build": "npm run build-es5 && npm run build-es6", | ||
"build-es5": "rollup -c ../../config/rollup.config.es5.js -- index.js", | ||
"build-es6": "buble --no modules index.js -o build/es6.js" | ||
}, | ||
@@ -21,5 +24,5 @@ "main": "build/es5.js", | ||
"dependencies": { | ||
"tonal-array": "^2.1.0", | ||
"tonal-distance": "^2.1.0", | ||
"tonal-note": "^2.1.0" | ||
"tonal-array": "^2.1.2", | ||
"tonal-distance": "^2.1.2", | ||
"tonal-note": "^2.1.2" | ||
}, | ||
@@ -26,0 +29,0 @@ "babel": { |
261
README.md
<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) | ||
[![npm version](https://img.shields.io/npm/v/tonal-key.svg?style=flat-square)](https://www.npmjs.com/package/tonal-key) | ||
[![tonal](https://img.shields.io/badge/tonal-key-yellow.svg?style=flat-square)](https://www.npmjs.com/browse/keyword/tonal) | ||
@@ -11,29 +12,31 @@ | ||
**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> | ||
* [`.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) | ||
- [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> | ||
@@ -43,17 +46,21 @@ <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 | ||
@@ -63,34 +70,40 @@ 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: | ||
@@ -108,50 +121,59 @@ | ||
**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" ] | ||
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 | ||
@@ -161,2 +183,13 @@ | ||
From http://openmusictheory.com/triads.html | ||
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**: static method of [<code>Key</code>](#module_Key) | ||
@@ -168,61 +201,72 @@ **See** | ||
| Param | Type | Description | | ||
| ------- | --------------------------------- | -------------------------------------------- | | ||
| symbols | <code>Array.<String></code> | an array of symbols in major scale order | | ||
| keyName | <code>String</code> | the name of the key you want the symbols for | | ||
| Param | Type | Description | | ||
| --- | --- | --- | | ||
| symbols | <code>Array.<String></code> | an array of symbols in major scale order | | ||
| keyName | <code>String</code> | the name of the key you want the symbols for | | ||
**Example** | ||
**Example** | ||
```js | ||
const chords = Key.leadsheetSymbols(["M", "m", "m", "M", "7", "m", "dim"]) | ||
chords("D dorian") //=> ["Dm", "Em", "FM", "G7", "Am", "Bdim", "CM"] | ||
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 | ||
@@ -233,45 +277,36 @@ 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
121833
1380
306
Updatedtonal-array@^2.1.2
Updatedtonal-distance@^2.1.2
Updatedtonal-note@^2.1.2