{"id":13998172,"url":"https://github.com/twitchax/kord","last_synced_at":"2025-12-27T11:38:16.924Z","repository":{"id":64973752,"uuid":"572264481","full_name":"twitchax/kord","owner":"twitchax","description":"A music theory binary and library for Rust / JS.","archived":false,"fork":false,"pushed_at":"2025-12-22T17:41:07.000Z","size":105933,"stargazers_count":233,"open_issues_count":2,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-23T02:42:23.857Z","etag":null,"topics":["chords","intervals","jazz","music","rust","theory"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twitchax.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null},"funding":{"github":["twitchax"]}},"created_at":"2022-11-29T22:33:10.000Z","updated_at":"2025-12-09T07:05:49.000Z","dependencies_parsed_at":"2024-01-15T19:44:12.948Z","dependency_job_id":"901927e8-4a56-4a81-b9c3-e968de88c8bc","html_url":"https://github.com/twitchax/kord","commit_stats":{"total_commits":149,"total_committers":2,"mean_commits":74.5,"dds":0.03355704697986572,"last_synced_commit":"ef6172ba37ca9796c2843369d93693dc3d497845"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/twitchax/kord","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitchax%2Fkord","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitchax%2Fkord/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitchax%2Fkord/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitchax%2Fkord/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twitchax","download_url":"https://codeload.github.com/twitchax/kord/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twitchax%2Fkord/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28078063,"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","status":"online","status_checked_at":"2025-12-27T02:00:05.897Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["chords","intervals","jazz","music","rust","theory"],"created_at":"2024-08-09T19:01:26.631Z","updated_at":"2025-12-27T11:38:16.908Z","avatar_url":"https://github.com/twitchax.png","language":"Rust","funding_links":["https://github.com/sponsors/twitchax"],"categories":["Rust"],"sub_categories":[],"readme":"[![Build and Test](https://github.com/twitchax/kord/actions/workflows/build.yml/badge.svg)](https://github.com/twitchax/kord/actions/workflows/build.yml)\n[![codecov](https://codecov.io/gh/twitchax/kord/branch/main/graph/badge.svg?token=35MZN0YFZF)](https://codecov.io/gh/twitchax/kord)\n[![Version](https://img.shields.io/crates/v/kord.svg)](https://crates.io/crates/kord)\n[![Crates.io](https://img.shields.io/crates/d/kord?label=crate)](https://crates.io/crates/kord)\n[![GitHub all releases](https://img.shields.io/github/downloads/twitchax/kord/total?label=binary)](https://github.com/twitchax/kord/releases)\n[![npm](https://img.shields.io/npm/dt/kordweb?label=npm)](https://www.npmjs.com/package/kordweb)\n[![Documentation](https://docs.rs/kord/badge.svg)](https://docs.rs/kord)\n[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# kord\n\nA music theory binary and library for Rust / JS (via WASM) ([capability playground](https://kord.twitchax.com/)).\n\n\u003e **Note**: The [`kord-web`](kord-web/) directory contains a web application that serves as a demonstration and example of how to integrate the Kord library with modern web frameworks. It is not part of the core library but showcases the library's WASM capabilities in a real-world web application (and it is the example website linked above).\n\n## Binary Usage\n\n### Install\n\nWindows:\n\n```powershell\n$ iwr https://github.com/twitchax/kord/releases/latest/download/kord_x86_64-pc-windows-gnu.zip\n$ Expand-Archive kord_x86_64-pc-windows-gnu.zip -DestinationPath C:\\Users\\%USERNAME%\\AppData\\Local\\Programs\\kord\n```\n\nMac OS (Apple Silicon):\n\n```bash\n$ curl -LO https://github.com/twitchax/kord/releases/latest/download/kord_aarch64-apple-darwin.zip\n$ unzip kord_aarch64-apple-darwin.zip -d /usr/local/bin\n$ chmod a+x /usr/local/bin/kord\n```\n\nLinux:\n\n```bash\n$ curl -LO https://github.com/twitchax/kord/releases/latest/download/kord_x86_64-unknown-linux-gnu.zip\n$ unzip kord_x86_64-unknown-linux-gnu.zip -d /usr/local/bin\n$ chmod a+x /usr/local/bin/kord\n```\n\nCargo:\n\n```bash\n$ cargo install kord\n```\n\nNPM:\n\n```bash\n$ npm install --save kordweb\n```\n\n### Wasmer\n\nThis has a reduced capability set (no audio input / output), but works well for some of the core use cases.\n\n```bash\n$ wasmer install twitchax/kord\n```\n\nAlternatively, you can use `wasmer run`.\n\n```bash\n$ wasmer run twitchax/kord -- describe Am7\n```\n\n### Help Docs\n\n```bash\n$ kord -h\n\nA tool to easily explore music theory principles.\n\nUsage: kord.exe [COMMAND]\n\nCommands:\n  describe  Describes a chord\n  play      Describes and plays a chord\n  loop      Loops on a set of chord changes, while simultaneously outputting the descriptions\n  guess     Attempt to guess the chord from a set of notes (ordered by simplicity)\n  analyze   Set of commands to analyze audio data\n  ml        Set of commands to train and infer with ML\n  help      Print this message or the help of the given subcommand(s)\n\nOptions:\n  -h, --help     Print help information\n  -V, --version  Print version information\n```\n\n### Describe A Chord\n\n```bash\n$ kord describe Cmaj7\n\nCmaj7\n   major 7, ionian, first mode of major scale\n   C, D, E, F, G, A, B\n   C, E, G, B\n```\n\n### Play A Chord\n\n```bash\n$ kord play Bb7#9#11\n\nB♭7(♯9)(♯11)\n   dominant sharp 9, altered, altered dominant, super locrian, diminished whole tone, seventh mode of a melodic minor scale, melodic minor up a half step\n   B♭, C♭, D♭, E𝄫, F♭, G♭, A♭\n   B♭, D, F, A♭, C♯, E\n```\n\n### Loop Through Chord Changes\n\n```bash\n$ kord loop -b 120 \"Em7b5@3^2\" \"A7b13@3!\" \"D-maj7@3^2\" \"G7@3\" \"Cmaj7@3^2\"\n```\n\n### Guess A Chord\n\n```bash\n$ kord guess C F# D# A\nCdim\n   fully diminished (whole first), diminished seventh, whole/half/whole diminished\n   C, D, E♭, F, G♭, A♭, B𝄫, B\n   C, E♭, G♭, B𝄫\nCm(♭5)(add6)\n   minor\n   C, D, E♭, F, G, A♭, B♭\n   C, E♭, G♭, A\n```\n\n```bash\n$ kord guess C G Bb F#5 F\nC7(♯11)(sus4)\n   dominant sharp 11, lydian dominant, lyxian, major with sharp four and flat seven\n   C, D, E, F♯, G, A, B♭\n   C, F, G, B♭, F♯\nCm7(♯11)(sus4)\n   minor 7, dorian, second mode of major scale, major with flat third and flat seven\n   C, D, E♭, F, G, A, B♭\n   C, F, G, B♭, F♯\n```\n\n```bash\n$ kord guess E3 C4 Eb4 F#4 A#4 D5 D4\nCm9(♭5)(add2)/E\n   half diminished, locrian, minor seven flat five, seventh mode of major scale, major scale starting one half step up\n   C, D, E♭, F, G♭, A♭, B♭\n   E, C, D, E♭, G♭, B♭, D\n```\n\n### Guess Notes / Chord From Audio\n\nUsing the deterministic algorithm only:\n\n```bash\n$ kord analyze mic\n\nNotes: C3 E3 G3\nC@3\n   major\n   C, D, E, F, G, A, B\n   C, E, G\n```\n\nUsing the ML algorithm:\n\n```bash\n$ kord ml infer mic\n\nNotes: C3 E3 G3\nC@3\n   major\n   C, D, E, F, G, A, B\n   C, E, G\n```\n\n## Library Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nkord = \"*\" #choose a version\n```\n\n### Examples\n\n```rust\nuse klib::core::known_chord::KnownChord;\nuse klib::core::modifier::Degree;\nuse klib::core::note::*;\nuse klib::core::chord::*;\n\n// Check to see what _kind_ of chord this is.\nassert_eq!(Chord::new(C).augmented().seven().known_chord(), KnownChord::AugmentedDominant(Degree::Seven));\n```\n\n```rust\nuse klib::core::base::Parsable;\nuse klib::core::note::*;\nuse klib::core::chord::*;\n\n// Parse a chord from a string, and inspect the scale.\nassert_eq!(Chord::parse(\"Cm7b5\").unwrap().scale(), vec![C, D, EFlat, F, GFlat, AFlat, BFlat]);\n```\n\n```rust\nuse klib::core::note::*;\nuse klib::core::chord::*;\n\n// From a note, create a chord, and look at the chord tones.\nassert_eq!(C.into_chord().augmented().major7().chord(), vec![C, E, GSharp, B]);\n```\n\n## JS Usage\n\nThe npm package is available [here](https://www.npmjs.com/package/kordweb).\n\nFirst, load the module as you would any other ES module.\n\n```js\nimport init, { KordNote, KordChord } from 'kordweb/klib.js';\n\n// Run `init` once.\nawait init();\n```\n\nThen, you can use the library similarly as you would in Rust.\n\n```js\n// Create a note.\nconst note = KordNote.parse('C4');\n\nnote.name(); // C4\nnote.octave(); // 4\n\n// Create a chord.\nconst chord = KordChord.parse('C7#9');\n\nchord.name(); // C7(♯9)\nchord.chordString(); // C4 E4 G4 Bb5 D#5\n\n// Easy chaining.\nKordChord.parse('C7b9').withOctave(2).chord().map(n =\u003e n.name()); // [ 'C2', 'D♭2', 'E2', 'G2', 'B♭2' ]\n\n// Build chords.\nKordChord.parse('C').minor().seven().chord().map(n =\u003e n.name()); // [ 'C4', 'Eb4', 'G4', 'Bb4' ]\n```\n\n## Feature Flags\n\nThe library and binary both support various feature flags.  Of most important note are:\n* `default = [\"cli\", \"analyze\", \"audio\"]`\n* `cli`: enables the CLI features, and can be removed if only compiling the library.\n* `analyze = [\"analyze_mic\", \"analyze_file\"]`: enables the `analyze` subcommand, which allows for analyzing audio data (and the underlying library features).\n  * `analyze_mic`: enables the `analyze mic` subcommand, which allows for analyzing audio from a microphone (and the underlying library features).\n  * `analyze_file`: enables the `analyze file` subcommand, which allows for analyzing audio from a file (and the underlying library features).\n    * `analyze_file_mp3`: enables the features to analyze mp3 files.\n    * `analyze_file_aac`: enables the features to analyze aac files.\n    * `analyze_file_alac`: enables the features to analyze alac files.\n* `ml = [\"ml_train\", \"ml_infer\"]`: enables the `ml` subcommand, which allows for training and inferring with ML (and the underlying library features).\n  * `ml_train`: enables the `ml train` subcommand, which allows for training ML models (and the underlying library features).\n  * `ml_infer`: enables the `ml infer` subcommand, which allows for inferring with ML models (and the underlying library features).\n    * \u003e NOTE: Adding the `analyze_mic` feature flag will enable the `ml infer mic` subcommand, which allows for inferring with ML models from a microphone.\n    * \u003e NOTE: Adding the `analyze_file` feature flag will enable the `ml infer file` subcommand, which allows for inferring with ML models from a file.\n  * `ml_gpu`: enables the features to use a GPU for ML _training_.\n* `wasm`: enables the features to compile to wasm.\n* `plot`: enables the features to plot data.\n\n## Test\n\n```bash\ncargo test\n```\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitchax%2Fkord","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwitchax%2Fkord","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwitchax%2Fkord/lists"}