Documentation

SoundFont source profile

The parser and compiler are independently authored from the Creative/E-mu SoundFont 2.04 Technical Specification, February 3, 2006. No third-party sampler implementation is incorporated. SF2 sample data remains in the granted file reader; SF3 compression is outside this format profile.

The source version controls admission of sm24 exactly as section 6.2 specifies. The compiler preserves the complete preset directory and resolves preset/instrument global/local hierarchy according to sections 8.5, 9.4 and 9.5. Duplicate preset addresses select the first entry. Sample ends and loop ends are exclusive in the compiler; the shared sampler region table uses inclusive final indices. Each original sample has one mono provider view spanning the union of its referenced zones. Stereo-linked headers do not cause automatic extra voices.

Explicit specification interpretations

  • Section 8.4.5 identifies CC7 in its heading and explanation but prints a source constant whose index is 2. The implementation uses CC7 (0x0587). Section 8.4.6 describes pan throughout but labels its destination attenuation; the implementation uses pan, generator 17.
  • Section 8.4.6 also prints a default pan amount of 1000 despite bipolar source endpoints and generator bounds of -500 to +500. This profile uses 500 for the synthesized default route, preserving the full controller travel; explicitly authored amounts remain unchanged. Seven-bit unipolar inputs use exact 0/127 endpoints; bipolar inputs center at 64 and reach exact -1/+1 endpoints. These resolve conflicting endpoint examples in sections 8.4 and 9.5.3 and are explicit profile choices, not claims of binary reference-renderer parity.
  • The final SF2 stereo pan law uses constant power: for resolved pan p in -1 to +1, left and right amplitude gains are sqrt((1-p)/2) and sqrt((1+p)/2). The center sends approximately 0.7071 amplitude to each side; intermediate positions retain unit summed power. Section 8.1.2 describes percentages of full signal level without prescribing whether they measure amplitude or power. This is an explicit independent profile, not a claim that every reference renderer uses the same pan law. The existing SFZ pan law is separate.
  • The default pitch-wheel route names Initial Pitch without a file generator number. The compiled graph reserves internal destination 60 for initial pitch; file generator 60 remains reserved and ignored. Sample pitch correction is added once; it is not subtracted from the root key.
  • Section 9.5 defines modulator identity using source, destination, amount source and transform. That definition controls hierarchy and duplicate replacement, including zero-amount overrides of defaults. Linked destinations are zone-relative, may have multiple incoming routes, and are topologically ordered. Cycles are ignored with diagnostics, as required by section 9.5.4.
  • Reserved/illegal generator and modulator enumerators are ignored with diagnostic counts following section 10.3. Structural bounds and invalid references reject the bank. Known supported generators are never silently omitted as an implementation shortcut.
  • Section 10.5 clips out-of-range synthesis values. After sample-address generators are applied, loop endpoints are clipped to the playable sample interval. If the adjusted pair crosses or collapses, this profile restores the original header loop pair within that interval, following section 10.4’s optional-generator recovery. If that pair is also invalid, preparation fails. Recovery is counted; it is not a claim that unspecified malformed-file behavior matches every other sampler.

Compiled representation

SF2 uses bank version 9 with an 18-word header, shared sample metadata and cache, and a four-word preset directory. Header words 16 and 17 locate/count that directory; each entry contains bank, program, first region and region count. Header word 15 retains stream bit 0 and adds source-profile bit 16. Preset names stay outside the audio-thread payload.

The modulation section is version 2. Each region has 61 float generator values in original SF2 units, and ten-word modulation routes. Address generators are already applied to shared sampler region addresses and must not be applied a second time. Source profile rendering must bypass SFZ’s implicit velocity, CC7/11, pitch-bend and envelope behavior so the compiled SF2 matrix is evaluated exactly once.

Manual per-channel preset parameters store bank * 128 + program, with -1 meaning Follow MIDI. Runtime selection resolves that address to a preset index; existing voices keep their birth preset. The bank and sample provider are shared across all sixteen MIDI channels.

Chorus and reverb sends use EffeTune’s own Chorus and FDN Reverb kernels with fixed wet-only settings. SoundFont defines the sends but does not prescribe those effect algorithms. Effects are prepared at the actual output sample rate, then processed only after a successful sampler transaction; silent sends skip their DSP once tails settle. Their bounded processing storage is separate from the configured bank/sample-cache budget, as is other voice and rendering state.

The SF2 low-pass filter follows sections 8.1.2 and 9.1.3: resonance R in centibels reduces DC amplitude to 10^(-R/400), while the cutoff-to-DC amplitude ratio is 10^(R/200) for positive resonance. Zero resonance uses a nonresonant Butterworth response; above 20 kHz it bypasses the filter. Positive modulation-LFO volume depth increases amplitude during positive excursions, rather than adding attenuation. Numeric response and stability tests live in dsp/plugins/others/sfz/sf2_profile_test.cpp; the sampler tests cover rendered LFO direction, pan gains and channel-local All Sound Off with both pedals held.

Parser/compiler acceptance and structural serialization do not by themselves demonstrate native, WebAssembly or live/offline rendering coverage. Rendering evidence must accompany the owning engine implementation.