Skip to content

danigb/music.chord

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

music.chord

Build Status Code Climate js-standard-style npm version license distribution file music.kit

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

Install via npm: npm i --save music.chord or grab the distribution file in dist for browsers.

Usage

Build chords from intervals

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']

Build chord from notes

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' ]

Get chord intervals

Set false as tonic to get the chord intervals:

var chord('C E G B', false) // => ['1P', '3M', '5P', '7M']

More...

See music.chords for a chord dictionary, music.scale for scales, or music.kit for the whole thing.

Documentation

It's just one function

License

MIT License

About

Music chords made easy

Resources

License

Stars

Watchers

Forks

Packages

No packages published