{"id":13419782,"url":"https://github.com/gciruelos/musthe","last_synced_at":"2025-03-15T05:33:11.047Z","repository":{"id":15540658,"uuid":"18275485","full_name":"gciruelos/musthe","owner":"gciruelos","description":"Music theory implemented in Python. Notes, intervals, scales and chords.","archived":false,"fork":false,"pushed_at":"2024-07-29T17:33:50.000Z","size":132,"stargazers_count":336,"open_issues_count":3,"forks_count":41,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-10-01T09:16:02.532Z","etag":null,"topics":["chords","lilypond","music","music-theory","python","scales"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gciruelos.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-03-30T22:37:22.000Z","updated_at":"2024-09-23T19:54:26.000Z","dependencies_parsed_at":"2024-07-31T00:48:03.066Z","dependency_job_id":"78b6ba40-4097-43c3-a64c-69961b87f08e","html_url":"https://github.com/gciruelos/musthe","commit_stats":{"total_commits":143,"total_committers":15,"mean_commits":9.533333333333333,"dds":0.4405594405594405,"last_synced_commit":"6c31c276f9d902d6d3523bf4964649aaf4973d31"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gciruelos%2Fmusthe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gciruelos%2Fmusthe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gciruelos%2Fmusthe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gciruelos%2Fmusthe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gciruelos","download_url":"https://codeload.github.com/gciruelos/musthe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221548085,"owners_count":16840966,"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":["chords","lilypond","music","music-theory","python","scales"],"created_at":"2024-07-30T22:01:20.780Z","updated_at":"2024-10-26T15:30:35.454Z","avatar_url":"https://github.com/gciruelos.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"musthe\n======\n\nMusic theory implemented in Python. Notes, scales and chords.\n\nIt is still in development so feel free to read the code, fork and make pull requests! They are very welcome!\n\nInstallation\n============\n\nTo install:\n\n    $ pip install musthe\n\n\nDevelopment install\n===================\n\nTo install as development:\n\n(Optional) Create a virtualenv:\n\n    $ python -m venv env\n    $ source env/bin/activate\n\nThen install:\n\n    $ pip install -e .\n\n\nHow to use\n==========\n\nIt is very simple, everything is coded in a object-oriented style, for example:\n\n    $ python\n    \u003e\u003e\u003e from musthe import *\n    \u003e\u003e\u003e a = Note('A')  #Default A4\n    \u003e\u003e\u003e a\n    Note(\"A4\")\n    \u003e\u003e\u003e str(a)\n    'A'\n\n\nSuppose you want to create tension, so you want the perfect fifth or the minor seventh of that A, so you do:\n\n    \u003e\u003e\u003e fifth = Interval('P5')\n    \u003e\u003e\u003e seventh = Interval('m7')\n    \u003e\u003e\u003e a+fifth\n    Note(\"E5\")\n    \u003e\u003e\u003e str(a+fifth)\n    'E'\n    \u003e\u003e\u003e str(a+seventh)\n    'G'\n\nThough it is important to see that the octaves of those notes are different:\n\n    \u003e\u003e\u003e a.octave\n    4\n    \u003e\u003e\u003e (a+seventh).octave\n    5\n\nNow let's see basic chord usage:\n\n\t\u003e\u003e\u003e Chord(Note('A'), 'M')\n\tChord(Note('A'), 'M')\n\t\u003e\u003e\u003e Chord(Note('A'), 'M').notes\n\t[Note(\"A4\"), Note(\"C#5\"), Note(\"E5\")]\n\t\u003e\u003e\u003e Chord(Note('Bb'), 'dim').notes\n\t[Note(\"Bb4\"), Note(\"Db5\"), Note(\"Fb5\")]\n\nYou can use a string to construct a chord:\n\n    \u003e\u003e\u003e Chord('C#aug7') == Chord(Note('C#'), 'aug7')\n    True\n\nDefault chord type is 'M' (Major).\n\nNow lets try scales:\n\n    \u003e\u003e\u003e s = Scale(Note('B'), 'major')\n    \u003e\u003e\u003e [s[i] for i in range(len(s))]\n    [Note('B4'), Note('C#5'), Note('D#5'), Note('E5'), Note('F#5'), Note('G#5'), Note('A#5')]\n    \u003e\u003e\u003e s[0]\n    Note('B4')\n    \u003e\u003e\u003e s[-11]\n    Note('E3')\n\nIt return a list of Note instances, so if you want a cleaner result should do something like:\n\n    \u003e\u003e\u003e s = Scale(Note('B'), 'major')\n    \u003e\u003e\u003e [str(s[i]) for i in range(len(s))]\n    ['B', 'C#', 'D#', 'E', 'F#', 'G#', 'A#']\n\nTo check if notes and chords are contained in a given scale:\n\n    \u003e\u003e\u003e Note('D#3') in s\n    True\n    \u003e\u003e\u003e Note('F3') in s\n    False\n    \u003e\u003e\u003e Chord('C#m') in s\n    True\n    \u003e\u003e\u003e Chord('CM') in s\n    False\n\nNow let's try some advanced stuff: given a list of chords, find all scales that contain those:\n\n    \u003e\u003e\u003e chords = [Chord('Cm'), Chord('Fm7'), Chord('Gm')]\n    \u003e\u003e\u003e for scale in Scale.all():\n    ...     if chords in scale:\n    ...         print(scale)\n    ...\n    C natural_minor\n    Eb major\n\nConversely, given a scale, you can use the `harmonize` method to find all of the\ndiatonic and dominant 7th chords for reach note in that scale:\n\n    \u003e\u003e\u003e from pprint import pprint\n    ... scale = Scale('C', 'major')\n    ... pprint(scale.harmonize(), indent=2)\n    [ [ Chord(Note('C4'), 'maj'),\n        Chord(Note('C4'), 'dom7'),\n        Chord(Note('C4'), 'maj7'),\n        Chord(Note('C4'), 'sus2'),\n        Chord(Note('C4'), 'sus4'),\n        Chord(Note('C4'), 'open5'),\n        Chord(Note('C4'), 'dom9'),\n        Chord(Note('C4'), 'maj9')],\n    [ Chord(Note('D4'), 'min'),\n        Chord(Note('D4'), 'min7'),\n        Chord(Note('D4'), 'sus2'),\n        Chord(Note('D4'), 'sus4'),\n        Chord(Note('D4'), 'open5'),\n        Chord(Note('D4'), 'min9')],\n    [ Chord(Note('E4'), 'min'),\n        Chord(Note('E4'), 'min7'),\n        Chord(Note('E4'), 'sus4'),\n        Chord(Note('E4'), 'open5')],\n    [ Chord(Note('F4'), 'maj'),\n        Chord(Note('F4'), 'dom7'),\n        Chord(Note('F4'), 'maj7'),\n        Chord(Note('F4'), 'sus2'),\n        Chord(Note('F4'), 'open5'),\n        Chord(Note('F4'), 'dom9'),\n        Chord(Note('F4'), 'maj9')],\n    [ Chord(Note('G4'), 'maj'),\n        Chord(Note('G4'), 'dom7'),\n        Chord(Note('G4'), 'sus2'),\n        Chord(Note('G4'), 'sus4'),\n        Chord(Note('G4'), 'open5'),\n        Chord(Note('G4'), 'dom9')],\n    [ Chord(Note('A4'), 'min'),\n        Chord(Note('A4'), 'min7'),\n        Chord(Note('A4'), 'sus2'),\n        Chord(Note('A4'), 'sus4'),\n        Chord(Note('A4'), 'open5'),\n        Chord(Note('A4'), 'min9')],\n    [ Chord(Note('B4'), 'dim'),\n        Chord(Note('B4'), 'm7dim5')] ]\n\n(If you prefer to omit dominant 7th chords you can use `harmonize(include_dom7=False)`. You can also use the `harmonize_dict` method to get a dictionary instead of a list, with a key for each note in the scale.)\n\n\nIf you have [lilypond](http://lilypond.org/) installed, you can make little melodies using this program, an example is given in 'lilypond_example.py'\n\nRunning Tests\n=============\n\nFrom the project root directory, run:\n\n```\npython -m tests.tests\n```\n\nContributors\n============\n\n* [zsinx6](https://github.com/zsinx6)\n* [Federico Ferri](https://github.com/fferri)\n* [Gonzalo Ciruelos](https://github.com/gciruelos)\n* [David H](https://github.com/bobthenameless)\n* [nvoster](https://github.com/nvoster)\n* [Sylvain](https://github.com/SylvainDe)\n* [Edgar Gavrik](https://github.com/edgarasg)\n* [Sri Raghavan](https://github.com/srir)\n* [Augustus Wynn](https://github.com/guswynn)\n* [Marco Heins](https://github.com/barrio)\n* [Andy Chase](https://github.com/mystery-house)\n\n\nLicense\n=======\n\nSee license file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgciruelos%2Fmusthe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgciruelos%2Fmusthe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgciruelos%2Fmusthe/lists"}