Last active
August 29, 2015 14:12
-
-
Save ShinJJang/53c617d7b81d70580326 to your computer and use it in GitHub Desktop.
블디님이 화성 개념글을 보고 만든 파이썬 코드 Ref: http://www.todayhumor.co.kr/board/view.php?table=music&no=104169&s_no=104169&page=2
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
# 블디님이 화성 개념글을 보고 만든 파이썬 코드 | |
# Ref: http://www.todayhumor.co.kr/board/view.php?table=music&no=104169&s_no=104169&page=2 | |
MAJOR_SCALE = ['C','C#','D','D#','E','F','F#','G','G#','A','A#','B' ] | |
while True: | |
root = raw_input(u'루트음은?(종료=Q) : ') | |
root = root.upper() | |
if root == 'Q': | |
break; | |
root_idx = MAJOR_SCALE.index(root) | |
s3_idx = root_idx+4 | |
s5_idx = s3_idx+3 | |
if s3_idx > len(MAJOR_SCALE): | |
s3_idx -= len(MAJOR_SCALE) | |
if s5_idx > len(MAJOR_SCALE): | |
s5_idx -= len(MAJOR_SCALE) | |
print "MAJOR: %s %s %s" % (root, MAJOR_SCALE[s3_idx], MAJOR_SCALE[s5_idx]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment