No description
  • HTML 93%
  • JavaScript 7%
Find a file
Frank Lý 8f862c8a86
feat: global denominator minimizer, raw-target prover, and enriched exports
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).
2026-05-12 23:03:37 +02:00
data feat: global denominator minimizer, raw-target prover, and enriched exports 2026-05-12 23:03:37 +02:00
lib feat: global denominator minimizer, raw-target prover, and enriched exports 2026-05-12 23:03:37 +02:00
scripts feat: global denominator minimizer, raw-target prover, and enriched exports 2026-05-12 23:03:37 +02:00
.gitignore feat: honest lattice-native chord prover with precalculated pools 2026-05-12 11:19:03 +02:00
.gitmodules feat: Mosaichord Extended Chord Calculator 2026-05-11 13:19:30 +02:00
Containerfile feat: global denominator minimizer, raw-target prover, and enriched exports 2026-05-12 23:03:37 +02:00
LICENSE Update README.md and add LICENSE 2026-05-12 20:53:41 +02:00
package.json feat: Mosaichord Extended Chord Calculator 2026-05-11 13:19:30 +02:00
README.md Update README.md and add LICENSE 2026-05-12 20:53:41 +02:00

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):

  1. Resolve each name to an abstract pattern (root, third quality, fifth quality, seventh quality).
  2. Convert the lower tetrad to absolute cent targets on the 12 EDO grid.
  3. Displace the upper tetrad by the pivot value.
  4. Merge the pitch sets and deduplicate octave-equivalent notes.
  5. For each resulting degree, query all 7-limit rational neighbours within ±50 cents.
  6. Enumerate every feasible common denominator D bounded by the prime exponents present in the candidate pools.
  7. For each D, select the cheapest valid candidate per degree (smallest scaled integer).
  8. 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].
  9. Validate: every proved ratio must land in its claimed degree category.
  10. 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-utils by Matthew Yacavone
  • Instrument: Seven Limit Mosaichord by Jim Snowe