MCPcopy Create free account
hub / github.com/bspaans/python-mingus / write_file

Method write_file

mingus/midi/midi_file_out.py:56–72  ·  view source on GitHub ↗

Collect the data from get_midi_data and write to file.

(self, file, verbose=False)

Source from the content-addressed store, hash-verified

54 [t.reset() for t in self.tracks]
55
56 def write_file(self, file, verbose=False):
57 """Collect the data from get_midi_data and write to file."""
58 dat = self.get_midi_data()
59 try:
60 f = open(file, "wb")
61 except:
62 print("Couldn't open '%s' for writing." % file)
63 return False
64 try:
65 f.write(dat)
66 except:
67 print("An error occured while writing data to %s." % file)
68 return False
69 f.close()
70 if verbose:
71 print("Written %d bytes to %s." % (len(dat), file))
72 return True
73
74
75def write_Note(file, note, bpm=120, repeat=0, verbose=False):

Callers 5

write_NoteFunction · 0.95
write_NoteContainerFunction · 0.95
write_BarFunction · 0.95
write_TrackFunction · 0.95
write_CompositionFunction · 0.95

Calls 1

get_midi_dataMethod · 0.95

Tested by

no test coverage detected