@tonaljs/scale-type
Version:
A dictionary of musical scales
249 lines (246 loc) • 7.71 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all2) => {
for (var name in all2)
__defProp(target, name, { get: all2[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// index.ts
var scale_type_exports = {};
__export(scale_type_exports, {
NoScaleType: () => NoScaleType,
add: () => add,
addAlias: () => addAlias,
all: () => all,
default: () => scale_type_default,
entries: () => entries,
get: () => get,
keys: () => keys,
names: () => names,
removeAll: () => removeAll,
scaleType: () => scaleType
});
module.exports = __toCommonJS(scale_type_exports);
var import_pcset = require("@tonaljs/pcset");
// data.ts
var SCALES = [
// Basic scales
["1P 2M 3M 5P 6M", "major pentatonic", "pentatonic"],
["1P 2M 3M 4P 5P 6M 7M", "major", "ionian"],
["1P 2M 3m 4P 5P 6m 7m", "minor", "aeolian"],
// Jazz common scales
["1P 2M 3m 3M 5P 6M", "major blues"],
["1P 3m 4P 5d 5P 7m", "minor blues", "blues"],
["1P 2M 3m 4P 5P 6M 7M", "melodic minor"],
["1P 2M 3m 4P 5P 6m 7M", "harmonic minor"],
["1P 2M 3M 4P 5P 6M 7m 7M", "bebop"],
["1P 2M 3m 4P 5d 6m 6M 7M", "diminished", "whole-half diminished"],
// Modes
["1P 2M 3m 4P 5P 6M 7m", "dorian"],
["1P 2M 3M 4A 5P 6M 7M", "lydian"],
["1P 2M 3M 4P 5P 6M 7m", "mixolydian", "dominant"],
["1P 2m 3m 4P 5P 6m 7m", "phrygian"],
["1P 2m 3m 4P 5d 6m 7m", "locrian"],
// 5-note scales
["1P 3M 4P 5P 7M", "ionian pentatonic"],
["1P 3M 4P 5P 7m", "mixolydian pentatonic", "indian"],
["1P 2M 4P 5P 6M", "ritusen"],
["1P 2M 4P 5P 7m", "egyptian"],
["1P 3M 4P 5d 7m", "neopolitan major pentatonic"],
["1P 3m 4P 5P 6m", "vietnamese 1"],
["1P 2m 3m 5P 6m", "pelog"],
["1P 2m 4P 5P 6m", "kumoijoshi"],
["1P 2M 3m 5P 6m", "hirajoshi"],
["1P 2m 4P 5d 7m", "iwato"],
["1P 2m 4P 5P 7m", "in-sen"],
["1P 3M 4A 5P 7M", "lydian pentatonic", "chinese"],
["1P 3m 4P 6m 7m", "malkos raga"],
["1P 3m 4P 5d 7m", "locrian pentatonic", "minor seven flat five pentatonic"],
["1P 3m 4P 5P 7m", "minor pentatonic", "vietnamese 2"],
["1P 3m 4P 5P 6M", "minor six pentatonic"],
["1P 2M 3m 5P 6M", "flat three pentatonic", "kumoi"],
["1P 2M 3M 5P 6m", "flat six pentatonic"],
["1P 2m 3M 5P 6M", "scriabin"],
["1P 3M 5d 6m 7m", "whole tone pentatonic"],
["1P 3M 4A 5A 7M", "lydian #5P pentatonic"],
["1P 3M 4A 5P 7m", "lydian dominant pentatonic"],
["1P 3m 4P 5P 7M", "minor #7M pentatonic"],
["1P 3m 4d 5d 7m", "super locrian pentatonic"],
// 6-note scales
["1P 2M 3m 4P 5P 7M", "minor hexatonic"],
["1P 2A 3M 5P 5A 7M", "augmented"],
["1P 2M 4P 5P 6M 7m", "piongio"],
["1P 2m 3M 4A 6M 7m", "prometheus neopolitan"],
["1P 2M 3M 4A 6M 7m", "prometheus"],
["1P 2m 3M 5d 6m 7m", "mystery #1"],
["1P 2m 3M 4P 5A 6M", "six tone symmetric"],
["1P 2M 3M 4A 5A 6A", "whole tone", "messiaen's mode #1"],
["1P 2m 4P 4A 5P 7M", "messiaen's mode #5"],
// 7-note scales
["1P 2M 3M 4P 5d 6m 7m", "locrian major", "arabian"],
["1P 2m 3M 4A 5P 6m 7M", "double harmonic lydian"],
[
"1P 2m 2A 3M 4A 6m 7m",
"altered",
"super locrian",
"diminished whole tone",
"pomeroy"
],
["1P 2M 3m 4P 5d 6m 7m", "locrian #2", "half-diminished", "aeolian b5"],
[
"1P 2M 3M 4P 5P 6m 7m",
"mixolydian b6",
"melodic minor fifth mode",
"hindu"
],
["1P 2M 3M 4A 5P 6M 7m", "lydian dominant", "lydian b7", "overtone"],
["1P 2M 3M 4A 5A 6M 7M", "lydian augmented"],
[
"1P 2m 3m 4P 5P 6M 7m",
"dorian b2",
"phrygian #6",
"melodic minor second mode"
],
[
"1P 2m 3m 4d 5d 6m 7d",
"ultralocrian",
"superlocrian bb7",
"superlocrian diminished"
],
["1P 2m 3m 4P 5d 6M 7m", "locrian 6", "locrian natural 6", "locrian sharp 6"],
["1P 2A 3M 4P 5P 5A 7M", "augmented heptatonic"],
// Source https://en.wikipedia.org/wiki/Ukrainian_Dorian_scale
[
"1P 2M 3m 4A 5P 6M 7m",
"dorian #4",
"ukrainian dorian",
"romanian minor",
"altered dorian"
],
["1P 2M 3m 4A 5P 6M 7M", "lydian diminished"],
["1P 2M 3M 4A 5A 7m 7M", "leading whole tone"],
["1P 2M 3M 4A 5P 6m 7m", "lydian minor"],
["1P 2m 3M 4P 5P 6m 7m", "phrygian dominant", "spanish", "phrygian major"],
["1P 2m 3m 4P 5P 6m 7M", "balinese"],
["1P 2m 3m 4P 5P 6M 7M", "neopolitan major"],
["1P 2M 3M 4P 5P 6m 7M", "harmonic major"],
["1P 2m 3M 4P 5P 6m 7M", "double harmonic major", "gypsy"],
["1P 2M 3m 4A 5P 6m 7M", "hungarian minor"],
["1P 2A 3M 4A 5P 6M 7m", "hungarian major"],
["1P 2m 3M 4P 5d 6M 7m", "oriental"],
["1P 2m 3m 3M 4A 5P 7m", "flamenco"],
["1P 2m 3m 4A 5P 6m 7M", "todi raga"],
["1P 2m 3M 4P 5d 6m 7M", "persian"],
["1P 2m 3M 5d 6m 7m 7M", "enigmatic"],
[
"1P 2M 3M 4P 5A 6M 7M",
"major augmented",
"major #5",
"ionian augmented",
"ionian #5"
],
["1P 2A 3M 4A 5P 6M 7M", "lydian #9"],
// 8-note scales
["1P 2m 2M 4P 4A 5P 6m 7M", "messiaen's mode #4"],
["1P 2m 3M 4P 4A 5P 6m 7M", "purvi raga"],
["1P 2m 3m 3M 4P 5P 6m 7m", "spanish heptatonic"],
["1P 2M 3m 3M 4P 5P 6M 7m", "bebop minor"],
["1P 2M 3M 4P 5P 5A 6M 7M", "bebop major"],
["1P 2m 3m 4P 5d 5P 6m 7m", "bebop locrian"],
["1P 2M 3m 4P 5P 6m 7m 7M", "minor bebop"],
["1P 2M 3M 4P 5d 5P 6M 7M", "ichikosucho"],
["1P 2M 3m 4P 5P 6m 6M 7M", "minor six diminished"],
[
"1P 2m 3m 3M 4A 5P 6M 7m",
"half-whole diminished",
"dominant diminished",
"messiaen's mode #2"
],
["1P 3m 3M 4P 5P 6M 7m 7M", "kafi raga"],
["1P 2M 3M 4P 4A 5A 6A 7M", "messiaen's mode #6"],
// 9-note scales
["1P 2M 3m 3M 4P 5d 5P 6M 7m", "composite blues"],
["1P 2M 3m 3M 4A 5P 6m 7m 7M", "messiaen's mode #3"],
// 10-note scales
["1P 2m 2M 3m 4P 4A 5P 6m 6M 7M", "messiaen's mode #7"],
// 12-note scales
["1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M", "chromatic"]
];
var data_default = SCALES;
// index.ts
var NoScaleType = {
...import_pcset.EmptyPcset,
intervals: [],
aliases: []
};
var dictionary = [];
var index = {};
function names() {
return dictionary.map((scale) => scale.name);
}
function get(type) {
return index[type] || NoScaleType;
}
var scaleType = get;
function all() {
return dictionary.slice();
}
var entries = all;
function keys() {
return Object.keys(index);
}
function removeAll() {
dictionary = [];
index = {};
}
function add(intervals, name, aliases = []) {
const scale = { ...(0, import_pcset.get)(intervals), name, intervals, aliases };
dictionary.push(scale);
index[scale.name] = scale;
index[scale.setNum] = scale;
index[scale.chroma] = scale;
scale.aliases.forEach((alias) => addAlias(scale, alias));
return scale;
}
function addAlias(scale, alias) {
index[alias] = scale;
}
data_default.forEach(
([ivls, name, ...aliases]) => add(ivls.split(" "), name, aliases)
);
var scale_type_default = {
names,
get,
all,
add,
removeAll,
keys,
// deprecated
entries,
scaleType
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
NoScaleType,
add,
addAlias,
all,
entries,
get,
keys,
names,
removeAll,
scaleType
});
//# sourceMappingURL=index.js.map
;