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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@musodojo/music-theory-data

v32.0.0

Published

The musician-friendly TypeScript library for scales, modes, chords, and arpeggios.

Readme

Muso Dojo | Music Theory Data

A type-safe TypeScript/JavaScript library of music theory data and helpers for music apps, education tools, practice tools, and creative coding projects.

It includes typed datasets for notes, intervals, scales, modes, chord pitch collections, chord progressions, string instrument tunings, note colors, MIDI helpers, and naming utilities.

What's Included

  • Note collections: notes, dyads, scales, modes, arpeggios, and chord pitch collections, grouped into families such as diatonic modes, pentatonic variants, major/minor/dominant variants, harmonic minor modes, melodic minor modes, diminished variants, and augmented variants.
  • Chord progressions: 4-bar foundational loops, 8-bar loops, and 12-bar blues progressions with roman symbols, scale degrees, qualities, and bar durations.
  • Labels and theory primitives: note names, root notes, intervals, chromatic indexes, roman numerals, chord qualities, and conversion helpers.
  • Application helpers: note-name generation, interval transforms, chord progression resolution, chord spelling, MIDI helpers, note colors, contrast helpers, and string instrument tunings.
  • TypeScript-first API: exported data, utility functions, and types are designed to work well with autocomplete and compile-time checking.

For exhaustive data, types, and function signatures, use the JSR API documentation. The tests/ directory also contains practical examples of supported behavior.

Package Registries

Installation

Deno / JSR

deno add jsr:@musodojo/music-theory-data
import * as musicTheoryData from "jsr:@musodojo/music-theory-data";

Node.js / npm

npm install @musodojo/music-theory-data
import * as musicTheoryData from "@musodojo/music-theory-data";

Usage

Get Note Names

import * as musicTheoryData from "jsr:@musodojo/music-theory-data";

const aHarmonicMinor = musicTheoryData.getNoteNamesForRootAndNoteCollectionKey(
  "A",
  "harmonicMinor",
);

console.log(aHarmonicMinor);
// ["A", "B", "C", "D", "E", "F", "G♯", "A"]

const fMajor = musicTheoryData.getNoteNamesForRootAndNoteCollectionKey(
  "F",
  "ionian",
);

console.log(fMajor);
// ["F", "G", "A", "B♭", "C", "D", "E", "F"]

Inspect A Note Collection

import {
  groupedNoteCollections,
  noteCollections,
} from "jsr:@musodojo/music-theory-data";

const ionian = noteCollections.ionian;

console.log(ionian.primaryName);
// "Major"

console.log(ionian.intervals);
// ["1", "2", "3", "4", "5", "6", "7", "8"]

console.log(Object.keys(groupedNoteCollections));
// ["diatonicModes", "pentatonicVariants", ...]

Each collection includes structured fields such as names, intervals, integer notation, type tags, and musical characteristics. See the generated docs or source files for complete schemas.

Resolve Chord Progressions

import {
  chordProgressions,
  getChordProgressionChordNames,
  getChordProgressionRomanSymbols,
  getChordProgressionTotalDurationInBars,
} from "jsr:@musodojo/music-theory-data";

const oneSixFourFive = chordProgressions.oneSixFourFive;

console.log(oneSixFourFive.chords.map((chord) => chord.romanSymbol));
// ["I", "vi", "IV", "V"]

console.log(getChordProgressionRomanSymbols("oneSixFourFive"));
// ["I", "vi", "IV", "V"]

console.log(getChordProgressionChordNames("C", "oneSixFourFive"));
// ["CM", "Am", "FM", "GM"]

console.log(getChordProgressionTotalDurationInBars("twelveBarBlues"));
// 12

Use Note Colors And Chromatic Indexes

import {
  colorCollections,
  getNoteColorIndex,
  getNoteColorLabels,
} from "jsr:@musodojo/music-theory-data";

const absoluteIndex = getNoteColorIndex({
  midi: 67,
  mode: "absolute",
});

console.log(absoluteIndex);
// 7, the pitch class G

const relativeIndex = getNoteColorIndex({
  midi: 69,
  mode: "relative",
  rootPitchClass: 2,
});

console.log(relativeIndex);
// 7, A as the fifth above D

console.log(getNoteColorLabels(colorCollections.musoDojoRootAndFifth));
// ["1", "♭2", "2", "♭3", "3", "4", "♭5", "5", "♭6", "6", "♭7", "7"]

Note color collections use 12 chromatic slots. Absolute mode treats index 0 as C; relative mode treats index 0 as the chosen musical root.

API Documentation

For the full list of available data, types, and utility functions, see the auto-generated API documentation on JSR.

Community & Support