In this document “synthesis” refers to creating sound from scratch, while “processing” refers to modifying sound from elsewhere. However, the MusicKit provides a unified model of synthesis and processing. Thus, nearly all operations that apply to synthesis can also be used in sound processing.
There are four levels of MusicKit classes involved in synthesizing and processing music on the DSP:
At the top level is the MKSynthInstrument class; an inheritor from MKInstrument, it provides an interface between the MusicKit performance mechanism and DSP synthesis/processing. A MKSynthInstrument distributes MKNotes that it receives during a performance to individual MKSynthPatch objects that control the actual synthesis/processing.
MKSynthPatch, an abstract class, embodies the principles of music synthesis. Each subclass of MKSynthPatch represents a particular synthesis/processing strategy; each MKSynthPatch object synthesizes one MKNote at a time, using the strategy defined by its class.
The MKUnitGenerator class is also abstract; each of its subclasses represents a signal processing function that runs on the DSP. These are the basic building blocks of music synthesis/processing that a MKSynthPatch subclass configures to define its synthesis/processing strategy. At the same level as MKUnitGenerator is the MKSynthData class. Instances of MKSynthData represent portions of DSP memory that hold synthesis/processing data such as wavetables and delay memory. In addition, MKSynthData objects are used to transmit data between MKUnitGenerator objects.
The MKOrchestra represents the DSP itself. It manages the allocation of DSP resources and controls communication between the DSP and the host. Requests for use of the DSP are always made through messages to the MKOrchestra; this includes requests made by a MKSynthInstrument for more MKSynthPatches, and those of a MKSynthPatch for MKUnitGenerators and MKSynthData objects.
The MKSynthInstrument class is described in Chapter 6. The rest of this chapter is devoted to the other classes listed above.