@tonaljs/chord-detect
v4.9.0
Published
Detect chord name based on note names
Downloads
6,678
Maintainers
Readme
@tonaljs/chord-detect
Usage
With ES6 import
:
import { Chord } from "tonal";
With ES5 require
:
const { Chord } = require("tonal");
Standalone:
import { detect } from "@tonaljs/chord-detect";
API
Chord.detect(notes: string[], options?: { assumePerfectFifth?: boolean }) => string[]
Examples:
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
module.
Options
assumePerfectFifth
: assumes perfect fifth if no fifth is present
detect(["D", "F", "C"], { assumePerfectFifth: true }); // => ["Dm7"]
detect(["D", "F", "C"], { assumePerfectFifth: false }); // => []