def write_Track(file, track, bpm = 120, repeat = 0):
	"""Writes a mingus.Track to a midi file. Writes the name to \
the file and sets 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."""
	m = MidiFile()
	t = MidiTrack(bpm)
	m.tracks = [t]
	while repeat >= 0:
		t.play_Track(track)
		repeat -= 1
	return m.write_file(file)
Example #2
0
def write_Track(
    file,
    track,
    bpm=120,
    repeat=0,
    verbose=False,
):
    """Writes a mingus.Track to a midi file. Writes the name to the file and sets \
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."""

    m = MidiFile()
    t = MidiTrack(bpm)
    m.tracks = [t]
    while repeat >= 0:
        t.play_Track(track)
        repeat -= 1
    return m.write_file(file, verbose)