Example #1
0
def initialize_cache(pieces, piece_length=128, measure_len=16, save_loc="cache.pkl"):
    midi_cache = Cache()
    for piece_name in pieces:
        out_matrix = pieces[piece_name]
        print(out_matrix.shape)
        in_matrix = noteStateMatrixToInputForm(out_matrix)
        midi_cache.cache(in_matrix, out_matrix, piece_name)

    print("Cache initialized with {} pieces; total size is {} bytes".format(len(pieces), midi_cache.byte_size))
    midi_cache.shuffle_piece()
    midi_cache.save(save_loc=save_loc)
    return midi_cache
 def extract_cached(self):
     cache_file = os.path.join('data', 'cache', 'combinators', '%s.json' % (self.__class__.__name__))
     return Cache.cache(self.__cache__, cache_file, self.extract)
Example #3
0
 def extract_cached(self):
     cache_file = os.path.join('data', 'cache',
                               '%s.json' % (self.__class__.__name__))
     return Cache.cache(self.__cache__, cache_file, self.extract)