-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (35 loc) · 902 Bytes
/
main.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
import sys
import random
from src.song import Song
from src.createScale import stayInKey
##################################################
# 16 beats = 1 quarter note
# timesig = */4
##################################################
# Song:
# tempo, key, time signature(beats only),
# numbner of unique sections, number of measures,
# midi handler
##################################################
def main():
midi = MIDIFile(1, adjust_origin=True)
scale = stayInKey(0)
songDict = {
'tempo': 100,
'key': scale,
'time_signature': 4,
'sections': 4,
'measures': 60,
'mh': midi,
'random': random
}
song = Song(songDict)
song.test()
try:
from midiutil.MidiFile import MIDIFile
except ImportError:
print('\nMissing requirements.')
print('run:\n\tpip install -r requirements.txt\n')
sys.exit(0)
if __name__ == "__main__":
main()