{"id":13440659,"url":"https://github.com/tonaljs/tonal","last_synced_at":"2025-05-11T03:42:33.824Z","repository":{"id":38426900,"uuid":"39270393","full_name":"tonaljs/tonal","owner":"tonaljs","description":"A music theory library for Javascript","archived":false,"fork":false,"pushed_at":"2025-04-20T16:00:17.000Z","size":10615,"stargazers_count":3964,"open_issues_count":27,"forks_count":229,"subscribers_count":58,"default_branch":"main","last_synced_at":"2025-05-11T03:42:26.644Z","etag":null,"topics":["chord-progression","chords","functional","interval","javascript","key-signatures","music","music-theory","scale","transpose","typescript"],"latest_commit_sha":null,"homepage":"https://tonaljs.github.io/tonal/docs","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tonaljs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":"docs/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-07-17T18:55:18.000Z","updated_at":"2025-05-10T15:23:25.000Z","dependencies_parsed_at":"2023-02-12T03:01:33.661Z","dependency_job_id":"fa2098e3-ca40-4862-90f4-43552fcd68ae","html_url":"https://github.com/tonaljs/tonal","commit_stats":{"total_commits":995,"total_committers":60,"mean_commits":"16.583333333333332","dds":"0.12864321608040197","last_synced_commit":"c399b2317dc867e6398dd23bfda8057b7f3d6b24"},"previous_names":["danigb/tonal"],"tags_count":426,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonaljs%2Ftonal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonaljs%2Ftonal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonaljs%2Ftonal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonaljs%2Ftonal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tonaljs","download_url":"https://codeload.github.com/tonaljs/tonal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253514553,"owners_count":21920334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chord-progression","chords","functional","interval","javascript","key-signatures","music","music-theory","scale","transpose","typescript"],"created_at":"2024-07-31T03:01:24.867Z","updated_at":"2025-05-11T03:42:33.806Z","avatar_url":"https://github.com/tonaljs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","Music / Web Audio API"],"sub_categories":[],"readme":"# tonal\n\n[![npm version](https://img.shields.io/npm/v/tonal.svg?style=flat-square)](https://www.npmjs.com/package/tonal)\n\n`tonal` is a music theory library. Contains functions to manipulate tonal\nelements of music (note, intervals, chords, scales, modes, keys). It deals with\nabstractions (not actual music or sound).\n\n`tonal` is implemented in Typescript and published as a collection of Javascript\nnpm packages.\n\nIt uses a functional programming style: all functions are pure, there is no data\nmutation, and entities are represented by data structures instead of objects.\n\n## Example\n\n```js\nimport { Chord, Interval, Note, Scale } from \"tonal\";\n\nNote.midi(\"C4\"); // =\u003e 60\nNote.freq(\"a4\"); // =\u003e 440\nNote.accidentals(\"c#2\"); // =\u003e '#'\nNote.transpose(\"C4\", \"5P\"); // =\u003e \"G4\"\nInterval.semitones(\"5P\"); // =\u003e 7\nInterval.distance(\"C4\", \"G4\"); // =\u003e \"5P\"\n\n// Scales\nScale.get(\"C major\").notes; // =\u003e [\"C\", \"D\", \"E\", \"F\", \"G\", \"A\", \"B\"];\n[1, 3, 5, 7].map(Scale.degrees(\"C major\")); // =\u003e [\"C\", \"E\", \"G\", \"B\"]\n\nChord.get(\"Cmaj7\").name; // =\u003e \"C major seventh\"\n\n// Chord inversions\nconst triad = Chord.degrees(\"Cm\");\n[1, 2, 3].map(triad); // =\u003e [\"C\", \"Eb\", \"G\"];\n[2, 3, 1].map(triad); // =\u003e [\"Eb\", \"G\", \"C\"];\n[3, 1, 2].map(triad); // =\u003e [\"G\", \"C\", \"Eb\"];\n```\n\n## Install\n\nInstall all packages at once:\n\n```bash\nnpm install --save tonal\n```\n\nYou can read [CHANGELOG here](https://github.com/tonaljs/tonal/blob/main/docs/CHANGELOG.md).\n\n## Usage\n\nTonal is compatible with both ES5 and ES6 modules, and browser.\n\n#### ES6 `import`:\n\n```js\nimport { Note, Scale } from \"tonal\";\n```\n\n#### ES5 `require`:\n\n```js\nconst { Note, Scale } = require(\"tonal\");\n```\n\n#### Browser\n\nYou can use the browser version from jsdelivr CDN directly in your html:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/tonal/browser/tonal.min.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  console.log(Tonal.Key.minorKey(\"Ab\"));\n\u003c/script\u003e\n```\n\nOr if you prefer, grab the\n[minified browser ready version](https://raw.githubusercontent.com/tonaljs/tonal/master/packages/tonal/browser/tonal.min.js)\nfrom the repository.\n\n#### Bundle size\n\n`tonal` includes all published modules.\n\nAlthough the final bundle it is small, you can\nreduce bundle sizes even more by installing the modules individually, and\nimporting only the functions you need.\n\nNote that individual modules are prefixed with `@tonaljs/`. For example:\n\n```bash\nnpm i @tonaljs/note\n```\n\n```js\nimport { transpose } from \"@tonaljs/note\";\ntranspose(\"A4\", \"P5\");\n```\n\n## Documentation\n\nVisit the [documentation site](https://tonaljs.github.io/tonal/docs) or the README.md of each module 👇\n\n#### Notes and intervals\n\n- [@tonaljs/note](/packages/note): Note operations (simplify, transposeBy )\n- [@tonaljs/midi](/packages/midi): Midi number conversions\n- [@tonaljs/interval](/packages/interval): Interval operations (add, simplify,\n  invert)\n- [@tonaljs/abc-notation](/packages/abc-notation): Parse ABC\n  notation notes\n\n#### Scales and chords\n\n- [@tonaljs/scale](/packages/scale): Scales\n- [@tonaljs/scale-type](/packages/scale-type): A dictionary of scales\n- [@tonaljs/chord](/packages/chord): Chords\n- [@tonaljs/chord-type](/packages/chord-type): A dictionary of chords\n- [@tonaljs/chord-detect](/packages/chord-detect): Detect chords from notes\n- [@tonaljs/pcset](/packages/pcset): Pitch class sets. Compare note groups.\n\n#### Voicings\n\n- [@tonaljs/voicing](/packages/voicing/): Voicings and voice leadings for chords\n- [@tonaljs/voice-leading](/packages/voice-leading/): Voice leading logic for transitions between voicings\n- [@tonaljs/voicing-dictionary](/packages/voicing-dictionary/): Collections of chord voicings\n\n#### Keys, chord progressions\n\n- [@tonaljs/key](/packages/key): Major and minor keys, it's scales and chords\n- [@tonaljs/mode](/packages/mode): A dictionary of Greek modes (ionian,\n  dorian...)\n- [@tonaljs/progression](/packages/progression): Chord progressions\n- [@tonaljs/roman-numeral](/packages/roman-numeral): Parse roman numeral symbols\n\n#### Time, rhythm\n\n- [@tonaljs/rhythm-pattern](/packages/rhythm-pattern): Generate and manipulate rhythmic patterns\n- [@tonaljs/time-signature](/packages/time-signature): Parse time signatures\n- [@tonaljs/duration-value](/packages/duration-value): Note duration values\n\n#### Utilities\n\n- [@tonaljs/core](/packages/core): Core functions (note, interval, transpose and\n  distance)\n- [@tonaljs/collection](/packages/collection): Utility functions to work with\n  collections (range, shuffle, permutations)\n- [@tonaljs/range](/packages/range): Create note ranges\n\n## Contributing\n\nRead [contributing document](/docs/CONTRIBUTING.md). To contribute open a PR and ensure:\n\n- If is a music theory change (like the name of a scale) link to reliable references.\n- If is a new feature, add documentation: changes to README of the affected module(s) are expected.\n- Ad tests: changes to the test.ts file of the affected module(s) are expected.\n- All tests are green\n\n## Inspiration\n\nThis library takes inspiration from other music theory libraries:\n\n- Teoria: https://github.com/saebekassebil/teoria\n- Impro-Visor: https://www.cs.hmc.edu/~keller/jazz/improvisor/\n- MusicKit: https://github.com/benzguo/MusicKit\n- Music21: https://www.music21.org/music21docs/\n- Sharp11: https://github.com/jsrmath/sharp11\n- python-mingus: https://github.com/bspaans/python-mingus\n- Open Music Theory: https://viva.pressbooks.pub/openmusictheory/\n\n## Projects using tonal\n\nShowcase of projects that are using Tonal:\n\n- [Solfej](https://www.solfej.io/) by\n  [Shayan Javadi](https://github.com/ShayanJavadi)\n- [EarBeater](https://www.earbeater.com/online-ear-training/) by\n  [Morten Vestergaard](https://github.com/vellebelle)\n- [Sonid](https://sonid.app/)\n  ([play store](https://play.google.com/store/apps/details?id=org.stroopwafel.music.app),\n  [apple store](https://apps.apple.com/us/app/sonid/id1490221762?ls=1)) by\n  [martijnmichel](https://github.com/martijnmichel)\n- [Songcraft](https://songcraft.io/) by\n  [Gabe G'Sell](https://github.com/gabergg)\n- [React Guitar](https://react-guitar.com/) by\n  [4lejandrito](https://github.com/4lejandrito)\n- [Fretty.app](https://fretty.app/) by [tfeldmann](https://github.com/tfeldmann)\n- [Chordify](https://ashleymays.github.io/Chordify) by [ashleymays](https://github.com/ashleymays)\n- [Chordal](https://chordal.vercel.app) by [kad1kad](https://github.com/kad1kad)\n- [muted.io](https://muted.io/) by [thisisseb](https://github.com/thisisseb)\n- [Midi Sandbox](https://midisandbox.com/) by [jdlee022](https://github.com/jdlee022)\n- [music, eternal](https://eternal.rob.computer) by [kousun12](https://github.com/kousun12)\n- [Chromatone.center](https://chromatone.center) by [davay42](https://github.com/davay42)\n- [Super Oscillator](https://github.com/lukehorvat/super-oscillator) by [lukehorvat](https://github.com/lukehorvat)\n- [StringScales](https://stringscales.com/) by [Ambewas](https://github.com/ambewas)\n- [Polychron](https://github.com/PolychronMidi/Polychron) by [i1li](https://github.com/i1li)\n- [MusicTrainer](https://musictrainer.barnman.cc) by [zilongliu](https://github.com/Zilong-L)\n\nThank you all!\n\nAdd your project here by\n[editing this file](https://github.com/tonaljs/tonal/edit/main/README.md)\n\n## License\n\n[MIT License](docs/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonaljs%2Ftonal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftonaljs%2Ftonal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonaljs%2Ftonal/lists"}