Mido Interface
- muspy.from_mido(midi, duplicate_note_mode='fifo')[source]
Return a mido MidiFile object as a Music object.
- Parameters:
midi (
mido.MidiFile) – Mido MidiFile object to convert.duplicate_note_mode ({'fifo', 'lifo', 'all'}, default: 'fifo') –
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.
’fifo’ (first in first out): close the earliest note on
’lifo’ (first in first out): close the latest note on
’all’: close all note on messages
- Returns:
Converted Music object.
- Return type:
- muspy.to_mido(music, realize_annotations=False, use_note_off_message=False)[source]
Return a Music object as a MidiFile object.
- Parameters:
music (
muspy.Musicobject) – Music object to convert.realize_annotations (bool, default: False) – Should annotations be applied to loudness/timing of notes?
use_note_off_message (bool, default: False) – Whether to use note-off messages. If False, note-on messages with zero velocity are used instead. The advantage to using note-on messages at zero velocity is that it can avoid sending additional status bytes when Running Status is employed.
- Returns:
Converted MidiFile object.
- Return type: