I'm trying to write some software to read a MIDI file into an internal data format and use it to cont开发者_开发知识库rol 3D simulated instruments. My biggest problem is reading the MIDI data in from a file, and I'd like to avoid writing all the import code.
Does anyone know of a free (preferably Open Source), cross-platform MIDI file reading library? What features does it have? Can it import other note-based music formats?
I once wrote a Midi file read/write library in C. If you want to have a look here it is: http://code.google.com/p/middl/
It's a very basic library that allows you to define a callback function for each MIDI event type, for C++ you might want to encapsulate it into some sort of "Midi reader" class (or just use it as it is :) .
You could try Timidity, an open source midi player written in c. Its quite easy to hack into what you want.
精彩评论