Tonal
Dictionaries

Scale dictionary

A dictionary of musical scales.

import { ScaleType } from "tonal";

API

ScaleType.get

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:

ScaleType.get("major"); // =>
// {
// name: "major",
// aliases: ["ionian"],
// num: 2773,
// chroma: "101011010101",
// length: 7
// intervals: ["1P", "2M", "3M", "4P", "5P", "6M", "7M"],
// });

ScaleType.names

names() => string[]

Return a list of all scale names

ScaleType.all

all() => object[]

Return a list of all scale types

ScaleType.add

add(intervals: string[], name?: string, aliases?: string[]) => ScaleType

Add a scale type to dictionary:

ScaleType.add(["1P", "5P"], null, ["5"]);

How to...

How to get all pentatonics names?

ScaleType.all()
  .filter((scaleType) => scaleType.intervals.length === 5)
  .map((scaleType) => scaleType.name);

How do to add a scale to the dictionary?

ScaleType.add(["1P", "5P"], "quinta", ["quinta justa", "diapente"]);
ScaleType.scale("quinta"); // => { name: "quinta", intervals: ...}
ScaleType.scale("quinta justa"); // => { name: "quinta", intervals: ... }

References

Some sources explaining various scale systems:

On this page