Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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):
song = np.array(self._midi_coordinator.midiToMatrix(file))
if np.array(song).shape[0] > 50:
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