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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tktb-tess/xenharmonic-tool

v0.5.0

Published

Functions and data in Xenharmonic theory

Readme

xenharmonic-tool

Functions and data in Xenharmonic theory

Available in both browser and Node.js environments.

ESM only.

Usage

npm i @tktb-tess/xenharmonic-tool

You can also use via CDN such as jsDelivr.

<!-- You can import as a global variable ... -->
<script src="https://cdn.jsdelivr.net/npm/@tktb-tess/[email protected]/dist/bundle.min.js"></script>
<script type="module">
    const { Monzo } = XenTool;
</script>

<!-- ... or as an ES Module. -->
<script type="module">
    import { Monzo } from 'https://cdn.jsdelivr.net/npm/@tktb-tess/[email protected]/+esm';
</script>

Monzo

import { Monzo, getTemperOutEdos } from '@tktb-tess/xenharmonic-tool';

// create from array of [basis, exponent]
const marvelComma = new Monzo([
    [2, -5],
    [3, 2],
    [5, 2],
    [7, -1],
]);

// create from string form of `basis1:exponent1,basis2:exponent2,...`
const syntonicComma = Monzo.parse('2:-4,3:4,5:-1');

// if bases are omitted, they will be filled with prime numbers from 2 in ascending order.
// a following monzo is equal to the previous one.
const syntonicComma2 = Monzo.parse('-4,4,-1');

// gets some values
console.log(marvelComma.getCents()); // 7.711522991318361
console.log(marvelComma.getRatio()); // [225n, 224n]
console.log(marvelComma.getTenneyHeight()); // 15.62113611327464

console.log(marvelComma.toString()): // 2:-5,3:2,5:2,7:-1

// gets an array of EDOs whose patent val tempers out the monzos
console.log(getTemperOutEdos(100, marvelComma, syntonicComma)); // [12, 19, 31, 43, 50, 62, 74, 81, 93]

Val

import { Val, Monzo, isTemperedOut } from '@tktb-tess/xenharmonic-tool';

// create from array of [basis, exponent]
const sampleVal = new Val([
    [2, 12],
    [3, 19],
    [2, 28],
]);

// create from string form of `basis1;exponent1,basis2;exponent2,...`
const sampleVal2 = Val.parse('2;19,3;30,5;44,7;53');

// bases can be omitted, will be filled like the same as monzo
const sampleVal2 = Val.parse('19,30,44,53');

// creates 13-limit patent val for 22EDO
const patentValFor22Edo = Val.patentValFor(22, 13);

console.log(patentValFor22Edo.toString()): // 2;22,3;35,5;51,7;62,11;76,13;81

const marvelComma = Monzo.parse('-5,2,2,-1');

// whether or not the val tempers out the monzo
console.log(isTemperedOut(patentValFor22Edo, marvelComma)); // true