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

sharp11

v2.0.2

Published

Music theory multitool with a jazz focus

Downloads

53

Readme

Sharp11

Music theory multitool with a jazz focus

Introduction

Sharp11 is an npm module for performing music theory operations, ranging from simple things like transposing a note to complicated things like generating an ordered list of scales that can be played over a given chord. I also built an interactive web front-end to showcase the features of Sharp11, which I encourage you to play around with.

So what can Sharp11 do?

Sharp11 contains several modules for manipulating everything from notes and durations to entire corpora of jazz charts. A full list of Sharp11 modules and what they can do is available in the docs. With the exception of the MIDI output option, everything in the core Sharp11 library deals purely with Sharp11 objects. For audio output, check out the sharp11-web-audio library.

Sharp11 Ecosystem

The main Sharp11 library can be thought of as the core module of a larger comptuer music ecosystem. Other libraries in this ecosystem include sharp11-improv, a tool for generating improvisations over jazz chord changes, and sharp11-jza, a probabilistic automaton model for jazz harmony. The latter makes use of the iRb corpus, a corpus of over a thousand jazz standards that can be loaded into Sharp11 by installing the sharp11-irb library.

Mutability

Methods in Sharp11 do not mutate objects, but instead return new ones. I feel that in music, a C4 should be a C4, not a reference to an object that might become a D4 at some point. The same goes for chords, scales, and every other use case I've come across. There's nothing stopping you from mutating objects in Sharp11, but if you plan to extend any Sharp11 APIs or build anything on top of Sharp11, please try to abide by this rule.

Install

npm install sharp11

API Documentation

Read the full Sharp11 API documentation here.

Example Music Theory Operations

var s11 = require('sharp11');

Transposing a note:

s11.note.create('Ab').transpose('P4'); // Db
s11.note.create('Ab').transposeDown('P4'); // Eb
s11.note.create('Ab3').transpose('P4'); // Db4

Finding the interval between two notes:

s11.note.create('C').getInterval('F#'); // aug4
s11.note.create('F').getInterval('Abb'); // dim3

Parsing a chord symbol:

s11.chord.create('G'); // G B D
s11.chord.create('Am7b5'); // A C Eb G
s11.chord.create('Cmaj7/B'); // B C E G
s11.chord.create('F/G'); // G F A C
s11.chord.create('CmM9#11'); // C Eb G B D F#

Identifying a chord:

s11.chord.identify('C', 'Eb', 'G', 'A'); // Cm6
s11.chord.identify('A', 'C', 'Eb', 'F'); // F7/A
s11.chord.identify('G', 'B', 'D#', 'F', 'A#'); // G7#5#9
s11.chord.identify('F#', 'C', 'Eb', 'G', 'B', 'D'); // CmM9#11/F#

Working with scales

s11.scale.create('C', 'major'); // C D E F G A B
s11.scale.create('G', 'altered'); // G Ab Bb Cb Db Eb F
s11.scale.create('F', 'melodic minor').descending(); // [F, Eb, Db, C, Bb, Ab, G]
s11.scale.create('C', 'major').transpose('m3'); // Eb F G Ab Bb C D
s11.scale.create('C', 'major').contains('F'); // true