Created
May 3, 2017 20:14
-
-
Save pianomanfrazier/2472696483d9cab87773e20feb746e5b to your computer and use it in GitHub Desktop.
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
#! python3 | |
from interval import get_interval, INTERVAL | |
def get_triad(bass, figure=''): | |
'''takes a bass note (ie a,b,c,d ...) and a figured bass string (ie '6/4', '6')''' | |
n1 = bass | |
n2 = '' | |
n3 = '' | |
if figure == '': | |
n2 = get_interval(bass, INTERVAL['M3']) | |
n3 = get_interval(bass, INTERVAL['P5']) | |
elif figure == '6': | |
n2 = get_interval(bass, INTERVAL['m3']) | |
n3 = get_interval(bass, INTERVAL['m6']) | |
elif figure == '6/4': | |
n2 = get_interval(bass, INTERVAL['P4']) | |
n3 = get_interval(bass, INTERVAL['M6']) | |
return '< {} {} {} >'.format(n1,n2,n3) | |
if __name__ == "__main__": | |
assert get_triad('c') == '< c e g >' | |
print(get_triad('f','6')) | |
assert get_triad('f', '6') == '< f aes des >' | |
assert get_triad('des') == '< des f aes >' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment