Site Tools


documentation:development:opera:pf25:ppgfldr:mgsfldr:mpgfldr:09mpg003

An Overview of the MIDI Score-Playing Process


This section shows how a task uses the components of the MIDI environment to play back a MIDI score. A task typically follows these steps:

<HTML><ol></HTML> <HTML><li></HTML>Open the Audio and Math folios and initialize the Juggler. This opens the Audio and Music folios so that the Music library can use instruments, the audio clock, and math functions. It also sets up the Juggler to handle MIDI playback.<HTML></li></HTML> <HTML><li></HTML>Create a MIDI environment. <HTML><ul></HTML> <HTML><li></HTML>Set the maximum number of voices and programs available. This limits the number of instrument templates and DSP resources required.<HTML></li></HTML> <HTML><li></HTML>Create a ScoreContext data structure. This step also includes creating attendant data structures such as ScoreChannel data structures.<HTML></li></HTML> <HTML><li></HTML>Create a PIMap. This step imports the necessary instrument templates and then associates them with corresponding program numbers.<HTML></li></HTML> <HTML><li></HTML>Create a mixer for connecting voice output to the D to A input. This step also creates the NoteTracker data structures necessary for allocating voices, and allocates system amplitude for the mixer.<HTML></li></HTML><HTML></ul></HTML>


<HTML></li></HTML> <HTML><li></HTML>Import a MIDI score file. <HTML><ul></HTML> <HTML><li></HTML>Import a MIDI file from CD-ROM or other source. This translates MIDI messages and places them in a Juggler sequence or collection. It also sets up an interpreter procedure for the Juggler object that correctly interprets the MIDI messages in the object.<HTML></li></HTML> <HTML><li></HTML>Specify a score context for the imported score. This sets a pointer in the Juggler object to the score context necessary for playback.<HTML></li></HTML><HTML></ul></HTML>


<HTML></li></HTML> <HTML><li></HTML>Adjust score timing to match the MIDI song tempo. This step either sets the audio clock to an appropriate rate, or it scales MIDI timestamps for each score event.<HTML></li></HTML> <HTML><li></HTML>Play the score in a BumpJuggler() loop.<HTML></li></HTML> <HTML><li></HTML>Clean up. <HTML><ul></HTML> <HTML><li></HTML>Free allocated amplitude.<HTML></li></HTML> <HTML><li></HTML>Reset the audio clock.<HTML></li></HTML> <HTML><li></HTML>Delete all the instrument templates.<HTML></li></HTML> <HTML><li></HTML>Delete the score context and attendant data structures.<HTML></li></HTML> <HTML><li></HTML>Terminate the Juggler.<HTML></li></HTML> <HTML><li></HTML>Close the Math and Audio folios.<HTML></li></HTML><HTML></ul></HTML>


<HTML></li></HTML><HTML></ol></HTML>

The following sections discuss the details for each of these steps.

documentation/development/opera/pf25/ppgfldr/mgsfldr/mpgfldr/09mpg003.txt · Last modified: 2022/10/10 16:53 by 127.0.0.1