Skip to content

Instantly share code, notes, and snippets.

@ShinJJang
Last active August 29, 2015 14:12
Show Gist options
  • Save ShinJJang/53c617d7b81d70580326 to your computer and use it in GitHub Desktop.
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
# -*- 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