-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
36 lines (22 loc) · 712 Bytes
/
main.py
File metadata and controls
36 lines (22 loc) · 712 Bytes
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
import numpy as np
import midi_manipulation
import glob
from tqdm import tqdm
def get_songs(directory_path):
files = glob.glob('{}/*.mid'.format(directory_path))
songs = []
for f in tqdm(files):
try:
song = np.array(midi_manipulation.midiToNoteStateMatrix(f))
if np.array(song).shape[0] > 50:
songs.append(song)
except Exception as e:
raise e
return songs
songs = get_songs('resources') #These songs have already been converted from midi to msgpack
print("{} songs processed".format(len(songs)))
###################################################
def main():
print(songs)
if __name__ == '__main__':
main()