Skip to content

Instantly share code, notes, and snippets.

Embed
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):
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