-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgen_model.py
26 lines (20 loc) · 921 Bytes
/
gen_model.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
from convert import MIDIConverter, MidiCollection, MidiMatrix
if __name__ == '__main__':
sample_rate = 16
# collection_name = 'music'
collection_name = raw_input('Collection name: ')
sample_rate = int(raw_input('Sample rate: '))
lower_bound = int(raw_input("Lower bound: "))
upper_bound = int(raw_input("Upper bound: "))
conv = MIDIConverter(lower_bound=lower_bound, upper_bound=upper_bound)
fname = 'models/%s_%d_%d-%d.bin' % (collection_name, sample_rate,
lower_bound, upper_bound)
conv.directory2bin(collection_name, fname, sample_rate=sample_rate)
# collection = MidiCollection.from_directory(
# 'music',
# lower_bound=lower_bound,
# upper_bound=upper_bound)
# print("Loaded %d music pieces" % collection.num_pieces)
# collection.to_file()
# # collection.save_model()
# print "Model saved."