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

Function write_Track

mingus/midi/midi_file_out.py:121–135  ·  view source on GitHub ↗

Write a mingus.Track to a MIDI file. Write the name to the file and set the instrument if the instrument has the attribute instrument_nr, which represents the MIDI instrument number. The class MidiInstrument in mingus.containers.Instrument has this attribute by default.

(file, track, bpm=120, repeat=0, verbose=False)

Source from the content-addressed store, hash-verified

119
120
121def write_Track(file, track, bpm=120, repeat=0, verbose=False):
122 """Write a mingus.Track to a MIDI file.
123
124 Write the name to the file and set the instrument if the instrument has
125 the attribute instrument_nr, which represents the MIDI instrument
126 number. The class MidiInstrument in mingus.containers.Instrument has
127 this attribute by default.
128 """
129 m = MidiFile()
130 t = MidiTrack(bpm)
131 m.tracks = [t]
132 while repeat >= 0:
133 t.play_Track(track)
134 repeat -= 1
135 return m.write_file(file, verbose)
136
137
138def write_Composition(file, composition, bpm=120, repeat=0, verbose=False):

Callers 1

midi_file_out.pyFile · 0.85

Calls 4

play_TrackMethod · 0.95
write_fileMethod · 0.95
MidiTrackClass · 0.90
MidiFileClass · 0.70

Tested by

no test coverage detected