Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to_chords(): add support for add9 and madd9 #87

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions mingus/core/chords.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
* minor_ninth
* major_ninth
* dominant_ninth
* minor_add_ninth
* major_add_ninth
* Elevenths
* minor_eleventh
* eleventh
Expand Down Expand Up @@ -117,6 +119,7 @@
"dim": " diminished triad",
"aug": " augmented triad",
"+": " augmented triad",
"M-5": " major diminished triad",
"7#5": " augmented minor seventh",
"M7+5": " augmented minor seventh",
"M7+": " augmented major seventh",
Expand Down Expand Up @@ -218,6 +221,15 @@ def diminished_triad(note):
"""
return [note, intervals.minor_third(note), intervals.minor_fifth(note)]

def major_diminished_triad(note):
"""Build a major diminished triad on note.

Example:
>>> major_diminished_triad('C')
['C', 'E', 'Gb']
"""
return [note, intervals.major_third(note), intervals.minor_fifth(note)]


def augmented_triad(note):
"""Build an augmented triad on note.
Expand Down Expand Up @@ -381,6 +393,25 @@ def major_ninth(note):
"""
return major_seventh(note) + [intervals.major_second(note)]

def minor_add_ninth(note):
"""Build a minor ninth chord on note.

Example:
>>> minor_add_ninth('C')
['C', 'Eb', 'G', 'D']
"""
return minor_triad(note) + [intervals.major_second(note)]


def major_add_ninth(note):
"""Build a major ninth chord on note.

Example:
>>> major_add_ninth('C')
['C', 'E', 'G', 'D']
"""
return major_triad(note) + [intervals.major_second(note)]


def dominant_ninth(note):
"""Build a dominant ninth chord on note.
Expand Down Expand Up @@ -1338,6 +1369,7 @@ def determine_polychords(chord, shorthand=False):
"dim": diminished_triad,
"aug": augmented_triad,
"+": augmented_triad,
"M-5": major_diminished_triad,
"7#5": augmented_minor_seventh,
"M7+5": augmented_minor_seventh,
"M7+": augmented_major_seventh,
Expand Down Expand Up @@ -1370,6 +1402,8 @@ def determine_polychords(chord, shorthand=False):
"7#9": dominant_sharp_ninth,
"M9": major_ninth,
"m9": minor_ninth,
"add9": major_add_ninth,
"madd9": minor_add_ninth,
"7#11": lydian_dominant_seventh,
"m11": minor_eleventh,
"M13": major_thirteenth,
Expand Down