Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change backend parser to mido #101

Merged
merged 1 commit into from
Oct 4, 2016
Merged

Change backend parser to mido #101

merged 1 commit into from
Oct 4, 2016

Conversation

craffel
Copy link
Owner

@craffel craffel commented Oct 3, 2016

Resolves #99. This commit changes the backend from the python-midi package to mido. This change was tested by reading in 1,000 MIDI files with pretty_midi with both backends, writing them out, and then comparing md5 checksums of the written files. This tests both parsing and writing, which are the two things the backend is used for. The known differences are

@douglaseck, @cghawthorne can you run this code through your test suite to see if anything breaks before I merge and make a new release?

@@ -49,19 +47,24 @@ def __init__(self, midi_file=None, resolution=220, initial_tempo=120.):
"""
if midi_file is not None:
# Load in the MIDI data using the midi module
midi_data = midi.read_midifile(midi_file)
midi_data = mido.MidiFile(midi_file)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to continue support loading midi files from file objects, this should be something like:

            if type(midi_file) in (str, unicode):
              midi_data = mido.MidiFile(filename=midi_file)
            else:
              midi_data = mido.MidiFile(file=midi_file)

Which is similar to what the previous midi package did:
https://github.com/vishnubob/python-midi/blob/master/src/fileio.py#L158

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, should be fixed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, verified that all our tests pass now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change parser to mido
2 participants