-
Notifications
You must be signed in to change notification settings - Fork 110
/
constants.py
84 lines (73 loc) · 1.81 KB
/
constants.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import os
# Define the musical styles
genre = [
'baroque',
'classical',
'romantic'
]
styles = [
[
'data/baroque/bach',
'data/baroque/handel',
'data/baroque/pachelbel'
],
[
'data/classical/burgmueller',
'data/classical/clementi',
'data/classical/haydn',
'data/classical/beethoven',
'data/classical/brahms',
'data/classical/mozart'
],
[
'data/romantic/balakirew',
'data/romantic/borodin',
'data/romantic/brahms',
'data/romantic/chopin',
'data/romantic/debussy',
'data/romantic/liszt',
'data/romantic/mendelssohn',
'data/romantic/moszkowski',
'data/romantic/mussorgsky',
'data/romantic/rachmaninov',
'data/romantic/schubert',
'data/romantic/schumann',
'data/romantic/tchaikovsky',
'data/romantic/tschai'
]
]
NUM_STYLES = sum(len(s) for s in styles)
# MIDI Resolution
DEFAULT_RES = 96
MIDI_MAX_NOTES = 128
MAX_VELOCITY = 127
# Number of octaves supported
NUM_OCTAVES = 4
OCTAVE = 12
# Min and max note (in MIDI note number)
MIN_NOTE = 36
MAX_NOTE = MIN_NOTE + NUM_OCTAVES * OCTAVE
NUM_NOTES = MAX_NOTE - MIN_NOTE
# Number of beats in a bar
BEATS_PER_BAR = 4
# Notes per quarter note
NOTES_PER_BEAT = 4
# The quickest note is a half-note
NOTES_PER_BAR = NOTES_PER_BEAT * BEATS_PER_BAR
# Training parameters
BATCH_SIZE = 16
SEQ_LEN = 8 * NOTES_PER_BAR
# Hyper Parameters
OCTAVE_UNITS = 64
STYLE_UNITS = 64
NOTE_UNITS = 3
TIME_AXIS_UNITS = 256
NOTE_AXIS_UNITS = 128
TIME_AXIS_LAYERS = 2
NOTE_AXIS_LAYERS = 2
# Move file save location
OUT_DIR = 'out'
MODEL_DIR = os.path.join(OUT_DIR, 'models')
MODEL_FILE = os.path.join(OUT_DIR, 'model.h5')
SAMPLES_DIR = os.path.join(OUT_DIR, 'samples')
CACHE_DIR = os.path.join(OUT_DIR, 'cache')