# @tonaljs/mode

> Functions to work with musical modes

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

## Install

```sh
npm install @tonaljs/mode
pnpm add @tonaljs/mode
yarn add @tonaljs/mode
bun add @tonaljs/mode
```

## Health

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

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

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 4.9.4 |
| Published | 2026-10-14 |
| First published | 2019-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 26.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | danigb@gmail.com |
| Maintainers | danigb |
| Keywords | mode, music, theory, music-theory |

## Links

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

## Dependencies (6)

- [@tonaljs/pcset](https://npm.io/package/@tonaljs/pcset.md) 4.10.3
- [@tonaljs/interval](https://npm.io/package/@tonaljs/interval.md) 5.1.1
- [@tonaljs/collection](https://npm.io/package/@tonaljs/collection.md) 4.9.1
- [@tonaljs/pitch-note](https://npm.io/package/@tonaljs/pitch-note.md) 6.1.2
- [@tonaljs/scale-type](https://npm.io/package/@tonaljs/scale-type.md) 4.9.4
- [@tonaljs/pitch-distance](https://npm.io/package/@tonaljs/pitch-distance.md) 5.0.7

## Recent versions

- 4.9.4 (latest) — 2026-10-14
- 4.9.3 — 2026-09-28
- 4.9.2 — 2026-01-18
- 4.9.1 — 2025-01-03
- 4.9.0 — 2024-07-23
- 4.8.4 — 2024-02-03
- 4.8.3 — 2024-02-03
- 4.8.2 — 2024-01-04
- 4.8.1 — 2023-06-13
- 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
- … 19 more at https://npm.io/package/@tonaljs/mode/versions

## README

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

`@tonaljs/mode` greek modes dictionary

## Usage

ES6:

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

node:

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

## API

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

Given a mode name, returns a Mode object with the following fields:

- name: the mode name
- aliases: alternative mode names
- modeNum: the mode number (0...7)
- mode: the mode number
- alt: the alterations
- triad: the triad chord type
- seventh: the seventh chord type

Example:

```js
Mode.get("major");
// {
//   name: "ionian",
//   aliases: ["major"]
//   intervals: ["1P", "2M", "3M", "4P", "5P", "6M", "7M"]
//   modeNum: 0,
//   mode: 2773,
//   alt: 0,
//   triad: "",
//   seventh: "Maj7",
// }
```

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

Get a list of all mode names.

```js
Mode.names();
// => ["ionian", "dorian", "phrygian", "lydian", "mixolydian", "aeolian", "locrian"];
```

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

Return a list of known modes

```js
Mode.all();
```

### `notes(modeName: string, tonic: string) => string[]`

Find notes of a mode with tonic:

```js
Mode.notes("ionian", "C");
// => ["C", "D", "E", "F", "G", "A", "B"];
Mode.notes("major", "C");
// => ["C", "D", "E", "F", "G", "A", "B"];
Mode.notes("minor", "C");
// => ["C", "D", "Eb", "F", "G", "Ab", "Bb"];
```

### `triads(modeName: string, tonic: string) => string[]`

Return the triads of a mode with tonic:

```js
Mode.triads("major", "C");
// => ["C", "Dm", "Em", "F", "G", "Am", "Bdim"];
```

### `seventhChords(modeName: string, tonic: string) => string[]`

Return the seventh chords of a mode with tonic:

```js
Mode.seventhChords("major", "C");
// => ["CMaj7", "Dm7", "Em7", "FMaj7", "G7", "Am7", "B7b5"];
```

#### `relativeTonic(destination: string, source: string, tonic: string)`

Find a relative tonic. For example, the "minor" relative tonic of "C major" is "A":

```js
Mode.relativeTonic("minor", "major", "C"); // => "A"
```

## How to?

#### Get notes from a mode?

For example, "A major" mode:

```js
import { Mode, Note } from "tonal";

Mode.get("major").intervals.map(Note.transposeFrom("A"));
["A", "B", "C#", "D", "E", "F#", "G#"];
```

## Want more?

Take a look to [@tonal/key](/packages/key)

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