pretty_midi InterfaceΒΆ

muspy.from_pretty_midi(midi: pretty_midi.pretty_midi.PrettyMIDI, resolution: int = None) → muspy.music.Music[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: Music) → pretty_midi.pretty_midi.PrettyMIDI[source]

Return a Music object as a PrettyMIDI object.

Tempo changes are not supported yet.

Parameters:music (muspy.Music object) – Music object to convert.
Returns:Converted PrettyMIDI object.
Return type:pretty_midi.PrettyMIDI

Notes

Tempo information will not be included in the output.