If you're doing midi on a Mac, you should look into some of the Core Audio portion of the Cocoa framework. There are a lot of things done for you. If you build the app with the Cocoa framework, you can get scriptability with very little effort. If you're already writing in C, the Objective-C stuff should be easy. The Cocoa framework is pretty vast, and the audio stuff is too.