Mido Interface¶
-
muspy.
from_mido
(midi: mido.midifiles.midifiles.MidiFile, duplicate_note_mode: str = 'fifo') → muspy.music.Music[source] Return a Music object converted from a mido MidiFile object.
Parameters: - midi (
mido.MidiFile
object) – MidiFile object to convert. - duplicate_note_mode ({'fifo', 'lifo, 'close_all'}) –
Policy for dealing with duplicate notes. When a note off message is presetned while there are multiple correspoding note on messages that have not yet been closed, we need a policy to decide which note on messages to close. Defaults to ‘fifo’.
- ’fifo’ (first in first out): close the earliest note on
- ’lifo’ (first in first out):close the latest note on
- ’close_all’: close all note on messages
Returns: Converted Music object.
Return type: muspy.Music
object- midi (
-
muspy.
to_mido
(music: Music, use_note_on_as_note_off: bool = True)[source] Return a Music object as a MidiFile object.
Parameters: - music (
muspy.Music
object) – Music object to convert. - use_note_on_as_note_off (bool) – Whether to use a note on message with zero velocity instead of a note off message.
Returns: Converted MidiFile object.
Return type: - music (