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)
| 119 | |
| 120 | |
| 121 | def 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 | |
| 138 | def write_Composition(file, composition, bpm=120, repeat=0, verbose=False): |
no test coverage detected