-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcl_chord.py
executable file
·51 lines (35 loc) · 1.39 KB
/
cl_chord.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 22 21:23:24 2018
@author: Erik
"""
from cl_static import static
from cl_scale import scale
# chord class
class chord():
def __init__(self, baseTone):
self.stat = static()
self.bT = self.stat.sanitizeTone(baseTone)
def constructChord(self, mode):
# Every time constructChord is called, we construct a new chord
self.chord = []
self.mode = self.stat.sanitizeMode(mode, "chord")
# create the base scale
s = scale(self.bT)
userChromScale = s.constructChromScale()
chord = self.stat.chords[self.mode]
# step through intervals in the chord
for interval in chord:
self.chord.append(userChromScale[interval%12])
return self.chord
def show(self):
if self.mode == "maj" :
print("The " + self.bT + " major chord:\n", self.chord)
elif self.mode == "min" :
print("The " + self.bT + " minor chord:\n", self.chord)
elif self.mode == "dom7" :
print("The " + self.bT + " dominant 7 chord:\n", self.chord)
elif self.mode == "min7" :
print("The " + self.bT + " minor 7 chord:\n", self.chord)
elif self.mode == "maj7":
print("The " + self.bT + " major 7 chord:\n", self.chord)