The synthesis model of SoundFont 2 originates with the EMU8000 wavetable synthesiser chip. The specification describes it so that it can be mapped onto other hardware (spec 9). This page summarises the model and gives the units the generators are measured in.
The synthesis model
The model has a wavetable oscillator, a dynamic low-pass filter, an enveloping amplifier and programmable sends to pan, reverb and chorus effects units; underneath are two low frequency oscillators and two envelope generators with their routing amplifiers (spec 9.1).
- Wavetable oscillator. Plays a sample at an arbitrary rate and pitch shift. Upward shifts are limited in practice, typically to at least two octaves. The pitch is set by the sample’s rate, its root key, the coarse, fine and correction tunings, the effective key number and the key scale factor; all modulation of pitch is in octaves, semitones and cents (spec 9.1.1).
- Sample looping. The sample is described by a start, an end and two loop points. If unlooped the loop points are ignored. If it loops during release, it plays from the start through the loop and loops until the note is inaudible. Otherwise it plays through the loop until the key is released; then, the next time the loop end is reached, it continues through it and plays to the end point, where the audio stops (spec 9.1.2).
- Low-pass filter. Resonant, with a dynamic cutoff and a fixed resonance (Q). The ideal filter has a flat passband to the cutoff and a rolloff of 6 dB per octave above it; the resonance is a peak at the cutoff measured in dB above the DC gain, and the DC gain is half the resonance value below the DC gain at zero resonance. Figure 1 of the specification draws the ideal response: a flat line to the cutoff frequency, a bump for the resonance at the cutoff and a falling line labelled “Rolloff 12 dB/oct”. The figure’s 12 dB per octave (a second-order filter) disagrees with the text’s 6 dB per octave (spec 9.1.3).
- Final gain amplifier. A multiplier on the filter output controlled by an initial gain in dB, added to the volume envelope and other modulation (spec 9.1.4).
- Effects sends. The amplifier output goes to an effects unit that places the sound in the stereo field (pan) and adds reverb and chorus, the two sends as a percentage of amplitude from 0% to 100% (spec 9.1.5).
- Low frequency oscillators. A vibrato LFO that modulates pitch only and a modulation LFO that can modulate pitch, filter cutoff and volume. An LFO holds zero for a delay, then ramps as a triangle wave to +1, down to −1 and so on. Pitch and cutoff modulation are in octaves, semitones and cents, amplitude modulation in dB, specified for the full positive excursion (spec 9.1.6).
- Envelope generators. A volume envelope that controls the final gain amplifier and a modulation envelope for pitch and filter cutoff. An envelope has six phases: delay (zero), attack (rising in a convex curve to one), hold (at one), decay (linearly to the sustain level), sustain, and, at key-off, release (linearly from the current value to zero). The volume envelope works in dB; the EMU8000 provides 96 dB of amplitude control and jumps to zero gain at 96 dB of attenuation (spec 9.1.7).
- Interconnections (Figure 2, “Generator Based Modulation Structure”, spec 9.1.8): the oscillator feeds the filter, which feeds the amplifier. The modulation envelope drives the pitch of the oscillator and the cutoff of the filter; the vibrato LFO drives the pitch; the modulation LFO drives the pitch, the cutoff and the volume of the amplifier; the volume envelope drives the volume. The amplifier’s output goes to two outputs through the pan, and through the reverb and chorus units, each with its own send, to the same two outputs.
Parameter units
| Unit | Definition |
|---|---|
| Absolute sample data points | A numeric index of 16-bit sample data point words as stored in ROM or supplied in smpl; the first word of the memory or the chunk is zero |
| Relative sample data points | A count of 16-bit sample data point words from an absolute reference; negative means toward the start of the data |
| Absolute semitones | A logarithmic measure of frequency from MIDI key numbers: a semitone is 1/12 octave and value 69 is 440 Hz (A-440); negative values and values above 127 are allowed |
| Relative semitones | A relative logarithmic measure of frequency ratio in units of the twelfth root of two, about 1.059463094 |
| Absolute cents | A logarithmic measure of frequency from MIDI key number times 100: a cent is 1/1200 octave and 6900 is 440 Hz; negative values and values above 12700 are allowed |
| Relative cents | A relative frequency ratio in units of the twelve hundredth root of two, about 1.000577790 |
| Absolute centibels | A measure of attenuation of a signal with zero being no attenuation; a centibel is a tenth of a decibel, an amplitude ratio of the two hundredth root of 10, about 1.011579454 |
| Relative centibels | A relative measure of attenuation in the same unit |
| Absolute timecents | A measure of time with zero being one second; a timecent is a time ratio of the twelve hundredth root of two |
| Relative timecents | A relative time ratio in the same unit |
| Absolute percent | A measure of gain with unity as reference; in SoundFont 2 in 0.1% units, so 0 is 0% and 1000 is 100% |
| Relative percent | A relative gain difference in 0.1% units; below zero the gain is taken as zero and above 100% as 100% |
(Spec 9.3 and the terminology of 2.3. The definition of the timecent in section 9.3 gives “approximately 1.011579454”, the centibel’s ratio; section 2.3 gives 1.000577790, which is the twelve hundredth root of two.)
Implementation accuracy
The specification expects “a best practical reproduction”: the order of interpolation of sample points, the shape and number of segments of envelopes, the filter implementation and the loop details differ between engines, real implementations are less accurate than the units, line segments approximate curves and filters have to be matched by ear (spec 9.7).
The explorer’s synthesiser
The Note tab of the explorer starts a note (a bank and program, a key, a velocity, the controllers 1, 7, 10 and 11, the pitch wheel and the channel pressure, and a list of events after the key-on) and shows what the specification makes of it, then plays it. It follows the specification where the specification is exact and, where it is not, FluidSynth, which was built from source and run as the check (below).
What it does
- Selects the voices: every preset zone whose key and velocity ranges contain the note, and in its instrument every zone whose ranges do: a preset zone’s range is an intersection filter over its instrument’s zones (spec 9.4). The
keynumandvelocitygenerators replace the key and velocity used for modulators and pitch (8.1.1). - Combines the generators: the default of each generator, replaced by the global instrument zone’s value, then the local one’s; the preset zones’ values (global, replaced by local) are added; the sum is limited to the useful range of the summary table (8.5, 9.4, 10.5).
- Combines the modulators: the ten default modulators; those of the global and local instrument zones replace identical ones and add the others; the preset zones’ add to an identical modulator’s amount or are added as further modulators (9.5.1). Each modulator’s output is
Transform(amount × Map(source) × Map(amount source))with the curves of the four source types (8.2.4, 9.5.2) and the 7-bit and 14-bit mappings of 9.5.3; linked modulators feed each other (9.5.4). The outputs are summed per destination and added to the generator value. - Plays the oscillator: the sample at its header rate with the tuning of the root key (the header’s, or
overridingRootKey), the key,scaleTuning,coarseTune,fineTune, the pitch correction and the pitch-wheel modulator; the address-offset generators; no loop, a loop, or a loop until the key is released (sampleModes); a 4-point cubic interpolation. - Shapes the sound: the volume envelope (delay, attack that rises linearly in amplitude, hold, decay and release that are linear in dB, a sustain level in centibels), the modulation envelope (with a convex attack, linear decay and release), the vibrato and modulation LFOs (triangle, with delay and frequency), the key-number scaling of the hold and decay times, the modulation envelope and LFOs to pitch and cutoff, the modulation LFO to volume, the low-pass filter (a second-order filter with resonance) and the initial attenuation.
- Pans with an equal-power sine law between left and right.
What it does not do
- It applies no reverb or chorus unless the option “Reverb and chorus (as FluidSynth does it)” is on: the specification defines only their sends (9.1.5) and no algorithm, so the effects themselves stay Unknown in the format. The option adds FluidSynth’s (below).
- It plays one channel: one preset, with the controllers shared by all its notes.
The Events box: changes during a note
The Note tab also takes a list of events, one per line or separated by semicolons, each a time in seconds, a kind and its numbers: cc <controller> <value>, bend <0 to 16383>, pressure <0 to 127>, nrpn <generator> <0 to 16383>, on <key> <velocity> and off <key>. For example 0.5 cc 7 40; 1 bend 12000; 1.2 nrpn 8 9000; 1.5 on 64 100; 2 off 64. A table of the events accepted (and each one refused, with the reason) is shown in the tab. What each event does:
- Controllers, pitch wheel and pressure (spec 9.2, 9.5): the controller state changes at that time; every sounding voice is evaluated again with it (all modulators, so a controller 7 or 1 or a bend acts as it would at the start of a note), and the new generator values are used from then on. The envelope times, the LFO rates and the sample are fixed when the key goes down; they are not re-evaluated.
- Sustain pedal (controller 64, on at 64 or more; 9.2): a key-off while the pedal is down waits until the pedal goes up. All notes off (123) releases every note; all sound off (120) stops them at once.
- NRPN (9.6):
nrpn 8 9000is the message “select MSB 120, LSB 8, data 9000”. The data, centred on 8192, is added to the generator like a modulator’s output, in steps of the generator’s scale: the useful range of the summary table is halved until it is 8192 units or fewer (generator 8, a range of 12000 cents, moves 2 cents a step; generator 48, 1440 centibels, 1 centibel a step). Generators that are not real-time (43, 44, 46, 47, 54, 56, 57, 58) are ignored, as the specification says (the selection is ignored). With “Like FluidSynth” the scale comes from FluidSynth’s own table (fluid_gen.c: 2 for the pitch, cutoff and time generators, 4 for the two LFO frequencies, 1 for the rest), which is not the specification’s rule in every case (the delays, for example, are 2 where the rule gives 4). - Exclusive class (generator 57, 8.1.2): when a key goes down, the earlier notes of the same non-zero class in the same preset are ended “rapidly”. The specification gives no speed. FluidSynth (
fluid_synth_kill_by_exclusive_class_LOCAL,fluid_voice_kill_excl) gives them a volume release of −200 timecents (about 0.5 s) and so does this synthesiser, in both modes. - Timing, as FluidSynth: in “Like FluidSynth” a controller change, key-on or key-off takes effect at the start of the next block of 64 frames (
FLUID_BUFSIZE), and the volume and pan are ramped linearly across that block, so a sudden change of controller 7 does not click. Without the option the change is exact to the frame and a step.
The events were checked against FluidSynth with 11 cases (controller 7 and 10 sweeps, pitch bend, channel pressure, controller 1, NRPN on generators 8, 22 and 48, the sustain pedal, all notes off, a second note with and without a key-off) and a built bank with an exclusive class: the whole-note level agrees within 0.3 dB and every 100 ms window within 0.5 dB, with waveform correlations of 0.999 or 1.000. One known difference: after an NRPN change of the cutoff, FluidSynth’s filter coefficients are not the same arithmetic as this synthesiser’s, and the highest peak of the note differs by 4 dB (case 29 of the check) while the level of every 100 ms window agrees within 0.25 dB; the cause was not traced.
Reverb and chorus, as FluidSynth does it
With the option “Reverb and chorus (as FluidSynth does it)” the note goes through a port of FluidSynth’s two effects units, with FluidSynth’s default settings. This is FluidSynth’s design and not the SoundFont format’s: the specification does not say what the effects do, and other players sound different. Read from rvoice/fluid_rev_dattorro.cpp, fluid_rev_filters.h, fluid_chorus.c, rvoice/fluid_rvoice_mixer.cpp and synth/fluid_voice.c, fluid_synth.c, fluid_synth.h of the source built for the check.
- The sends. A voice’s reverb send is its generator 16 and its chorus send its generator 15, each divided by 1000 and limited to 0 to 1 (the default modulators of controllers 91 and 93 add up to 200, so a controller at 127 sends 20%). The send takes the voice’s signal after the filter and with the same gain as the dry output, but without the pan; the sends of all voices are summed into one mono input for each unit. The units process 64 frames at a time and add their stereo output to the dry output.
- The reverb is FluidSynth’s default engine, “dat” (its setting
synth.reverb.engine; the other engines, fdn, free and lex, are not ported): a plate reverb after Jon Dattorro. The input is scaled by 0.6, delayed 4 ms, low-passed (bandwidth 0.9999), passed through four allpass diffusers (0.75, 0.75, 0.625, 0.625) and into two cross-coupled tanks, each an allpass (0.7 then 0.5), a delay, a damping low-pass and the decay gain; the left and right outputs are sums of seven taps of the tank delays and allpasses each. The delay lengths and taps are those of the paper’s tables for 29761 Hz, rescaled to the sample rate. With the defaults the room size is 0.5 (decay 0.2 + 0.78 × 0.5), damping 0.2, width 0.8, level 0.7. The state is single precision, as in FluidSynth. - The chorus is three taps (default) of one delay line of 2048 samples, each read at a position that a sine moves (0.2 Hz, in three phases 120° apart, updated every five samples) by up to 4.25 ms peak to peak, with first-order allpass interpolation; the taps alternate between the two channels, the width is fixed at 10 and the level is 0.6.
The check plays 10 further notes with both (cases 35 to 44 of the script: VintageDreamsWaves-v2.sf2 and florestan-subset.sf2, reverb alone, chorus alone, both, a controller 91 and 93 sweep during a note, a 2 s note with the volume changed). In six of them the level of the whole note is within 0.1 dB and every 100 ms window within 0.25 dB (correlation 0.999 or 1.000), down to windows 100 dB below full scale. In the other four the tail of the reverb, 40 to 60 dB under the note, differs by up to 2.6 dB in a 100 ms window; those are the notes whose dry waveform correlates only 0.92 to 0.98 (a vibrato, or a long sustained loop), and the cause was not traced further, so the reverb is not claimed exact for them.
Where the specification gives no exact rule, and FluidSynth
With the option “Like FluidSynth” the synthesiser makes the choices FluidSynth makes; without it, it follows the specification’s text. They differ in these places, each found by comparing a render with FluidSynth’s and then reading its source (fluid_defsfont.c, fluid_synth.c, fluid_mod.c, fluid_voice.c, the tables of gentables):
| Where | The specification | FluidSynth |
|---|---|---|
| Initial attenuation generator of an instrument or preset | Centibels, no factor (8.1.2 number 48) | Multiplies the value by 0.4, “as EMU8k/10k hardware does” (EMU_ATTENUATION_FACTOR) |
| The low-pass filter’s passband | Flat at zero resonance; the resonance lowers the DC gain by half its value (9.1.3) | Adds 1.5 dB (half of 3.01 dB, its Butterworth reference) and is always on |
| Default modulator 8.4.2, velocity to cutoff | −2400 cents at velocity 1, none at 127 | Does not apply it (a comment in fluid_mod.c says it stops forcing velocity-based filtering) |
| Default modulator 8.4.6, controller 10 to pan | Amount 1000 (tenths of a percent panned right) | Amount 500, reading 1000 as the value for the full 50% a pan can reach; the pan generator spans −500 to 500 |
| Volume envelope decay and release | The time for a change of 100 dB | The time for its 96 dB range (960 centibels) |
| The curves of the source types | The equation of 8.2.4, which does not fit the pictures | A table made to fit the pictures of 9.5.2: concave(i) = −(400/960)·log10((127 − i)/127), convex its mirror |
| Pan law | None; the example (−250 gives 75% left and 25% right) is linear | A sine table: each side sin(position × π/2), so the centre is −3 dB |
| Sum of preset and instrument values | Limited to the useful range after summation, and the order against the modulators is not stated (10.5) | Limits the sum of the generators first, adds the modulators, and limits again |
How close it is
The check (scripts/sf2/compare-synth.mjs, run by parser-test/test-sf2-built.mjs) plays 35 notes with both: VintageDreamsWaves-v2.sf2 (loops, envelopes, vibrato, filters with and without resonance, stereo pairs), florestan-subset.sf2, three of the same notes from the SF3, notes with other controllers 7, 10 and 11, and eleven notes with events (above). The figures that follow are for the first 24. With “Like FluidSynth”, the level of the whole note agrees within 0.3 dB (an SF3 within 2 dB, its Vorbis samples being a little different), the level of every 100 ms window within 0.5 dB (1.5 dB for the one note with a very resonant filter swept by the modulation envelope), and the waveforms correlate at 0.98 to 1.000 in 12 of the 18 notes played from SF2 files, at 0.83 to 0.92 in five others and at −0.44 in the note with the very resonant filter. The lower ones are notes with a vibrato or modulation LFO or a filter sweep: the two synthesisers’ LFOs and filters are not the same arithmetic, so their waveforms are not sample-identical. FluidSynth was built with libsndfile off, so it cannot read an SF3: the SF3 notes are compared with FluidSynth playing the SF2 it was made from. The sources of the curves and tables are in research/sf2/fluidsynth-src.
Source: SoundFont Technical Specification 2.04, sections 2.3, 9.1 (9.1.1 to 9.1.8, with figures 1 and 2 read as images), 9.3 and 9.7; FluidSynth’s source files named above for the right-hand column.