Package Exports
- @tonaljs/scale-dictionary
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@tonaljs/scale-dictionary) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@tonaljs/scale-dictionary 
@tonaljs/scale-dictionary is a dictionary of musical scales.
Usage
import { ScaleDictionary } from "@tonaljs/modules";API
get(name: string) => ScaleType
Given a scale type name, return a ScaleType object with the following properties:
- name: the scale type name
- aliases: a list of alternative names
- quality: Major | Minor | Augmented | Diminished | Unknown
- num: the pcset number
- chroma: the pcset chroma
- length: the number of notes
- intervals: the interval list
Example:
ScaleDictionary.get("major"); // =>
// {
// name: "major",
// aliases: ["ionian"],
// num: 2773,
// chroma: "101011010101",
// length: 7
// intervals: ["1P", "2M", "3M", "4P", "5P", "6M", "7M"],
// });entries() => Scale[]
Return a list of all available scale types
add(intervals: string[], name?: string, aliases?: string[]) => ScaleType
Add a scale type to dictionary:
ScaleDictionary.add(["1P", "5P"], null, ["5"]);HOW TO
How to get all names?
ScaleDictionary.entries().map(scaleType => scaleType.name);How to get all pentatonics names?
ScaleDictionary.entries()
.filter(scaleType => scaleType.length === 5)
.map(scaleType => scaleType.name);How do to add a scale to the dictionary?
ScaleDictionary.add(["1P", "5P"], "quinta", ["quinta justa", "diapente"]);
ScaleDictionary.scale("quinta"); // => { name: "quinta", intervals: ...}
ScaleDictionary.scale("quinta justa"); // => { name: "quinta", intervals: ... }