def run(): corpus = acorpus.corpus() for (a, p) in corpus: print a.name newA = convert(a) normalname = '-'.join(newA.name.split('-')[:-1]) part = newA.name.split('-')[-1:][0] newA.metadata['name'] = normalname newA.name = normalname acorpus.save_annotation('explicitswing', newA, midifile=acorpus.load_midifile('annotations', normalname), part=part)
def load(self, collection=None, name=None): if not collection: collection = annotationcorpus.collections()[\ cgui.menu(self.stdscr, 'Choose collection', annotationcorpus.collections())] results = annotationcorpus.load(collection, name) if results: self.annotations = [] self.midifile = annotationcorpus.load_midifile(collection, name) for result in results: self.annotations += result.annotation metadata = results[0].metadata self.notelist = results[0].notes self.bpm = metadata['bpm'] self.offset = metadata['offset'] self.name = metadata['name'] self.meter = meter.Meter(metadata['beatspb'], metadata['beatdiv']) self.refreshAnnotation = True self.refreshMidi = True return True return False