- HTML 93%
- JavaScript 7%
Replace evalCombo() and recursive sp() DFS with exhaustive common- denominator enumerator in lib/prover.js. For each feasible D bounded by pool prime exponents, select cheapest valid candidate per degree (smallest scaled integer); lowest sum wins. Removes maxCandidates cap. Add proveTargets() to lib/prover.js for arbitrary degree arrays, enabling altered-chord proofs outside the 36-name tetrad system. Create scripts/prove-targets.js as CLI entrypoint. Update scripts/enumerate.js to output ratios and cents per entry. Update scripts/filter.js to display enriched fields. Update Containerfile to run npm audit fix for reduced build noise. Verification: 1333 heptads, 1896 hexads, 624 pentads, 0 failed, all lattice-fit. Dominant 13th now resolves to 8:10:12:14:18:21:27 (score 110) instead of 12:15:18:21:27:32:40 (score 165). |
||
|---|---|---|
| data | ||
| lib | ||
| scripts | ||
| .gitignore | ||
| .gitmodules | ||
| Containerfile | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
Mosaichord Chord Calculator
A command-line utility that proves whether extended 9th, 11th, and 13th chords can be built within the 77-note 7-limit just intonation lattice of the Mosaichord, starting from the proven 36 tetrad presets. Every ratio is derived from scratch via exact 7-limit rational approximation; no hand-made preset table is trusted.
Purpose
The Seven Limit Mosaichord generates 77 notes per octave from
2^a · 3^b · 5^c · 7^d (chain-of-fifths spine multiplied by eleven prime-5,7 color modifiers).
Its existing web app, the Mosaichord Explorer, ranks 70,300 tetrads by Sethares dissonance and exposes 36 named seventh-chord presets.
This calculator answers the question: Which 9th, 11th, and 13th chords can be voiced by combining those 36 tetrads, and do any require new lattice rows?
Architecture
lib/
definitions.js — Chord-name vocabulary (36 presets + recovered 26♭5)
targets.js — Degree category ↔ cent targets for first & second octaves
prover.js — Core algorithm: pivot, merge, global denominator minimizer, LCD proof
lattice.js — 77-note scale membership oracle (2^a·3^b·5^c·7^d enumeration)
scripts/
enumerate.js — Batch proof of all 36×36×3 = 3,888 combinations
filter.js — Musical query: select extended chords by tension content
dissonance.js — Sethares roughness scoring for the full catalog
gap-analysis.js — Check which 12 EDO extended targets are missing entirely
export-to-explorer.js — Convert proved ratios to JSON for the web app
data/ — Output directory for catalogs and reports
Principle of Operation
The calculator accepts two chord names and a pivot degree (3rd, 5th, or 7th):
- Resolve each name to an abstract pattern (root, third quality, fifth quality, seventh quality).
- Convert the lower tetrad to absolute cent targets on the 12 EDO grid.
- Displace the upper tetrad by the pivot value.
- Merge the pitch sets and deduplicate octave-equivalent notes.
- For each resulting degree, query all 7-limit rational neighbours within ±50 cents.
- Enumerate every feasible common denominator D bounded by the prime exponents present in the candidate pools.
- For each D, select the cheapest valid candidate per degree (smallest scaled integer).
- Score by the sum of scaled integers; the lowest score wins. This global search resolves the Tenney/Brute-Force Duality, finding mathematically simpler LCDs (e.g. Dominant 13th = 8:10:12:14:18:21:27, not 12:15:18:21:27:32:40) [1].
- Validate: every proved ratio must land in its claimed degree category.
- Check lattice membership: does the chord fit on the current 77-note keyboard?
The root is always locked to 1/1. No precomputed ratio table is consulted.
Results (as of 2026-05-12)
From 36 names × 36 names × 3 pivots = 3,888 stackings:
| Cardinality | Count | Lattice-fit |
|---|---|---|
| Heptads (13th-class, 7 notes) | 1,333 | 1,333 |
| Hexads (11th-class, 6 notes) | 1,896 | 1,896 |
| Pentads (9th-class, 5 notes) | 624 | 624 |
| Collapsed (< 5 notes) | 35 | — |
| Failed (no valid candidates) | 0 | — |
Gap analysis: Zero structurally valid extended chord targets are missing from the catalog. No additional rows are needed to express any of the checked 9th/11th/13th voicings.
Discovery: The original 36 tetrad list omitted 26♭5 (sus2, flat5, major6th). Its claimed ratio 6:7:8:10 was incorrect (7/6 is a minor third, not a suspended second). The calculator now includes the corrected entry.
Build
This project uses microtonal-utils as a git submodule for exact interval arithmetic.
git submodule update --init --recursive
podman build -t mosaichord-chord-calculator:latest .
Usage
# Batch enumeration (proves all 3,888 combinations, ~3.2 s)
podman run --rm -v $(pwd)/data:/app/data:Z mosaichord-chord-calculator:latest node scripts/enumerate.js
# Gap analysis
podman run --rm -v $(pwd)/data:/app/data:Z mosaichord-chord-calculator:latest node scripts/gap-analysis.js
# Filter heptads containing sharp9 and major13
podman run --rm -v $(pwd)/data:/app/data:Z mosaichord-chord-calculator:latest node scripts/filter.js --degrees sharp9,major13 --class heptad
# Score and rank by Sethares dissonance
podman run --rm -v $(pwd)/data:/app/data:Z mosaichord-chord-calculator:latest node scripts/dissonance.js
# Export for the Mosaichord Explorer web app
podman run --rm -v $(pwd)/data:/app/data:Z mosaichord-chord-calculator:latest node scripts/export-to-explorer.js
Integration
scripts/export-to-explorer.js produces heptads.json, hexads.json, and pentads.json. These are consumed by the Mosaichord Explorer's preset loader. Copy them into the Explorer's data/ directory and include them in its container build.
License
All original code in this repository is written from scratch and is licensed CC0-1.0. The microtonal-utils submodule is by Matthew Yacavone (MIT-style, via xen-calc). The Mosaichord is an instrument by Jim Snowe / Desiderata Systems.
Credits
- Calculator design and 36-name chord system: Frank Lý
- Rational approximation engine:
microtonal-utilsby Matthew Yacavone - Instrument: Seven Limit Mosaichord by Jim Snowe