{"id":16747823,"url":"https://github.com/janko/musique","last_synced_at":"2025-04-10T13:51:49.906Z","repository":{"id":13360025,"uuid":"16047581","full_name":"janko/musique","owner":"janko","description":"A Ruby gem for manipulating musical constructs.","archived":false,"fork":false,"pushed_at":"2014-04-21T16:40:07.000Z","size":200,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T15:47:11.369Z","etag":null,"topics":["arithmetic","chords","intervals","music","notes","ruby","scales"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/janko.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":"2014-01-19T14:37:26.000Z","updated_at":"2021-02-28T21:04:12.000Z","dependencies_parsed_at":"2022-08-25T18:20:29.749Z","dependency_job_id":null,"html_url":"https://github.com/janko/musique","commit_stats":null,"previous_names":["janko-m/musique"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janko%2Fmusique","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janko%2Fmusique/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janko%2Fmusique/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janko%2Fmusique/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janko","download_url":"https://codeload.github.com/janko/musique/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248228598,"owners_count":21068721,"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":["arithmetic","chords","intervals","music","notes","ruby","scales"],"created_at":"2024-10-13T02:11:00.032Z","updated_at":"2025-04-10T13:51:49.890Z","avatar_url":"https://github.com/janko.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Musique\n\nMusique is a gem for manipulating with musical constructs, such as notes,\nchords and intervals.\n\n* Source code: [https://github.com/janko-m/musique](https://github.com/janko-m/musique)\n* API Documenation: [http://rubydoc.info/github/janko-m/musique/master/frames](http://rubydoc.info/github/janko-m/musique/master/frames)\n\nInstallation\n------------\n\n```sh\n$ gem install musique\n```\n\nUsage\n-----\n\n### `Music::Note`\n\n```rb\nnote = Music::Note.new(\"C#1\")\nnote.letter     #=\u003e \"C\"\nnote.accidental #=\u003e \"#\"\nnote.octave     #=\u003e 1\n\n# Comparison\nMusic::Note.new(\"C1\")  \u003c  Music::Note.new(\"E1\")  #=\u003e true\nMusic::Note.new(\"C#1\") == Music::Note.new(\"Db1\") #=\u003e true\n\n# Transposing\nmajor_third = Music::Interval.new(3, :major)\nMusic::Note.new(\"C1\").transpose_up(major_third).name   #=\u003e \"E1\"\nMusic::Note.new(\"E1\").transpose_down(major_third).name #=\u003e \"C1\"\n\n# Difference\nMusic::Note.new(\"C2\") - Music::Note.new(\"C1\") #=\u003e #\u003cMusic::Interval @number=8, @quality=:perfect\u003e\n```\n\n### `Music::Chord`\n\n```rb\nchord = Music::Chord.new(\"C#7\")\nchord.root.name #=\u003e \"C#\"\nchord.kind      #=\u003e \"7\"\n\n# Notes\nMusic::Chord.new(\"C\").notes.map(\u0026:name)   #=\u003e [\"C\", \"E\", \"G\"]\nMusic::Chord.new(\"Cm7\").notes.map(\u0026:name) #=\u003e [\"C\", \"Eb\", \"G\", \"Bb\"]\n\n# Transposing\nmajor_third = Music::Interval.new(3, :major)\nMusic::Chord.new(\"C\").transpose_up(major_third).notes.map(\u0026:name) #=\u003e [\"E\", \"G#\", \"B\"]\n```\n\n### `Music::Interval`\n\n```rb\ninterval = Music::Interval.new(3, :minor)\ninterval.number  #=\u003e 3\ninterval.quality #=\u003e :minor\n\n# Comparison\nMusic::Interval.new(3, :minor) \u003e  Music::Interval.new(2, :major)     #=\u003e true\nMusic::Interval.new(3, :minor) == Music::Interval.new(2, :augmented) #=\u003e true\n\n# Kinds\nMusic::Interval.new(6, :major).consonance?           #=\u003e true\nMusic::Interval.new(6, :major).perfect_consonance?   #=\u003e false (perfect consonances are 1, 4, and 5)\nMusic::Interval.new(6, :major).imperfect_consonance? #=\u003e true\nMusic::Interval.new(6, :major).dissonance?           #=\u003e false\n\n# Size\nMusic::Interval.new(3, :major).size #=\u003e 4 (semitones)\n```\n\nLimitations\n-----------\n\n* Currently only triads (C/Cm) and seventh chords (C7/Cm7) are supported.\n  The goal is to support all chords in all notations.\n\n* Double accidentals (𝄪 and 𝄫) are not supported yet.\n\n* Double augmented/diminished intervals are not supported yet.\n\nSocial\n------\n\nYou can follow me on Twitter, I'm [@jankomarohnic](http://twitter.com/jankomarohnic).\n\nLicense\n-------\n\nThis project is released under the [MIT license](/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanko%2Fmusique","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanko%2Fmusique","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanko%2Fmusique/lists"}