{"_id":"@amplib/music-theory","name":"@amplib/music-theory","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@amplib/music-theory","description":"Chromatic musical scale generator.","version":"0.1.0","main":"dist/index.js","types":"dist/index.d.ts","publishConfig":{"access":"public"},"homepage":"https://amplib.app/music-theory","repository":{"type":"git","url":"git+https://github.com/another-machine/public-library.git","directory":"packages/amplib-music-theory"},"tsup":{"entry":["src/index.ts"],"clean":true,"dts":true,"format":"esm","minify":false,"sourcemap":true,"splitting":false},"scripts":{"build":"tsup","watch":"tsup --watch","test":"tsx test/run.ts","prepack":"npm run build"},"author":{"name":"Another Machine"},"license":"Apache-2.0","type":"module","devDependencies":{"tsx":"^4.19.2"},"_id":"@amplib/music-theory@0.1.0","gitHead":"12d2a635a582bea9ae238081cadb15924fd5ffac","bugs":{"url":"https://github.com/another-machine/public-library/issues"},"_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-tl0PkCIzzKBInBuE3Z8cAz7AIR4MWFX9paqJn4XULORWpZh599DiSbrw/nv2EvzE/+XVmwI+zNLzRuT0VGqvuw==","shasum":"388c7e738e195436fe1d73ab3f779aaf37601e0a","tarball":"https://registry.npmjs.org/@amplib/music-theory/-/music-theory-0.1.0.tgz","fileCount":6,"unpackedSize":72128,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCFXQoi/XV2QbyJX9UbFSU38AZuTKM7t6FArug8xz+MFgIgbiROA71dLKD0B2VhzqnVlmyZgpp15PqKlB0so3X9UB0="}]},"_npmUser":{"name":"jakealbaugh","email":"jake.albaugh@gmail.com"},"directories":{},"maintainers":[{"name":"jakealbaugh","email":"jake.albaugh@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/music-theory_0.1.0_1785526829654_0.39254866563508983"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-31T19:40:29.459Z","0.1.0":"2026-07-31T19:40:29.809Z","modified":"2026-07-31T19:40:30.056Z"},"maintainers":[{"name":"jakealbaugh","email":"jake.albaugh@gmail.com"}],"description":"Chromatic musical scale generator.","homepage":"https://amplib.app/music-theory","repository":{"type":"git","url":"git+https://github.com/another-machine/public-library.git","directory":"packages/amplib-music-theory"},"author":{"name":"Another Machine"},"bugs":{"url":"https://github.com/another-machine/public-library/issues"},"license":"Apache-2.0","readme":"# @amplib/music-theory\n\nChromatic scales, modes, intervals and chords, as plain objects you can read.\n\n```ts\nimport { Scale, Mode, Note, parseChord } from \"@amplib/music-theory\";\n\nconst scale = new Scale({ root: \"C\", mode: \"minor\" });\n\nscale.label; // \"C Aeolian\" — the vanity mode resolves to the mode it means\nscale.noteIds; // [\"C0\", \"D0\", \"D#0\", \"F0\", \"G0\", \"G#0\", \"A#0\", \"C1\", …]\nscale.intervals; // the 7 intervals, each with label, notation and meta\n\nMode.types; // ionian … locrian, plus melodic, harmonic, major, minor\nNote.notationsUnique; // the 12 sharps and the 5 flats that alias them\n```\n\n`parseChord` goes the other way, from written notes to a recognised quality:\n\n```ts\nconst parsed = parseChord(\"CEG\");\n\nparsed.pitchClasses; // [0, 4, 7]\nparsed.notations; // [\"C\", \"E\", \"G\"]\nparsed.chord?.label; // \"C\"\n```\n\nOrigin [ja-k-e/musical-scale](https://github.com/ja-k-e/musical-scale).\n\n## Modules\n\n| Module       | Description                                                             |\n| ------------ | ----------------------------------------------------------------------- |\n| `Scale`      | A root plus a mode, expanded into intervals and playable note ids        |\n| `Mode`       | The seven church modes, plus melodic and harmonic minor                  |\n| `Note`       | Pitch classes and their notations, sharp and flat                        |\n| `Interval`   | One scale degree — its quality, notation and metadata                    |\n| `Chord`      | A triad or seventh, named by quality                                     |\n| `parseChord` | Written notes (`\"CEG\"`) → pitch classes, notations and a matching chord  |\n\n## Design\n\n**Vanity modes are inputs, not a separate concept.** `Scale` accepts `\"major\"`\nand `\"minor\"` alongside the seven mode names, and resolves them — asking for\n`\"minor\"` gives you a scale that labels itself `\"C Aeolian\"`. Callers get to use\nthe word people actually say without the library carrying two parallel notions\nof what a mode is.\n\n**Chords are recognised, not assumed.** `parseChord` accepts any set of notes,\nincluding one or two, and only sets `chord` when they form a triad or a seventh.\nMost inputs do not, so `parsed.chord` is optional by design rather than as a\nfailure case. Duplicates collapse to their first occurrence, which makes order\nmeaningful: the first note written is the root.\n\n**Flats are aliases, not separate notes.** `Note` has 12 pitch classes; the five\nflat spellings resolve onto the sharps they share. `notationsUnique` lists all\n17 names, so a UI can offer `Eb` while the scale still works in one chromatic\nspace.\n","readmeFilename":"README.md","_rev":"1-515eb81983867cecc3a050a2693afb0b"}