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

Added the to_major and to_minor methods that the Tutorial calls for. #49

Open
wants to merge 1 commit 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
33 changes: 33 additions & 0 deletions mingus/core/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,39 @@ def remove_redundant_accidentals(note):
val += 1
return result

def to_major(note):
""" convert note to relative major.

Examples:
>>> to_major('C')
'D#'
>>> to_major('D')
'F'
"""
note_int = note_to_int()
note_int += 3
if note_int > 11:
note_int -= 12
result = int_to_note(note_int)
return result

def to_minor(note):
""" convert note to relative minor.

Examples:
>>> to_major('C')
'D#'
>>> to_major('D')
'F'
"""
note_int = note_to_int()
note_int -= 3
if note_int < 0:
note_int += 12
result = int_to_note(note_int)
return result


def augment(note):
"""Augment a given note.

Expand Down