mingus.midi.midi_file_in¶
Read a MIDI file and convert it into mingus.containers objects.
-
class
mingus.midi.midi_file_in.
FormatError
[source]¶ -
args
¶ Attribute of type: getset_descriptor
<attribute 'args' of 'exceptions.BaseException' objects>
-
message
¶ Attribute of type: getset_descriptor
<attribute 'message' of 'exceptions.BaseException' objects>
-
-
class
mingus.midi.midi_file_in.
HeaderError
[source]¶ -
args
¶ Attribute of type: getset_descriptor
<attribute 'args' of 'exceptions.BaseException' objects>
-
message
¶ Attribute of type: getset_descriptor
<attribute 'message' of 'exceptions.BaseException' objects>
-
-
class
mingus.midi.midi_file_in.
MidiFile
[source]¶ -
-
bpm
¶ Attribute of type: int
120
-
bytes_read
¶ Attribute of type: int
0
-
meter
¶ Attribute of type: tuple
(4, 4)
-
parse_midi_event
(self, fp)[source]¶ Parse a MIDI event.
Return a dictionary and the number of bytes read.
-
parse_midi_file
(self, file)[source]¶ Parse a MIDI file.
Return the header -as a tuple containing respectively the MIDI format, the number of tracks and the time division-, the parsed track data and the number of bytes read.
-
parse_midi_file_header
(self, fp)[source]¶ Read the header of a MIDI file and return a tuple containing the format type, number of tracks and parsed time division information.
-
parse_time_division
(self, bytes)[source]¶ Parse the time division found in the header of a MIDI file and return a dictionary with the boolean fps set to indicate whether to use frames per second or ticks per beat.
If fps is True, the values SMPTE_frames and clock_ticks will also be set. If fps is False, ticks_per_beat will hold the value.
-
-
class
mingus.midi.midi_file_in.
TimeDivisionError
[source]¶ -
args
¶ Attribute of type: getset_descriptor
<attribute 'args' of 'exceptions.BaseException' objects>
-
message
¶ Attribute of type: getset_descriptor
<attribute 'message' of 'exceptions.BaseException' objects>
-
-
mingus.midi.midi_file_in.
MIDI_to_Composition
(file)[source]¶ Convert a MIDI file to a mingus.containers.Composition and return it in a tuple with the last used tempo in beats per minute (this will change in the future).
This function can raise all kinds of exceptions (IOError, HeaderError, TimeDivisionError, FormatError), so be sure to try and catch.