Jump to content
  • Advertisement
Sign in to follow this  
J-Fox

MIDI Parser

This topic is 3827 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, I m working on a game for PSP and PC which needs to parse MIDI files to get the notes (I don't even have to play the files). First, I checked the internet for information on the file format There are lots of information on that topic so I started writing a parser. When I was done writing my parser (in C) I tried it out and I got different results than "MIDI File Analyzer II 1.6". I m not that good in C so I decided to try re-writing it in VB6. I was actually surprised cause I ran into exactly the same problem again. Then I followed 2 other documentations after that (in other words: I rewrote the whole project 2 times using VB6 again). Then I found out that the game Frets On Fire (Phyton) has some MIDI file parser in it. So I rewrote another time... This time it got even worse though. I have been trying it the last 2 days now and I wasn't able to find any good, easy to understand source code to parse a midi file to file or console (Note Off, Note On etc..) Personally I believe the problem is the running status. First, some commands work and then, suddenly, it only receives status messages with an index of lower than 8 - which would be invalid. The running status does this:
0x90 0x53 0x20
0x90 0x10 0x15
becomes:
0x90 0x53 0x20
0x10 0x15
The 90 is not stored anymore because its the status number, if the status didn't change only the parameters are sent. I tried it like that: If the status index is lower than 8 just use the running status. Problem: In some parts its only changing the status after 100s of commands of the same type. For example: I had tracks with no notes, but only Pitch bend. Or rows like: Note on, and then 100 times Note Off on the same channel. Would be cool if anyone knows a page where I can get one of these: - A working MIDI parser (Let it be VB6, C, Phyton, ...) - A better MIDI analyzer (Would be great if it tells me on what offset it got what information)

Share this post


Link to post
Share on other sites
Advertisement
If you want to have a look at a working parser, try looking through the source of TiMidity++. I don't know about the code quality, but it works very well. The program also has some fun output options that may help you.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!