Music chords made easy:
var chord = require('music.chord')
var M9 = chord('1 3 5 7 9')
M9('D3') // => ['D3', 'F#3', 'A#3', 'C#4', 'E4']
var dom7 = chord('C E G Bb')
dom7('A4') // => ['A4', 'C#5', 'E5', 'G5']
This is part of music.kit.
Install via npm: npm i --save music.chord
or grab the distribution file in dist for browsers.
This is the simplest usage:
var chord = require('music.chord')
chord('1 3 5 7b 9', 'F2') // => ['F2', 'A2', 'C3', 'Eb3', 'G3']
You can partially apply the function:
var dom79 = chord('1 3 5 7b 9')
dom79('F2') // => ['F2', 'A2', 'C3', 'Eb3', 'G3']
Its important to note that all chord notes are ordered by pitch:
chord('1 3 5 7 2', 'C') // => ['C', 'D', 'E', 'G', 'B']
You can build from notes the same way (again, ordered notes):
var m7b5 = chord('C Eb Gb Bb')
m7b5('D4') // => ['D4', 'F4', 'Ab4', 'C5']
var maj7drop2 = chord('C2 E2 G1 B2')
maj7drop2('C4') // => [ 'G3', 'C4', 'E4', 'B4' ]
Set false
as tonic to get the chord intervals:
var chord('C E G B', false) // => ['1P', '3M', '5P', '7M']
See music.chords for a chord dictionary, music.scale for scales, or music.kit for the whole thing.
It's just one function
MIT License