Creating a MIDI Score for Playback


Composing a score usually takes place in an application such as a sequencer, MIDI recorder, or score composition tool. The source does not really matter, as long as it is conducive to composition, and as long as it can export the music created as a Format 0 or Format 1 MIDI file. Think of Format 0 and Format 1 as the ASCII of the music world, readable by the Portfolio Music library as well as by almost any other MIDI environment. If your composition application can only save its scores in its own native format and not in Format 0 or Format 1, then you cannot use its scores with the Music library.

Before you save a score as a Format 0 or Format 1 file, you may want to go though it to optimize it for Music library playback. Reduce the number of programs; if some are not used to good effect, get rid of them. When you choose program numbers, try to use the lowest numbers possible. This allows you to use a smaller PIMap and to support fewer programs in the Music library's MIDI environment, which saves resources. Also reduce the number of simultaneous voices if possible, perhaps by rewriting sections that boost the maximum number of voices for just a few seconds.

After you have tweaked your score and saved it, you should create a text PIMap that specifies instrument templates and samples that are as close as possible to the programs in the original MIDI score. You may want to make custom samples to correspond to the sounds you want, or use ARIA to create custom instruments that sound as much as possible like the instruments originally used for composition. And whenever possible, use simpler instruments in place of complex instruments to conserve DSP resources.

If you create a MIDI score that is looped, watch for sequences that end with a rest. Create a silent MIDI event to fill in for that rest. If you leave it blank (no MIDI message there), playback on looping can be out of sync because the first MIDI event of the score begins where the rest should be.

Once the score and PIMap are set, you can turn them over to the Music library with the code you have written, and then wait for the music to play. (Providing, of course, that you have worked out all the bugs\xc9 )