Playing MIDI Scores


This chapter discusses techniques that use the Music library to import a MIDI score from a standard MIDI file and then play the score back using Audio folio resources.

This chapter shows how Music library functions can import a MIDI score file from an external source (a composition program on the Macintosh, for example) and turn that score into a Juggler object that can be played using Audio folio instruments, all without a MIDI port or any internal MIDI hardware. The chapter takes a close look at different aspects of MIDI score playback: the process of score translation, the MIDI environment created by the Music library, and the process of MIDI message playback using the Juggler.

To understand the topics discussed here, you need a good working knowledge of the MIDI standard, how it is usually applied to synthesizer setups, what constitutes a MIDI message, and the variety of messages available. There is a brief review of MIDI basics at the beginning of this chapter, but explaining the full MIDI standard is beyond the scope of this book.

If what you really want to do is simply set up a task to play back a MIDI score without having to know all the details behind playback, you can use playmf.c, the example program shown at the end of this chapter. The source code for this program is included on the Portfolio release disc. playmf.c is set up in modules that allow you to easily modify the code to play your MIDI score. You can refer back to sections of this chapter as necessary if you do not understand what is going on, and what needs to be changed. The example file MFLoopTest.c also provides an example of playing MIDI scores.

If you do not need to write MIDI playing code, and are only interested in creating a MIDI score for playback, then the two sections of this chapter you need to read are Setting PIMap Entries and Creating a MIDI Score for Playback.

This chapter contains the following topics: