pretty_midi Interface

muspy.from_pretty_midi(midi, resolution=None)[source]

Return a pretty_midi PrettyMIDI object as a Music object.

Parameters:
  • midi (pretty_midi.PrettyMIDI) – PrettyMIDI object to convert.

  • resolution (int, default: muspy.DEFAULT_RESOLUTION (24)) – Time steps per quarter note.

Returns:

Converted Music object.

Return type:

muspy.Music

muspy.to_pretty_midi(music, realize_annotations=False)[source]

Return a Music object as a PrettyMIDI object.

Tempo changes are not supported yet.

Parameters:
  • music (muspy.Music object) – Music object to convert.

  • realize_annotations (bool, default: False) – Should annotations be applied to loudness/timing of notes?

Returns:

Converted PrettyMIDI object.

Return type:

pretty_midi.PrettyMIDI

Notes

Tempo information will not be included in the output.