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

tonus

v0.12.0

Published

Medieval music analysis: GABC plainchant exports, liturgical calendar, tuning systems, ephemeris, and the harmony of the spheres

Readme

tonus

tonus is a JavaScript library for medieval music theory and chant analysis. It carries the Gregorian repertoire and the concepts it was built on.

It tunes to scales medieval singers would have used, tells you which chants belong to which day and returns analysis and notation, and calculates the music of the spheres proposed by Pythagoras, Boethius, and more as real intervals.

Interactive demo

Everything is computed locally and deterministically: the same question always returns the same answer, from data that ships inside the package, with no network calls and no runtime dependencies.

npm install tonus
import tonus from "tonus";

// Build a tuning: Pythagorean, set to mode 1.
const t = tonus.temperamentum({ mode: 1 });
t.nota("D4"); // 293.33 Hz, the final of mode 1, through pure fifths
t.gradus("D4"); // "Delasolre": RE of the natural hexachord, the finalis

// Ask the calendar for a day, then pull the chant that belongs to it.
const [feast] = tonus.festum({ date: new Date("2026-12-25") });
// → "In Nativitate Domini", a Duplex I classis feast of Christmastide
const [introit] = tonus.proprium({ feast, office: "in" });
// → "Puer natus est", mode 7, from the Liber Usualis

// Turn the chant into tuned, rhythmicized notes, then draw it.
const score = tonus.notatio(introit, { temperamentum: t });
const { svg, geometry } = tonus.inscriptio(score, { width: 680 });

// And voice the Christmas sky as pitch, after Boethius.
const harmony = tonus.harmonia(tonus.caelum({ date: feast.date }));

The objects each call returns (feast, t) pass straight back into the next as filters.

The API

Fourteen methods, each named for what it returns.

| Method | Returns | | ----------------------------- | ----------------------------------------------------------------- | | festum({ date }) | the feasts of a day, with rank, grade, and season | | pascha(year) | Easter and the movable feasts reckoned from it | | cantus({ … }) | chants by id, incipit, mode, office, or source | | proprium({ feast, office }) | the Mass propers for a feast | | ordinarium({ … }) | the Kyriale — the Mass ordinary settings | | officium({ feast, hora }) | an Office hour, psalms and antiphons in order | | psalmus({ psalm }) | a psalm, pointed for its tone | | corpus() | what ships: counts by book, genus, and mode | | census({ id }) | one chant measured against the corpus | | temperamentum({ … }) | a tuning — nota, gradus, modus, intervallum | | notatio(chant) | GABC parsed to phrases, syllables, and tuned notes | | inscriptio(score) | { svg, geometry } — the score drawn, and where each note landed | | caelum({ date }) | the classical planets at a moment | | harmonia(caelum) | those positions voiced as pitch |

Tuning covers Pythagorean and meantone temperaments, just intonation and custom scales, the Guidonian gamut and hand, hexachords and their mutations, and intervals named as the treatises name them. Each of the eight modes carries its final, dominant, ambitus, and ethos, with its psalm tones.

The calendar is Tridentine, resolved against Easter by the Julian or the Gregorian computus.

The repertoire is 7,825 chants across seven books, six Solesmes editions and the Nocturnale Romanum night office in GABC notation: Mass propers, the Kyriale, the Office hours, the psalter, and the Matins nocturns.

Scores are shaped by the Solesmes arsis/thesis rhythm, fingerprinted for melodic character, and drawn to a square-note or modern staff.

Concepts

Boethius treated music as a branch of number theory, and divided it into the audible and the inaudible: instruments and voices, body and soul, the turning cosmos. Chant was composed inside that frame: pitch was ratio, the modes a received order, the heavens harmonic proportion. tonus takes those claims literally enough to compute them, which is why tuning is ratio arithmetic, why the calendar is a retrieval index, and why there is an ephemeris in a chant library at all.

Where the sources run out or contradict one another, tonus makes an editorial call and records it in the code.

Documentation

The documentation index is the technical center: the full API, the conventions, the error contract, and the code standards. From there, one page per engine, in dependency order: tuning, calendar, chant, score, heavens, and census.

Install and run

ESM only. Node ≥ 20; works in the browser through a bundler. No runtime dependencies. The chants and the 650-entry calendar ship in the package.

npm test          # builds and runs the suite (node --test)

The data files in src/data/ are generated by a separate extraction pipeline (tonus-corpus). Edits happen there, not here.

Sources

The chant and calendar data are the Solesmes editions, by way of GregoBase, Divinum Officium, and the community Nocturnale Romanum. The notation is engraved in Daniel Spreadbury's Bravura, the reference font for the SMuFL standard. Behind the rest stand Mocquereau and Suñol on rhythm, Rockstro and Apel on the modes, Boethius and Ptolemy on tuning, and Godwin on the Pythagorean planets.

Every figure is cited in the code beside what it explains, and BIBLIOGRAPHY.md is the complete list.

License

PolyForm Noncommercial 1.0.0: free to use, study, modify, and share for any noncommercial purpose — personal projects, research, education, art, religious observance. Commercial use requires permission from the author. Versions through 0.1.x were published under MIT and remain so. Chant and liturgical data derive from GregoBase and Divinum Officium; see BIBLIOGRAPHY.md for full attribution.