def write(self, obj, fmt, fp=None, subformats=None, **keywords): from music21.midi import translate as midiTranslate if fp is None: fp = self.getTemporaryFile() mf = midiTranslate.music21ObjectToMidiFile(obj) mf.open(fp, 'wb') # write binary mf.write() mf.close() return fp
def write(self, obj, fmt, fp=None, subformats=None, **keywords): from music21.midi import translate as midiTranslate if fp is None: fp = self.getTemporaryFile() mf = midiTranslate.music21ObjectToMidiFile(obj) mf.open(fp, 'wb') # write binary mf.write() mf.close() return fp