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 )