dac

daccord

Forgiving music chord parser

Showing:

Popularity

Downloads/wk

23

GitHub Stars

11

Maintenance

Last Commit

6yrs ago

Contributors

0

Package

Dependencies

1

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

d'accord

D'accord, je vais analyser vos accords

A simple module for parsing chord symbols, both Jazz and Classical. Parses correctly everything from simple power chords (D#5) to chords you'll often find in the real book (G7#5, Dm7b5) to crazy chords like Fsus4maj#11 or Cm13b5#9.

Note that this module only parses the chord symbol (that is the part of the chord string that does not include the root, and thus returns relative intervals from which the chord can be constructed with any root.

example

var daccord = require('daccord');

daccord('m7b5') // -> ['P1', 'm3', 'd5', 'm7']

daccord('maj7') // -> ['P1', 'M3', 'P5', 'M7']

You can use d'accord in combination with teoria. Although at the moment teoria includes this functionality itself this will hopefully get lifted out of teoria into more focused, smaller modules. But for now, here's a practical example

var daccord = require('daccord');
var teoria = require('teoria');

// Create the root note
var root = teoria.note('C4');

// Get all the intervals (including the tonic) of a m(maj7) chord, and map them
// into notes relative to the root, C4
daccord('m(maj7)').map(root.interval.bind(root)).toString() === 'c4,eb4,g4,b4';

usage

var daccord = require('daccord');

daccord(chordstring)

Return an array of intervals (including the tonic, that is P1), which constitutes the full chord, with all implied intervals.

If a chordstring is unparsable, an error will be thrown with details:

// ParseError:
{
  message: String,  // The full error message
  title: String,    // The error title
  token: String,    // The erronous token
  index: Number     // The index of the token in the chordstring
}

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial