This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import pandas as pd | |
import numpy as np | |
from urllib.request import urlopen | |
REGEX = {} | |
def features2type(numeral, form=None, figbass=None): | |
""" Turns a combination of the three chord features into a chord type. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ms3 import fifths2rn, name2fifths, rel2abs_key | |
def absolute_chord2rn(abs_chord, abs_key): | |
"""Given an absolute chord (such as 'Ab') and an absolute key (such as 'C') return the chord's scale degree ('bVI').""" | |
is_minor_chord, is_minor_key = abs_chord.islower(), abs_key.islower() | |
chord_fifths, key_fifths = name2fifths(abs_chord), name2fifths(abs_key) | |
interval = chord_fifths - key_fifths | |
result = fifths2rn(interval, is_minor_key) | |
if is_minor_chord: | |
result = result.lower() |