[linux-audio-dev] Libs for reading/writing midis

Pedro Lopez-Cabanillas pedro.lopez.cabanillas at gmail.com
Fri Aug 5 15:42:20 UTC 2005

> > libmidifile would be cute, is any of the existing codebases flexible
> > enough so that it could be massaged into a nice lib?
> vote++ to everything you said. dunno about any existing midi code though
> flexible enough to be put into a lib.. After taking a glance at
> rosegarden and muse's source it seems there's always app specifics
> intertwined.
> Wasn't a midi file pretty much a simple dump of midi events anyways?

SMF (Standard MIDI Files) are structured data files, derived from IFF 
(Interchange Format Files), close but not fully compliant with the RIFF 
format. There is also a RMID format developed by Microsoft which is a true  
RIFF format and only prepends a 12 bytes header to the classic MIDs.

I agree with you on the topic of SMF import/export code in most open source  
programs. My problem is that they usually mix policy and mechanism, making 
hard to reuse only the mechanism (read and write MIDI files), because each 
program has its own internal format (policy) to represent the music. 

I like Tim Thomson's midifile library because it only provides a clean  
mechanism that you can reuse together with your own policy. It's plain C code 
and free: http://thompsonresidence.com/tjt/software.html#midifile

Based on that code I wrote a SMF component for Kylix/Free Pascal, included in 
this package: http://perso.wanadoo.es/plcl/alsapas/midiobjects-0.2.tar.gz


More information about the Linux-audio-dev mailing list