-
Notifications
You must be signed in to change notification settings - Fork 5
/
constants_latent_factors.py
66 lines (59 loc) · 2.04 KB
/
constants_latent_factors.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
61
62
63
64
65
66
"""
File containing constants for different latent factors
Do NOT change
"""
import numpy as np
from itertools import combinations
# Dictionary for note indices corresponding to different chords within a scale
CHORD_DICT = {
'I': [0, 2, 4],
'IV': [3, 5, 7],
'V': [4, 6, 8],
'I-last': [0, 2, 4],
}
# List of allowed options for Tonic factor
TONIC_LIST = [
'C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'
]
TONIC_DICT = {
i: t for i, t in enumerate(TONIC_LIST)
} # dict with indices mapping to the tonic values
TONIC_REVERSE_DICT = {
TONIC_DICT[k]: k for k in TONIC_DICT.keys()
} # reverse dict with tonic values mapping to indices
# List of allowed options for Octave factor
OCTAVE_LIST = [4, 5, 6]
OCTAVE_DICT = {
i: o for i, o in enumerate(OCTAVE_LIST)
} # dict with indices mapping to the octave values
OCTAVE_REVERSE_DICT = {
OCTAVE_DICT[k]: k for k in OCTAVE_DICT.keys()
} # reverse dict with octave values mapping to indices
# List of allowed options for Scale (Mode) factor
SCALE_LIST = ['major', 'minor', 'blues']
SCALE_DICT = {
i: m for i, m in enumerate(SCALE_LIST)
} # dict with indices mapping to the scale options
SCALE_REVERSE_DICT = {
SCALE_DICT[k]: k for k in SCALE_DICT.keys()
} # reverse dict with scale values mapping to indices
SCALE_NOTES_DICT = {
'major': [0, 2, 4, 5, 7, 9, 11, 12, 14],
'minor': [0, 2, 3, 5, 7, 8, 11, 12, 14],
'blues': [0, 2, 3, 5, 6, 9, 10, 12, 14],
} # dict with allowed scale degrees for each scale
# Dict containing options for Rhythm factor
RHYTHM_DICT = {}
all_rhythms = combinations([0, 1, 2, 3, 4, 5, 6, 7], 6)
for i, pos in enumerate(list(all_rhythms)):
temp_array = np.array([0] * 8)
temp_array[np.array(pos)] = 1
RHYTHM_DICT[i] = list(temp_array)
# Dict containing options for Arpeggiation factor
ARP_DICT = {
0: 'up',
1: 'down'
} # dict with indices mapping to arpeggiation direction options
ARP_REVERSE_DICT = {
ARP_DICT[k]: k for k in ARP_DICT.keys()
} # reverse dict mapping arpeggiaition direction options to indices