equal-tempered chord scales
computing the members of each of the chords in a chord scale in a particular key (a python script)
# takes one argument: an integer representing the position in
# the set of keys (beginning with 'A')
# key number
# A 0
# Bb 1
# B 2
# C 3
# C# 4
# D 5
# Eb 6
# E 7
# F 8
# F# 9
# G 10
# Ab 11
import sys
# the key the user requested on the command line
requested_key = int(sys.argv[1])
# the set of keys (equivalent to the chromatic scale)
# (two octaves used to make the script smaller)
key_set = ('A', 'Bb', 'B', 'C', 'C#', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab', 'A', 'Bb', 'B', 'C', 'C#', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab')
# the intervals (the spacing) in the diatonic scale
# (interval = number of steps in the chromatic scale from one step to another step)
diatonic_scale_intervals_set = (2, 2, 1, 2, 2, 2, 1)
chord_scale_qualities = ('', 'minor', 'minor', '', '', 'minor', 'diminished')
cur_key_set_position = requested_key
steps_in_current_key = []
print "current key: %s" %key_set[cur_key_set_position]
print "scale steps in current key: ",
steps_in_current_key.append(key_set[cur_key_set_position] )
for interval in diatonic_scale_intervals_set:
cur_key_set_position = cur_key_set_position + interval
steps_in_current_key.append( key_set[cur_key_set_position] )
for step in steps_in_current_key:
print step,
print
print
print "current key's chord scale: ",
for i in range(0,6):
if i in [1,2,5]:
print "%s minor" % steps_in_current_key[i],
else:
print steps_in_current_key[i],
print
print
print 'use the number of the key to tell this script what key you want'