Created
November 11, 2018 17:39
-
-
Save NMZivkovic/ea80d6a923b948649c806d0f160f2fa8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tqdm import tqdm | |
import glob | |
import numpy as np | |
class SongImporter(object): | |
def __init__(self, path, midi_coordinator): | |
self._path = path | |
self._midi_coordinator = midi_coordinator | |
def getSongs(self): | |
files = glob.glob('{}/*.mid*'.format(self._path)) | |
songs = [] | |
for file in tqdm(files): | |
try: | |
song = np.array(self._midi_coordinator.midiToMatrix(file)) | |
if np.array(song).shape[0] > 50: | |
songs.append(song) | |
except Exception as e: | |
raise e | |
return songs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment