d'accord is a focused JavaScript module designed for parsing complex music chord symbols, encompassing both Jazz and Classical notation standards. It accurately interprets a wide range of chords, from basic power chords like 'D#5' to sophisticated real book entries such as 'G7#5' and 'Dm7b5', or even intricate structures like 'Fsus4maj#11' or 'Cm13b5#9'. Crucially, d'accord only parses the chord suffix (the part without the root note) and returns an array of relative intervals (e.g., ['P1', 'm3', 'd5', 'm7']) rather than absolute notes. This design makes it a versatile tool for music theory applications, often used in conjunction with libraries like Teoria to construct full chords from a specified root note. The current stable version is 2.0.1. Release cadence is not explicitly stated but implies a steady maintenance, with major version updates indicating significant changes. Its key differentiator is its robust and forgiving parsing logic for a vast array of chord suffixes, specifically designed to output relative intervals for maximal flexibility in musical analysis and composition.
npm install daccordVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a chord symbol into relative intervals, combining it with Teoria to form absolute notes from a root, and includes robust error handling for invalid inputs.
To construct full chords with specific root notes, integrate d'accord with a music theory library like Teoria, using `teoria.note('C4').interval(intervalString)` to apply the parsed intervals to a chosen root.Implement explicit `try...catch` blocks around all calls to `daccord(chordstring)`. Check `error.name === 'ParseError'` within the catch block to handle parsing failures gracefully and extract relevant error information.
Always review the official changelog or release notes for d'accord when migrating between major versions (e.g., 1.x to 2.x) to understand specific breaking changes and necessary code adjustments.
Ensure that the `chordstring` argument is a valid musical chord suffix (e.g., 'maj7', 'm7b5', 'sus4'). Always wrap `daccord()` calls in a `try...catch` block to handle these expected parsing errors gracefully.
Verify that `teoria` is installed (`npm install teoria`), correctly imported (`import teoria from 'teoria';` or `const teoria = require('teoria');`), and that `root` is initialized using `teeria.note('C4')` (or another valid note string) before attempting to call `.interval()` on it.