# @tonaljs/scale-type

> A dictionary of musical scales

Latest version **4.9.2** (published 2026-01-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tonaljs/scale-type
pnpm add @tonaljs/scale-type
yarn add @tonaljs/scale-type
bun add @tonaljs/scale-type
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.9.2 |
| Published | 2026-01-18 |
| First published | 2020-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 46.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | danigb@gmail.com |
| Maintainers | danigb |
| Keywords | scale, dictionary, music, theory, music-theory |

## Links

- npm: https://www.npmjs.com/package/@tonaljs/scale-type
- npm.io page: https://npm.io/package/@tonaljs/scale-type

## Dependencies (1)

- [@tonaljs/pcset](https://npm.io/package/@tonaljs/pcset.md) 4.10.1

## Recent versions

- 4.9.2 (latest) — 2026-01-18
- 4.9.1 — 2025-01-03
- 4.9.0 — 2024-07-23
- 4.8.5 — 2024-02-03
- 4.8.4 — 2024-02-03
- 4.8.3 — 2024-01-04
- 4.8.2 — 2023-06-13
- 4.8.1 — 2023-01-19
- 4.8.0 — 2022-11-29
- 4.7.3 — 2022-11-29
- 4.7.2 — 2022-11-29
- 4.7.1 — 2022-11-29
- 4.7.0 — 2022-11-28
- 4.6.10 — 2022-11-18
- 4.6.5 — 2021-09-05
- … 12 more at https://npm.io/package/@tonaljs/scale-type/versions

## README

# @tonaljs/scale-type [![npm version](https://img.shields.io/npm/v/@tonaljs/scale-type.svg?style=flat-square)](https://www.npmjs.com/package/@tonaljs/scale-type)

[![tonal](https://img.shields.io/badge/@tonaljs-scale_dictionary-yellow.svg?style=flat-square)](https://www.npmjs.com/browse/keyword/tonal)

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

## Usage

ES6:

```js
import { ScaleType } from "tonal";
```

nodejs:

```js
const { ScaleType } = require("tonal");
```

## 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:

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

#### `names() => string[]`

Return a list of all scale names

#### `all() => object[]`

Return a list of all scale types

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

Add a scale type to dictionary:

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

## HOW TO

#### How to get all pentatonics names?

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

#### How do to add a scale to the dictionary?

```js
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:

- [Modes](<https://en.wikipedia.org/wiki/Mode_(music)>)
- [Blues Scales](https://en.wikipedia.org/wiki/Blues_scale)
- [Jazz Scales](https://en.wikipedia.org/wiki/Jazz_scale)
- [Messiaen's "Modes of Limited Transposition" (wikipedia, en)](https://en.wikipedia.org/wiki/Mode_of_limited_transposition)
- [Raga](https://de.wikipedia.org/wiki/Raga)

---
_Source: https://npm.io/package/@tonaljs/scale-type · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
