The MusicKit MKSynthPatch Subclasses

The MusicKit provides a number of MKSynthPatch subclasses, instances of which you can use in your application. MKSynthPatch objects are “data-driven”; during a performance, they're sent MKNote objects (through methods described in the next section) from which they pluck the parameters of interest. Thus, in order to use a MKSynthPatch, you must know not only what sort of synthesis/processing it embodies, but which parameters it expects to see in the MKNotes it receives. A table of the MusicKit parameters organized by MKSynthPatch synthesis/processing technique is given in Appendix A. Below, some of the MusicKit MKSynthPatch subclasses are listed and briefly described. For a complete list, see <MusicKit/synthpatches/synthpatches.h>.

Tip

When doing synthesis in a realtime interactive context, such as when playing it from a MIDI keyboard, you should invoke [orchestra setTimed:NO] and call MKUseRealTimeEnvelopes(YES) before allocating the MKSynthPatch.

Pluck

Pluck employs physical modelling to synthesize the sound of a plucked string, using a technique developed by Alex Strong, Kevin Karplus, David Jaffe and Julius Smith. The real-world mechanics of a plectrum plucking a string are replaced on the DSP by a burst of noise filling a length of delay memory. The delay memory is looped and filtered, causing the initial noise burst to gradually become more harmonic as the spectral energy subsides towards the fundamental, emulating the strike-and-fade characteristics of a real plucked string.

Wavetable Synthesis

Wavetable synthesis is a technique in which a length of memory is filled with one or more periods of a waveform; the memory is then looped during playback to produce a continuous signal. While wavetable synthesis is extremely easy to use―no messy formulas are needed to create a musical timbre―it's somewhat limited to the extent that you don't have control over the individual elements that create the timbre (which you do with techniques such as frequency modulation).

The MusicKit's wavetable synthesis MKSynthPatches use single-period wavetables; they are:

Table 5-2. MKSynthPatch Descriptions

MKSynthPatchDescription
Wave1One wavetable
Wave1vOne wavetable with vibrato
Wave1iOne wavetable with frequency interpolation
Wave1viOne wavetable with vibrato and interpolation
DBWave1vOne database wavetable with vibrato
DBWave1viOne database wavetable with vibrato and interpolation
DBWave2viTwo database wavetables with vibrato and interpolation

The database wavetable MKSynthPatches access the MusicKit's MKWaveTable Database, a library of predefined timbres. These are listed in Appendix A.

Frequency Modulation

In frequency modulation (FM) synthesis, the output of one oscillator controls the frequency of another oscillator. If the frequency of the controlling oscillator (or “modulator”) is subaudio, the tone produced by the controlled oscillator (or “carrier”) will exhibit vibrato. However, as the modulator's frequency is increased, the carrier's vibrato also increases until the individual undulation become indistinguishable and sidebands, or reflections of the modulator's frequency around the carrier's frequency, appear. If the oscillators are producing sine waves with identical or harmonically-related frequencies, the sidebands produce a harmonic series. As the oscillators' waveforms become more complex, the sidebands become more numerous, but they may still produce a harmonic series. However, if the oscillators' frequencies aren't harmonically related, the result can be a clangorous mess (which is good if you're trying to make bell sounds, one of the more popular and occasionally unavoidable results of FM synthesis).

Table 5-3. FM MKSynthPatch Descriptions

MKSynthPatchDescription
Fm1Simple (one-modulator) FM
Fm1iSimple FM with frequency interpolation
Fm1vSimple FM with vibrato
Fm1viSimple FM with interpolation and vibrato
Fm2cviCascade FM
Fm2cnviCascade FM with random modulation (noise) on the modulators
Fm2pviParallel FM
Fm2pnviParallel FM with noise

Waveshaping Synthesis

There are two waveshaping MKSynthPatches, Shape and Shapev. They differ in that the vibrato parameters are supported only by Shapev.

These MKSynthPatches implement non-linear distortion synthesis, which means that they produce sound by using an oscillator to drive a lookup table. Normally, the oscillator is a sine wave and the complexity of the resulting waveform is a function of the lookup table. However, for added flexibility, you may set the oscillator waveform to anything you want.