-
Notifications
You must be signed in to change notification settings - Fork 0
/
HARM_consonanceChordRecognizer_func.py
60 lines (45 loc) · 2.04 KB
/
HARM_consonanceChordRecognizer_func.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
52
53
54
55
56
57
58
59
60
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 28 14:58:13 2018
@author: Maria
"""
#from HARM_traverseOrbit_func import HARM_traverseOrbit
from HARM_findSubsets_func import HARM_findSubsets
from HARM_findConsonantSequencesOfSubsets_func import HARM_findConsonantSequencesOfSubsets
from HARM_findMaximalConsonantSubsets_func import HARM_findMaximalConsonantSubsets
from HARM_findExtentions_func import HARM_findExtentions
from HARM_shortestFormOfSubsets_func import HARM_shortestFormOfSubsets
from HARM_rootExtentionForm_func import HARM_rootExtentionForm
from HARM_relativeToRootExtentions_func import HARM_relativeToRootExtentions
from HARM_findPitchClassesfromChord_func import HARM_findPitchClassesfromChord
from HARM_takeOnlyUniqueValuesfromPitchClasses_func import HARM_takeOnlyUniqueValuesfromPitchClasses
#function that returns the final form of chord
def HARM_consonanceChordRecognizer(chord, consWeights):
#find the pitch classes from the original chord
modChord = HARM_findPitchClassesfromChord(chord)
#take only unique values from the pitch classes array
m = HARM_takeOnlyUniqueValuesfromPitchClasses(modChord)
#find subsets/possible combinations between pitches
subs = HARM_findSubsets(m)
#find consonant intervals between pitches
consonant = HARM_findConsonantSequencesOfSubsets(consWeights, subs)
#find Maximal Consonant Subsets
maxConSubs = HARM_findMaximalConsonantSubsets(consonant)
#find chord extentions
chExtentions = HARM_findExtentions(m, maxConSubs)
#find shortest form func
shortest = HARM_shortestFormOfSubsets(maxConSubs)
#chord label
chordForm, root, chType = HARM_rootExtentionForm(shortest, chExtentions)
print(chordForm)
return chordForm
class GCT:
#id as a static variable maybe?
def __init__(self, root, chType, chExtentions, chordForm):
self.root = root
self.type = chType
self.extentions = chExtentions
self.label = chordForm
#print(self.root)
#self.allVersions =
#make a class for printing