Skip to content

Importing note-seq changes PrettyMIDI behavior for corrupt MIDI files. #29

@christhetree

Description

@christhetree

I recently came across this bug while processing LMD with my own scripts and note-seq chord inference.
Usually, when processing a corrupt MIDI file, pretty midi throws an exception. However, if note-seq is imported, no exception is thrown anymore.

Reproducible code:

from pretty_midi import PrettyMIDI
# import note_seq  # Uncomment this line to prevent exception from being thrown


pm = PrettyMIDI('d6174dfc21a1449dc423c58065f14173.mid')  # Exception should be thrown about too many ticks

This was on python 3.8 with a clean virtualenv environment and the latest version of pretty midi and note-seq.
Naturally this kind of behavior causes a lot of problems downstream if you are relying on exceptions to be thrown for skipping corrupt MIDI files.

Let me know if it's reproducible, maybe I'm missing something on my side.
GitHub doesn't let me attach MIDI files, but you can find the corrupt file in the Lakh MIDI dataset in the d folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions