SoundFont Modulators

S. Christian Collins, sound designer and creator of the GeneralUser GS SoundFont completed in March 2016 a review of the top SoundFont-compatible software, including SynthFont2. He ran all of the programs through a compatibility test suite and published the results in his blog post, Using SoundFonts in 2016. SynthFont2 fared better than some of the other SoundFont virtual instruments out there, but there were some issues that he ran into with some of the tests. Chris contacted me and kindly volunteered to help me develop this important feature. Now, after three months of hard work and many test versions I am ready to release the first versions of SynthFont2, Viena and VSTSynthFont with near-perfect Moldulator support. Thank you Chris for all your help!
From SoundFont specifications (version 2.01):
"SoundFont Modulators are used to allow real-time control over the sound in sound designer programmable manner. Each instance of a SoundFont modulator structure defines a real-time perceptually additive effect to be applied to a given destination or synthesizer parameter."
The image to the right (from the official SoundFont specifications) describes what it is all about. A Primary Source (e.g. a MIDI Continuous Controller) acts on SoundFont Generator (e.g. initialFilterFc = initial Low Pass Filter Frequency) through a normalization/mapping function "Norm". The Amount is multiplied by the result of the "Norm" function and added to the initial generator value. Furthermore, there may be a Secondary Source also acting through another normalization/mapping function on the same Amount. The the result of all this is fed through a Transform, which in theory could be of any kind, but in practice is not doing anything as there are no other transforms than the linear ("just pass through") defined. The result is finally added to the original generator value to create a new value for the parameter in question.
The normalization/mapping function "Norm" is specified in detail. The input - usually in the range 0..127 - is mapped into the range 0 - 0.992 (=127/128). There are 16 different mappings specified, shown in the image to the right (from my Viena SoundFont editor). Click on the image for a larger view.
A very typical use of a modulator is to let the Note On Velocity effect a number of things, for example both the attack at the release may benefit from this. In this example the velocity controls the attack and the filter resonance of the guitar:
Example
A very dull repeating guitar sound can be made more vivid by using modulators. Compare the "dull" sound to the "vivid" sound.

The effect has been achieved by connecting the Continuous Controller #2, Breath, to both the Filter Resonance (see modulator definition below [from Viena]) and to the volume envelope attack (not shown).
Defining a modulator in Viena (1)
Another example, in which also the secondary controller is used:
Defining a modulator in Viena (2)
This could be defined in the global split for a Grand Piano. The modulator will make the note release (decay) time longer for lower key values (the primary controller) and also longer for higher velocities (the secondary controller)  - which is what you would expect from a real piano.
More from SoundFont specifications:
"A modulator is defined by its sfModSrcOper, its sfModDestOper, and its sfModSrcAmtOper. All modulators within a zone must have a unique set of these three enumerators.  If a second modulator is encountered with the same three enumerators as a previous modulator with the same zone, the first modulator will be ignored." sfModSrcOper contains the specification for the primary source and the primary "Norm" curve. SfModDestOper is equal to the SoundFont generator to be modified. sfModSrcAmtOper contains the specification for the secondary source and the secondary "Norm" curve. This means that you cannot have two modulators in the chain with the same destination, source, primary "Norm" curve and secondary source and secondary "Norm" curve. You can change the Amount and the transform value, which is "0" or linear by default. (It is up to the synthesizer engineer to construct other transforms, so don't rely on it!)

You can have as many modulators in a chain as you like and all of them could modify the same generator, provided that sfModSrcOper, sfModDestOper, and sfModSrcAmtOper are not the same.

NOTE; All possible sources are "real time" in nature, except for two "in-built" ones: Velocity and Key#. These two are specified once and for all in the MIDI note event and cannot change after a note has started. However, there are numerous other ways to change the note loudness or pitch in real time.

There are 10 so called "default" modulators:
1.  MIDI Note-On Velocity to Initial Attenuation - you are probably used to thinking that the lower the note velocity the lower will the note volume become. This is true only if this default modulator is in effect, which it mostly is. But it can be switched off or even turned around.

2. MIDI Note-On Velocity to Filter Cutoff - this modulator will make the low pass filter cutoff frequency lower at lower velocities, which is mostly a natural behavior. For example: if the cutoff frequency, initialFilterFc, is set to 20000Hz (no cutoff) then it will become 14900Hz for a note of velocity 100 and 7739Hz at velocity 40. NOTE: this modulator makes it totally unnecessary to define velocity splits with different cutoff frequencies for an instrument when the audio data is sampled at only one velocity.

3. MIDI Channel Pressure to Vibrato LFO Pitch Depth - use this modulator to change the value of the generator vibLFOtoPitch.

4. MIDI Continuous Controller 1 to Vibrato LFO Pitch Depth - use this modulator to change the value of the generator vibLFOtoPitch.

5. MIDI Continuous Controller 7 to Initial Attenuation - CC#7 is usually called "Volume (coarse)" and the expected behavior is to influence the overall output level of the sound.

6.  MIDI Continuous Controller 10 to Pan Position -  CC#10 is usually called "pan (coarse)" and the expected behavior is to influence the spatial position of a note in the stereophonic field.This is again an expected behavior.

7. MIDI Continuous Controller 11 to Initial Attenuation - CC#11 is usually called "Expression (coarse)" and the expected behavior is to influence the overall output level of the sound.

8. MIDI Continuous Controller 91 to Reverb Effects Send - SynthFont makes use of VST effects, so this modulator is not implemented.

9. MIDI Continuous Controller 93to Chorus Effects Send - SynthFont makes use of VST effects, so this modulator is not implemented.

10. MIDI Pitch Wheel to Initial Pitch Controlled by MIDI Pitch Wheel Sensitivity - the standard behavior is to change the pitch down or up in a liner fashion so that a maximum is two semitones swing in either direction, but all of this can be changed in many ways. For example, listen to these three notes:

More about the default modulators from the SoundFont specifications:
"These  modulator values are the default for the instrument level; IE they are not default at the preset level. The default modulators at the preset level are such that there is no additional control over any parameter. “Default” modulators are also refered to as “General MIDI” modulators because their settings and values match the MIDI specification.

Note that these modulators are implicit to the file format, so in order to turn them off one must explicitly put modulators in the appropriate level of the hierarchy to either supersede or negate the effect of these modulators."

Restrictions
From the SoundFont specification
: "CC index values 0, 6, 32, 38, 98 through 101, and 120 through 127 are ILLEGAL due to their nature as a MIDI functions rather than true MIDI controllers. Also, index values 33 through 63 should be reserved for LSB contributions of controller indices 1 through 31. If these index values are encountered, the entire modulator structure should be ignored." Additionally, SynthFont2 and it's siblings ignore modulators for some other CC:s as well: 5 (Portamento Time), 7 (Volume), 8 (Balance) ,10 (pan), 11 (Expression), 65 (Portamento On/Off Switch) and 84 (Portamento CC Control) as these have a very specific meaning in many MIDI files.