{"id":13768316,"url":"https://github.com/stevekinney/octavian","last_synced_at":"2025-07-30T06:16:51.400Z","repository":{"id":31134457,"uuid":"34694161","full_name":"stevekinney/octavian","owner":"stevekinney","description":"Utilities for reasoning about musical notes, frequencies, and intervals","archived":false,"fork":false,"pushed_at":"2022-01-22T02:13:19.000Z","size":69,"stargazers_count":179,"open_issues_count":0,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-03T17:17:48.774Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/stevekinney.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-27T22:17:33.000Z","updated_at":"2025-05-03T07:11:30.000Z","dependencies_parsed_at":"2022-09-08T19:22:39.072Z","dependency_job_id":null,"html_url":"https://github.com/stevekinney/octavian","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevekinney%2Foctavian","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevekinney%2Foctavian/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevekinney%2Foctavian/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stevekinney%2Foctavian/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stevekinney","download_url":"https://codeload.github.com/stevekinney/octavian/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253497296,"owners_count":21917683,"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":[],"created_at":"2024-08-03T16:01:19.568Z","updated_at":"2025-05-10T23:31:07.797Z","avatar_url":"https://github.com/stevekinney.png","language":"JavaScript","funding_links":[],"categories":["Libraries Audio","Sound creation"],"sub_categories":["Instrument recordings"],"readme":"# Octavian\n\nOctavian is a little utility library for working with musical notes and their frequencies. Super cool, right?\n\n## Installation\n\nFirst things, first: how do I install this thing?\n\n```js\nnpm install octavian\n```\n\nMaybe you even throw a `--save` in there if you feel like keeping it around.\n\n## Usage\n\nSo, we've got Octavian installed, how do we use it?\n\n```js\nvar Octavian = require('octavian');\n\nvar note = new Octavian.Note('A4');\n```\n\nOr, if you're some kind of hipster…\n\n```js\nvar Note = require('octavian').Note;\n\nvar note = new Note('A4');\n```\n\n### The Basics\n\nA `Note` has a few properties that we can play around with.\n\n```js\nvar note = new Note('A#4');\n\nnote.letter; // 'A'\nnote.modifier; // '#'\nnote.octave; // 4\nnote.signature; // 'A#4'\nnote.pianoKey; // 50\nnote.frequency; // 466.164\n```\n\n### Normalization\n\nBut, what if we toss in some bogus note? Something like `E#`, maybe? There is no `E#`, right?\n\n```js\nvar note = new Note('E#5');\n\nnote.signature; // 'F5'\n```\n\n### Intervals\n\nMusic is all about intervals. We can move up by a semitone or some other interval.\n\n```js\nvar note = new Note('C3');\n\nnote.majorThird(); // returns a new Note('E3');\nnote.perfectFifth(); // returns a new Note('G3');\nnote.perfectOctave(); // returns a new Note('C4');\n```\n\nYou can do any of the following:\n\n* `downOctave()`\n* `minorSecond()`\n* `majorSecond()`\n* `minorThird()`\n* `majorThird()`\n* `perfectFourth()`\n* `diminishedFifth()`\n* `perfectFifth()`\n* `minorSixth()`\n* `majorSixth()`\n* `minorSeventh()`\n* `majorSeventh()`\n* `perfectOctave()`\n\nThere are also some extra methods that are aliased, if you'd prefer:\n\n* `augmentedFourth()`\n* `third()`\n* `fifth()`\n\n### Chords\n\nYou can create chords with Octavian.\n\n```js\nconst cMajorChord = new Octavian.Chord('C4', 'major');\n\ncMajorChord.notes; // returns [ { letter: 'C', modifier: null, octave: 4 },\n                   //           { letter: 'E', modifier: null, octave: 4 },\n                   //           { letter: 'G', modifier: null, octave: 4 } ]\n\ncMajorChord.signatures;  // returns [ 'C4', 'E4', 'G4' ]\ncMajorChord.frequencies; // returns [ 261.626, 329.628, 391.995 ]\ncMajorChord.pianoKeys;   // returns [ 40, 44, 47 ]\n```\n\nYou can create the following chords:\n\n* `major`\n* `majorSixth`\n* `majorSeventh`\n* `majorSeventhFlatFive`\n* `majorSeventhSharpFive`\n* `minor`\n* `minorSixth`\n* `minorSeventh`\n* `minorMajor`\n* `dominantSeventh`\n* `diminished`\n* `diminishedSeventh`\n* `halfDimished`\n\nYou're also more than welcome to use the following aliases for any of the above:\n\n* `maj` is an alias for `major`\n* `6` is an alias for `majorSixth`\n* `maj6` is an alias for `majorSixth`\n* `7` is an alias for `majorSeventh`\n* `maj7` is an alias for `majorSeventh`\n* `maj7b5` is an alias for `majorSeventhFlatFive`\n* `maj7#5` is an alias for `majorSeventhSharpFive`\n* `min` is an alias for `minor`\n* `m` is an alias for `minor`\n* `min6` is an alias for `minorSixth`\n* `m6` is an alias for `minorSixth`\n* `min7` is an alias for `minorSeventh`\n* `m7` is an alias for `minorSeventh`\n* `m#7` is an alias for `minorMajor`\n* `min#7` is an alias for `minorMajor`\n* `m(maj7)` is an alias for `minorMajor`\n* `dom7` is an alias for `dominantSeventh`\n* `dim` is an alias for `diminished`\n* `dim7` is an alias for `diminishedSeventh`\n* `m7b5` is an alias for `halfDiminshed`\n\n#### Adding Notes to a Chord\n\nYou can add notes to a chord manually, if that suits you:\n\n```js\nconst chord = new Octavian.Chord('C4');\n\nchord.signatures; // returns ['C4']\n\nchord.addInterval('majorThird');\nchord.signatures; // returns ['C4', 'E4']\n\nchord.addInterval(7);\nchord.signatures; // returns ['C4', 'E4', 'G4']\n```\n\n#### Turning a Note into a Chord\n\nYou can turn any note into the basis for a chord:\n\n```js\nconst note = new Octavian.Note('C4');\nnote.toChord(); // returns a new chord with only C4 in it.\nnote.toChord('major'); // returns a new chord with C4, E4, and G4 in it\n```\n\n### Inverting a Chord\n\nYou can invert a chord. For a Triad, two inversions exist these can be created\nby calling `inversion(1)` or `inversion(2)`.\n\n```js\nconst cMajorChord = new Octavian.Chord('C4', 'major');\ncMajorChord.signatures;  // returns [ 'C4', 'E4', 'G4' ]\n\ncMajorChord.inversion(2);\ncMajorChord.signatures;  // returns [ 'C5', 'E5', 'G4' ]\n```\n\nIt's also possible to have Octavian generate a random inversion:\n\n```js\nconst cMajorChord = new Octavian.Chord('C4', 'major');\ncMajorChord.randomInversion();\ncMajorChord.signatures;  // returns any one of the following:\n                         // [ 'C4', 'E3', 'G3' ]\n                         // [ 'C4', 'E4', 'G3' ]\n                         // [ 'C4', 'E4', 'G4' ]\n                         // [ 'C5', 'E4', 'G4' ]\n                         // [ 'C5', 'E5', 'G4' ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevekinney%2Foctavian","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevekinney%2Foctavian","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevekinney%2Foctavian/lists"}