# @tonaljs/chord-type

> A dictionary of musical chords

Latest version **5.2.1** (published 2026-10-14) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

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

## Links

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

## Dependencies (1)

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

## Recent versions

- 5.2.1 (latest) — 2026-10-14
- 5.2.0 — 2026-09-28
- 5.1.1 — 2025-01-03
- 5.1.0 — 2024-07-23
- 5.0.5 — 2024-02-03
- 5.0.4 — 2024-02-03
- 5.0.3 — 2024-01-04
- 5.0.2 — 2023-11-28
- 5.0.1 — 2023-11-28
- 5.0.0 — 2023-06-13
- 4.8.2 — 2023-06-13
- 4.8.1 — 2023-04-25
- 4.8.0 — 2022-11-29
- 4.7.3 — 2022-11-29
- 4.7.2 — 2022-11-29
- … 17 more at https://npm.io/package/@tonaljs/chord-type/versions

## README

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

> A dictionary of musical chords.

## Usage

ES6:

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

node:

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

## API

#### `ChordType.get(name: string) => object`

Given a chord type name, return an object with the following properties:

- name: the chord 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
ChordType.get("major"); // =>
// {
//   name: "major",
//   aliases: ["M", ""],
//   quality: "Major",
//   intervals: ["1P", "3M", "5P"],
//   num: 2192,
//   chroma: "100010010000",
//   length: 3
// });
```

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

List all chord type (long) names in the dictionary

#### `ChordType.symbols() => string[]`

List all chord type (long) names in the dictionary

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

Return a list of all available chord types.

#### `ChordType.add(intervals: string[], names: string[], fullName?: string) => ChordType`

Add a chord type to dictionary:

```js
add(["1P", "3M", "5P"], ["M"], "mayor");
```

You can add new chords to the dictionary using `ChordType` module:

```ts
import { Chord, ChordType } from "tonal";

ChordType.add(["1P", "5P", "7M"], ["5maj7", "5add7"]);
Chord.detect(["C3", "G3", "B3"]); // => ["C5maj7"]
```

## HOW TO

#### How to get triad chord names?

```js
ChordType.all()
  .filter((get) => get.length === 3)
  .map((get) => get.name);
```

#### How to add a chord type to the dictionary?

```js
ChordType.add(["1P", "3M", "5P"], ["M", "may"], "mayor");
ChordType.get("mayor"); // => { name: 'mayor', quality: "Major", chroma: ... }
ChordType.get("may"); // => { name: 'mayor', quality: "Major", chroma: ... }
```

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