JSPM

  • Created
  • Published
  • Downloads 22
  • Score
    100M100P100Q68537F
  • License MIT

A dictionary of musical chords

Package Exports

  • @tonaljs/chord-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/chord-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/chord-dictionary tonal npm version

A dictionary of musical chords.

Usage

import { chordType } from "@tonaljs/chord-dictionary";
// or
const { chordType } = require("@tonaljs/chord-dictionary");

API

chordType(type: string) => ChordType

Given a chord type name, return a ChordType 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:

chordType("major"); // =>
// {
//   name: "major",
//   aliases: ["M", ""],
//   quality: "Major",
//   intervals: ["1P", "3M", "5P"],
//   num: 2192,
//   chroma: "100010010000",
//   length: 3
// });

entries() => ChordType[]

Return a list of all available chord types

FAQ

How do I get all triad chord names?

entries()
  .filter(type => type.intervals.length === 3)
  .map(n => name);

How do I know if a collection of notes is a known chord?

A poor's man version of chord detection (to be a more reliable chord detection, at least you have to check rotations of the notes)

import { pcset } from "@tonaljs/pcset";

const notes = ["C4", "f#3", ...]
chordType(pcset(notes).chroma).name