# @tonaljs/chord-detect

> Detect chord name based on note names

Latest version **4.9.1** (published 2025-01-03) · MIT license · 0 weekly downloads

## Install

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

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.9.1 |
| Published | 2025-01-03 |
| First published | 2020-03-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 21 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | danigb@gmail.com |
| Maintainers | danigb |
| Keywords | chord-detect, music, theory, tonal, music-theory |

## Links

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

## Dependencies (3)

- [@tonaljs/pcset](https://npm.io/package/@tonaljs/pcset.md) 4.10.1
- [@tonaljs/chord-type](https://npm.io/package/@tonaljs/chord-type.md) 5.1.1
- [@tonaljs/pitch-note](https://npm.io/package/@tonaljs/pitch-note.md) 6.1.0

## Recent versions

- 4.9.1 (latest) — 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-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
- 4.6.5 — 2021-09-05
- 4.6.2 — 2021-07-12
- … 12 more at https://npm.io/package/@tonaljs/chord-detect/versions

## README

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

## Usage

With ES6 `import`:

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

With ES5 `require`:

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

Standalone:

```js
import { detect } from "@tonaljs/chord-detect";
```

## API

### `Chord.detect(notes: string[], options?: { assumePerfectFifth?: boolean }) => string[]`

Examples:

```js
Chord.detect(["D", "F#", "A", "C"]); // => ["D7"]
Chord.detect(["F#", "A", "C", "D"]); // => ["D7/F#"]
Chord.detect(["A", "C", "D", "F#"]); // => ["D7/A"]
Chord.detect(["E", "G#", "B", "C#"]); // => ["E6", "C#m7/E"]
```

This function is also exposed in [`Chord`](/packages/chord) module.

#### Options

- `assumePerfectFifth`: assumes perfect fifth if no fifth is present

```js
detect(["D", "F", "C"], { assumePerfectFifth: true }); // => ["Dm7"]
detect(["D", "F", "C"], { assumePerfectFifth: false }); // => []
```

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