JSPM

  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q57092F
  • License MIT

A dictionary of musical scales

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 npm version

tonal

@tonaljs/scale-dictionary is a dictionary of musical scales.

API

scaleType(type: 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("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:

add(['1P', '5P'], null, ['5']);

HOW TO

How to get all names?

entries().map(scaleType => scaleType.name)

How to get all pentatonics names?

entries()
  .filter(scaleType => scaleType.length === 5)
  .map(scaleType =>scaleType.name);

How do to add a scale to the dictionary?

import { scale, add } from '@tonaljs/scale'
add(['1P', '5P'], 'quinta', ['quinta justa', 'diapente'])
scale('quinta') // => { name: "quinta", intervals: ...}
scale('quinta justa') // => { name: "quinta", intervals: ... }