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

camelot-wheel

v0.2.3

Published

A package to help with logic regarding the camelot wheel / circle of fifths

Downloads

11

Readme

Camelot-Wheel npm downloads npm version Build Status

A package to allow for easy use of logic related the Circle of Fifths or 'Camelot Wheel'.

The Circle of Fifths shows the relationships among the twelve tones of the Chromatic Scale, their corresponding key signatures and the associated Major and Minor keys.

In lay terms: The Circle of Fifths is a music theory diagram for finding the key of a song, transposing songs to different keys, composing new songs and understanding key signatures, scales, and modes.

Usage

Install

npm i camelot-wheel

The Camelot Wheel

camelot-wheel

Now what is going on here?

  • Each number represents a key as stated above.
  • The outside of the wheel represents the Major mode and the inside of the wheel represents the Minor mode.
  • A track's key is considered compatible with another if it's positioned next to it or opposite it.
  • For example the key of C (8B) is compatible with F (7B), G (9B) and Am (8A)

API

  • getKey
  • getHarmonicKeys
  • getCamelotRoute

getKey(args)

This function will return all details about the key in question. You can pass it a key name, or the camelot position (with mode) or the pitch class (with mode)

import { getKey } from "camelot-wheel";

getKey({ name: "B" }); // ==> { name: "B", pitchClass: 11, mode: 1, camelotPosition: 1 }
import { getKey } from "camelot-wheel";

getKey({ pitchClass: 0, mode: 1 }); // ==> { name: "C", pitchClass: 0, mode: 1, camelotPosition: 8 }
import { getKey } from "camelot-wheel";

getKey({ camelotPosition: 8, mode: 1 }); // => { name: "C", pitchClass: 0, mode: 1, camelotPosition: 8 }

getHarmonicKeys

import { getHarmonicKeys } from "camelot-wheel";

getHarmonicKeys({ pitchClass: 0, mode: 1 });
// =>    [
//         { camelotPosition: 8, mode: 1, name: "C", pitchClass: 0 },
//         { camelotPosition: 7, mode: 1, name: "F", pitchClass: 5 },
//         { camelotPosition: 9, mode: 1, name: "G", pitchClass: 7 },
//         { camelotPosition: 8, mode: 0, name: "Am", pitchClass: 9 }
//       ]
import { getHarmonicKeys } from "camelot-wheel";

getHarmonicKeys({ name: "C" });
// =>    [
//         { camelotPosition: 8, mode: 1, name: "C", pitchClass: 0 },
//         { camelotPosition: 7, mode: 1, name: "F", pitchClass: 5 },
//         { camelotPosition: 9, mode: 1, name: "G", pitchClass: 7 },
//         { camelotPosition: 8, mode: 0, name: "Am", pitchClass: 9 }
//       ]
import { getHarmonicKeys } from "camelot-wheel";

getHarmonicKeys({ camelotPosition: 8, mode: 1 });
// =>    [
//         { camelotPosition: 8, mode: 1, name: "C", pitchClass: 0 },
//         { camelotPosition: 7, mode: 1, name: "F", pitchClass: 5 },
//         { camelotPosition: 9, mode: 1, name: "G", pitchClass: 7 },
//         { camelotPosition: 8, mode: 0, name: "Am", pitchClass: 9 }
//       ]

getCamelotRoute(startKey, targetKey)

This function will navigate you from the startKey to the endKey as quickly as possible.

import { getCamelotRoute } from "camelot-wheel";

getCamelotRoute({ pitchClass: 5, mode: 1 }, { pitchClass: 9, mode: 1 });
// => [
//      { name: "C", pitchClass: 0, mode: 1, camelotPosition: 8 },
//      { name: "G", pitchClass: 7, mode: 1, camelotPosition: 9 },
//      { name: "D", pitchClass: 2, mode: 1, camelotPosition: 10 }
//    ]
import { getCamelotRoute } from "camelot-wheel";

getCamelotRoute(
  { camelotPosition: 7, mode: 1 },
  { camelotPosition: 11, mode: 1 }
);
// => [
//      { name: "C", pitchClass: 0, mode: 1, camelotPosition: 8 },
//      { name: "G", pitchClass: 7, mode: 1, camelotPosition: 9 },
//      { name: "D", pitchClass: 2, mode: 1, camelotPosition: 10 }
//    ]
import { getCamelotRoute } from "camelot-wheel";

getCamelotRoute({ name: "F" }, { name: "A" });
// => [
//      { name: "C", pitchClass: 0, mode: 1, camelotPosition: 8 },
//      { name: "G", pitchClass: 7, mode: 1, camelotPosition: 9 },
//      { name: "D", pitchClass: 2, mode: 1, camelotPosition: 10 }
//    ]
import { getCamelotRoute } from "camelot-wheel";

getCamelotRoute({ name: "F" }, { camelotPosition: 11, mode: 1 });
// => [
//      { name: "C", pitchClass: 0, mode: 1, camelotPosition: 8 },
//      { name: "G", pitchClass: 7, mode: 1, camelotPosition: 9 },
//      { name: "D", pitchClass: 2, mode: 1, camelotPosition: 10 }
//    ]

Run the Tests

npm test