Functions that can generate MIDI files from the objects in mingus.containers.

class mingus.midi.midi_file_out.MidiFile[source]
__init__(self, tracks=[])[source]

Collect and return the raw, binary MIDI data from the tracks.


Return a header for type 1 MIDI file.


Reset every track.


Attribute of type: str '\x00H'


Attribute of type: list []

write_file(self, file, verbose=False)[source]

Collect the data from get_midi_data and write to file.

mingus.midi.midi_file_out.write_Bar(file, bar, bpm=120, repeat=0, verbose=False)[source]

Write a mingus.Bar to a MIDI file.

Both the key and the meter are written to the file as well.

mingus.midi.midi_file_out.write_Composition(file, composition, bpm=120, repeat=0, verbose=False)[source]

Write a mingus.Composition to a MIDI file.

mingus.midi.midi_file_out.write_Note(file, note, bpm=120, repeat=0, verbose=False)[source]

Expect a Note object from mingus.containers and save it into a MIDI file, specified in file.

You can set the velocity and channel in Note.velocity and Note.channel.

mingus.midi.midi_file_out.write_NoteContainer(file, notecontainer, bpm=120, repeat=0, verbose=False)[source]

Write a mingus.NoteContainer to a MIDI file.

mingus.midi.midi_file_out.write_Track(file, track, bpm=120, repeat=0, verbose=False)[source]

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.

Back to Index