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

Unknown Meta MIDI Event #33

Closed
flagstone78 opened this issue Mar 14, 2014 · 1 comment
Closed

Unknown Meta MIDI Event #33

flagstone78 opened this issue Mar 14, 2014 · 1 comment
Labels

Comments

@flagstone78
Copy link

In my file i have some weird midi events. How do i get the parser to just skip the incorrect midi events?

My midi editor program can read the file just fine so i know that it can still be read.

@tdhsmith
Copy link
Contributor

Well for a temporary solution, you'll want to get rid of the warning in fileio.py on line 64 (https://github.com/vishnubob/python-midi/blob/master/src/fileio.py#L64) and fudge the class handling a bit so that it accepts a generic event placeholder, lines 64-65 becoming:

if cmd not in EventRegistry.MetaEvents:
  #raise Warning, "Unknown Meta MIDI Event: " + `cmd`
  cls = MetaEvent
else:
  cls = EventRegistry.MetaEvents[cmd]

I have no idea what sorts of things this might tangle up (I suspect there must be a few), but I did manage to parse and save a MIDI file with unknown meta-events.

A full solution would probably involve creating actual classes for different kinds of unknown events and making sure they can pass through everything unscathed, but I'm too much of a novice at python class handling and methods to plunk it out immediately.

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

No branches or pull requests

3 participants