With ES6 import
:
import { Chord } from "tonal";
With ES5 require
:
const { Chord } = require("tonal");
Standalone:
import { detect } from "@tonaljs/chord-detect";
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.
assumePerfectFifth
: assumes perfect fifth if no fifth is present
detect(["D", "F", "C"], { assumePerfectFifth: true }); // => ["Dm7"]
detect(["D", "F", "C"], { assumePerfectFifth: false }); // => []