A modulator allows real-time control over the sound in a way the sound designer programs: each one defines a real-time, perceptually additive effect on one destination or synthesiser parameter (spec 9.5). Its record is on the modulator lists page. This page gives the values of its fields.
The source field (SFModulator)
A source value is a 16-bit number made of an index and bit fields (spec 8.2):
| Bits | Name | Meaning |
|---|---|---|
| 0 to 6 | Index | A 7-bit value that specifies the controller source |
| 7 | CC (C) | The MIDI continuous controller flag: 0 selects the general controller palette, 1 the MIDI controller palette |
| 8 | D | Direction: 0 from the minimum to the maximum, 1 from the maximum to the minimum (a key number of 0 gives the maximum output) |
| 9 | P | Polarity: 0 unipolar, from 0 to 1; 1 bipolar, from −1 to 1 |
| 10 to 15 | Type | A 6-bit value that specifies the continuity of the controller (the curve) |
General controller palette (C = 0)
Values not listed are reserved: if one is found, the entire modulator is ignored.
| Index | Controller | Source of the value |
|---|---|---|
| 0 | No Controller | No controller: its output is treated as if its value were 1. It is not a way to turn a modulator off |
| 2 | Note-On Velocity | The velocity of the MIDI note-on that made the sound |
| 3 | Note-On Key Number | The key number of the MIDI note-on |
| 10 | Poly Pressure | The poly-pressure amount of the MIDI poly-pressure command |
| 13 | Channel Pressure | The channel pressure amount of the MIDI channel-pressure command |
| 14 | Pitch Wheel | The pitch wheel amount of the MIDI pitch wheel command |
| 16 | Pitch Wheel Sensitivity | The sensitivity set with the MIDI RPN 0 command |
| 127 | Link | The output of another modulator. Not supported as an amount source |
MIDI controller palette (C = 1)
The index is one of the 128 MIDI continuous controller messages. Indexes 0, 6, 32, 38, 98 to 101 and 120 to 127 are illegal because they are MIDI functions rather than true controllers; indexes 33 to 63 are reserved for the least significant byte of controllers 1 to 31. If one of these is found, the entire modulator is ignored (spec 8.2.1).
Direction and polarity
With D = 0 the controller runs from its minimum to its maximum, with D = 1 from its maximum to its minimum. With P = 0 it is mapped from 0 to 1 (like the MIDI modulation wheel), with P = 1 from −1 to 1 (like the pitch wheel). Flipping P changes the bias and halves the resolution of the source; flipping D mirrors the slope (spec 8.2.2, 8.2.3, 9.5.2).
Source types
| Type | Name | Meaning |
|---|---|---|
| 0 | Linear | Moves linearly from the minimum to the maximum, in the direction and with the polarity of D and P |
| 1 | Concave | Moves in a concave fashion; the curve follows variations of output = log(sqrt(value^2)/(max value)^2) |
| 2 | Convex | The same curve as concave with the start and end points reversed |
| 3 | Switch | The output stays at its minimum while the input moves from its minimum to half of its maximum, then goes to its maximum |
The specification says that only one source type is “currently defined” and that if any of bits 11 to 15 are set the modulator is ignored. That wording conflicts with the table above, whose types 2 and 3 need bit 11, and with its own default modulators, whose type 1 sets bit 10 (0x0502 is type 1). The explorer reads the type as the 6-bit value of bits 10 to 15, accepts 0 to 3 and ignores a modulator with a larger type (spec 8.2.4).
Mapping of a controller to the input range
| Modulator source | Position | Native | Unipolar | Bipolar |
|---|---|---|---|---|
| 7-bit MIDI controller data value | Min | 0 | 0 | −128/128 = −1 |
| Max | 127 | 127/128 = +0.992 | 127/128 = +0.992 | |
| 14-bit MIDI controller data value | Min | 0 | 0 | −8192/8192 = −1 |
| Max | 8191 | 8191/8192 = 0.99999 | 8191/8192 = 0.99999 |
The maximum position cannot correspond to exactly 1 because MIDI has an even number of points (spec 9.5.3).
Transforms (SFTransform) and the amount
| Value | Name | Meaning |
|---|---|---|
| 0 | Linear | The output of the multiplier goes straight to the summing node of the destination |
| 2 | Absolute Value | The output is the absolute value of the input: output = square root ((input value)^2) |
The primary source is mapped into the −1 to 1 space by its direction and type, the amount source likewise; the amount source’s result is multiplied by the amount, then by the primary source’s mapped value, then passed through the transform and added to the destination’s summing node (spec 8.3, 9.5.1):
destination value += Transform(Amount * Map(primary source input) * Map(secondary source input))
A destination is the sum of the generator value and its modulators: Destination = Generator Value + Mod() + Mod() + Mod(), where each Mod is Transform(source * amount * amount source) (spec 9.5.1).
Linked modulators
The destination of a modulator is either a generator or a link to the source of another modulator, which lets two modulators chain into an enhanced effect. A link is marked by the top bit of sfModDestOper; the other 15 bits are the index of the target modulator in the zone’s list, relative to the first modulator of the zone. For example, the first and second modulators of a zone with the destination 0x8000 | 2 both feed the third, whose source is “link”. The destination is still a summing node, so several modulators may link to one, a chain may be longer than two, and the order of the modulators in the list does not matter. A circular reference is illegal, must be detected by the loader, and all modulators in it are ignored (spec 9.5.4).
The default modulators
The ten default modulators are implicit in the file format and belong to the instrument level; at the preset level the defaults are such that there is no additional control over any parameter. To turn one off, a modulator must be put in the file to supersede or negate it (spec 8.4). All have an amount source of 0x0000 (no controller) and the Linear transform, except the last, whose amount source is 0x0010.
| Spec | Name | Source | Destination | Amount | Amount source |
|---|---|---|---|---|---|
| 8.4.1 | MIDI Note-On Velocity to Initial Attenuation | 0x0502 (type 1 concave, P 0, D 1, CC 0, index 2) | Initial Attenuation (48) | 960 | 0x0000 |
| 8.4.2 | MIDI Note-On Velocity to Filter Cutoff | 0x0102 (type 0 linear, P 0, D 1, CC 0, index 2) | Initial Filter Cutoff (8) | -2400 | 0x0000 |
| 8.4.3 | MIDI Channel Pressure to Vibrato LFO Pitch Depth | 0x000D (index 13) | Vibrato LFO to Pitch (6) | 50 | 0x0000 |
| 8.4.4 | MIDI Continuous Controller 1 to Vibrato LFO Pitch Depth | 0x0081 (CC 1, index 1) | Vibrato LFO to Pitch (6) | 50 | 0x0000 |
| 8.4.5 | MIDI Continuous Controller 7 to Initial Attenuation | 0x0587 (type 1, D 1, CC 1, index 7); the specification prints 0x0582, which is index 2 | Initial Attenuation (48) | 960 | 0x0000 |
| 8.4.6 | MIDI Continuous Controller 10 to Pan Position | 0x028A (type 0, P 1, CC 1, index 10) | Pan (17) | 1000 | 0x0000 |
| 8.4.7 | MIDI Continuous Controller 11 to Initial Attenuation | 0x058B (type 1, D 1, CC 1, index 11) | Initial Attenuation (48) | 960 | 0x0000 |
| 8.4.8 | MIDI Continuous Controller 91 to Reverb Effects Send | 0x00DB (CC 1, index 91) | Reverb Effects Send (16) | 200 | 0x0000 |
| 8.4.9 | MIDI Continuous Controller 93 to Chorus Effects Send | 0x00DD (CC 1, index 93) | Chorus Effects Send (15) | 200 | 0x0000 |
| 8.4.10 | MIDI Pitch Wheel to Initial Pitch Controlled by MIDI Pitch Wheel Sensitivity | 0x020E (type 0, P 1, CC 0, index 14) | Initial Pitch | 12700 | 0x0010 (index 16, Pitch Wheel Sensitivity) |
Notes from the text: velocity 0 is a note-off, so it is not considered in the two velocity modulators; the stipulation of earlier versions that the velocity-to-cutoff modulator only applies when the volume envelope attack is under 7 ms was removed and may be added as an AWE32-compatibility mode; the controller 1 modulator may use controller 33 for more resolution. “Initial Pitch” has no generator number in the specification. The section for 8.4.6 names Initial Attenuation as its destination in the “Destination Enumeration” line, but its heading, its description (a position panned right, to be added to the Pan summing node) and its amount fit Pan, which is shown here. The text of 8.4.1, 8.4.2 and 8.4.8 to 8.4.9 calls the source “the MIDI key number” where the headings say velocity or controller.
In the explorer
The Modulators tab lists the ten defaults and every modulator of the file, with each source decoded (controller, curve, direction and polarity), its destination, amount, amount source, transform and whether it is ignored and why. The Note tab applies them: it shows, for a note, the modulators in effect and what each adds to its generator, and plays the note.
Source: SoundFont Technical Specification 2.04, sections 8.2 (8.2.1 to 8.2.4), 8.3, 8.4 (8.4.1 to 8.4.10), 9.5.1, 9.5.3 and 9.5.4. The default modulators and the controller list were compared with the specification text by scripts/sf2/check-tables.mjs. Figures 3 to 9 were read as images: figures 3 and 4 draw the building block (a primary source normalised, multiplied by the amount scaled by the normalised secondary source, a transform, and the destination summing node; figure 4 labels the inputs as native units and the amount in the destination’s units); figures 5 to 7 plot a positive unipolar, a positive bipolar and a negative unipolar linear source (the bipolar one runs from −1 at its minimum to nearly +1 at its maximum, the negative one is the mirror image); figure 8 draws the linear, concave, convex and switch curves in the four direction and polarity combinations (concave rises slowly then steeply, convex rapidly then flattening, switch steps at the middle of the range); figure 9 shows modulators 1 and 2 feeding the source of modulator 3.