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

guitar-chord-sequence

v1.3.12

Published

A javascript library for working with guitar chord sequences, built for the capo.guru project

Downloads

2

Readme

guitar-chord-sequence

This is a very small Javascript library for working with chord sequences on the guitar. It was built exclusively for the capo.guru project, and therefore might not be that suitable for other projects. Nevertheless, here is an overview:

Installation

npm install guitar-chord-sequence --save or yarn add guitar-chord-sequence

Usage

The module's public interface provides two classes: Sequence and SequenceError. A sequence must be instantiated with a chord progression, represented as an array of objects. The chord objects are very simple objects with two properties: 'root' and 'type'; the 'root' must be a valid note (e.g. 'A', 'C#', 'Eb') and the 'type' must be one of the following types of chord: 'maj', 'min', '7', 'min7', 'maj7' (more will be added at a later date). The roots of the chords are then converted by the class and have a 'num' property instead of the 'root' property (e.g. 'A' becomes 0, 'D' becomes 5), they are converted back when the Sequence object is coerced to a string and when the possible keys of the sequence are returned. If there is a problem with the chord array a SequenceError with be thrown.

let sequence = new Sequence([{root: 'A', type: 'maj'}, {root: 'F#', type: 'min'}]);

The Sequence instance has several available methods:

  • sequence.fullChords() will return an array of objects containing num, root, type and string properties to represent each chord
  • sequence.addChord({root: 'A', type: 'maj'}) will return a new Sequence object with a chord added to the end of the sequence
  • sequence.removeChord({root: 'A', type: 'maj'}) will return a new Sequence object with all instances of that chord removed from the sequence
  • sequence.removeChordByIndex(1) will return a new Sequence object with the chord at the chosen index removed of the sequence
  • sequence.transpose(5) will return a new Sequence object, with a transposition applied of the specified number of semitones (any positive or negative integer is valid)
  • sequence.containsChord({root: 'A', type: 'maj'}) will return true/false depending on whether the specified chord can be found in the sequence
  • sequence.containsEveryChord([{root: 'A', type: 'maj'}, {root: 'F#', type: 'min'}]) will return true if every chord in the specified sequence can be found within the initial sequence, and false if not
  • sequence.isOpen() will return true if the sequence can be played entirely with open chords, there is an optional argument of another chord sequence to specify which chords are considered 'open'. The library's default list does not include Fmajor or Bminor, for example, and these might be required
  • sequence.findOpenPositions() will return an array of frets on which the position could be played using open chords if a capo were placed there. Also takes an optional argument of 'open' chords
  • sequence.findKeys() will return an array of possible keys to which the chord sequence could belong

The sequence can also be iterated like an array and will return the chord names as strings:

for (let chord of sequence) {
    console.log(chord);
}

Tests

Tests can be run using the npm test or yarn test commands.