npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

daccord

v2.0.1

Published

Forgiving music chord parser

Downloads

1,086

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
}