-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings.py
More file actions
114 lines (95 loc) · 3.04 KB
/
settings.py
File metadata and controls
114 lines (95 loc) · 3.04 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# For python 3 compatibility
from __future__ import division, absolute_import, print_function
try: input = raw_input
except: pass
# External Dependencies
import argparse, os
import mingus.core.notes as notes
def get_user_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'-k', '--key',
default="C",
help="The key (defaults to C). Use -m to specify minor key.",
)
parser.add_argument(
'-m', '--minor',
action='store_true',
default=False,
help="If this flag is included, the minor key will be used."
)
parser.add_argument(
'-o', '--many_octaves',
action='store_true',
default=False,
help='If this flag is included, octaves 1-7 will be used.'
)
parser.add_argument(
'-s', '--sevenths',
action='store_true',
default=False,
help='If this flag is included, sevenths will be used instead of '
'triads.'
)
parser.add_argument(
'-f', '--sound_font',
action='store_true',
default=os.path.join(os.path.dirname(__file__), "fluid-soundfont",
"FluidR3 GM2-2.SF2"),
help=("You can use this flag to specify a sound font (.sf2) file. "
"By default ")
)
parser.add_argument(
'-d', '--delay',
action='store_true',
default=1.0,
help=("Use this flag to specify the delay between chords.")
)
return parser.parse_args()
# Setup settings for use in other modules
user_args = get_user_args()
SOUNDFONT = user_args.sound_font
if user_args.minor:
KEY = user_args.key.lower()
else:
KEY = user_args.key.upper()
if user_args.sevenths:
[I, II, III, IV, V, VI, VII] = ["I7", "II7", "III7", "IV7", "V7", "VI7",
"VII7"]
TONES = [1, 3, 5, 7]
else:
[I, II, III, IV, V, VI, VII] = ["I", "II", "III", "IV", "V", "VI", "VII"]
TONES = [1, 3, 5]
CADENCE = [I, IV, V, I]
NUMERALS = [I, II, III, IV, V, VI, VII]
if not notes.is_valid_note(KEY):
print("ATTENTION: User-input key, {}, not valid, using C Major "
"instead.".format(KEY))
KEY = "C"
# Other user args
MANY_OCTAVES = user_args.many_octaves
# DELAY = user_args.delay
PROGRESSION_MODE = False
BPM = 60 * user_args.delay
# Other args that should be user-adjustable, but aren't yet
PROG_LENGTHS = range(2, 5) # Number of strums in a progression
CHORD_LENGTHS = range(1, 3) # Number of strums per chord
RESOLVE_WHEN_INCORRECT = True
RESOLVE_WHEN_CORRECT = True
ARPEGGIATE_WHEN_CORRECT = True
ARPEGGIATE_WHEN_INCORRECT = True
INTERVALS = [2, 3, 4, 5, 6, 7, 8]
INTERVAL_MODE = "ascending"
HARMONIC_INTERVALS = False # if false 'interval' mode will play melodic ints
OCTAVES = range(1, 8) # if many_octaves flag invoked
DEFAULT_IOCTAVE = 4
INITIAL_MODE = 'interval'
FIXED_ROOT = 0 # Fix root of interval, 0 for unfixed
NAME_INTERVAL = False
# Inelegant storage
NEWQUESTION = True
CURRENT_MODE = None
CURRENT_Q_INFO = None
SCORE = 0
COUNT = 0
ALTERNATIVE_CHORD_TONE_RESOLUTION = 2