What are SF2 Soundfonts?

SoundFont is a brand name which refers to a file format and it’s associated technology that uses sample-based synthesis to play audio from MIDI files via a soundcard. It was first used on the Sound Blaster AWE32 sound card as part of it’s General MIDI support. (The original GM Soundfont file is available from this website Musicalartefacts.com).
A SoundFont bank contains base samples in a Pulse Code Modulation format (the audio format most commonly used in WAV containers) mapped to sections on a musical keyboard. A SoundFont bank can also contain other music synthesis parameters such as loops, vibrato effect, and velocity-sensitive volume changing.
SoundFont banks can conform to standard sound sets such as General MIDI, or use other wholly custom sound-set definitions like Roland GS and Yamaha XG. If you have the necessary software, along with the time and patience you can also create your own SF2 files.

The structure of a basic SF2 Sample player is shown below. Apart from the standard ADSR/VCA there are three sections of note, shown with Blue, Green & Red backgrounds.

Note: This oscillator is only compatible with SF2 SoundFonts, it does not support SF3 or SFZ Soundfont file formats, neither does it support WAV or any other format of audio files.

Note: The SF2 Sample player is not really suitable for use in a true Wavetable Synthesizer.

Blue: SF2 Selection and Patch Loading

This section is where the main difference between a completely DSP Synthesizer, and a SF2 synthesizer resides. The required SF2 Bank of sounds is sample is selected from the File select menu. The individual sound font required to be played is then selected using the List Entry 3 – Patch module, which uses the GUI and DSP Sample Loader modules to load the required sample into the Sample Oscillator. Depending on the Patch itself it will either have an infinite loop (i.e. a string instrument sample), or a naturally decaying “single shot” (i.e. a guitar or piano sample).

Red: SF2 Sample Oscillator.

Oscillator is a bit of a misnomer (personal opinion) as it doesn’t create anything itself. The Patch is loaded into the player, and if the sound is looped, it will play indefinitely. If the sound is naturally decaying then it will just play one single time.
This is set in the patch itself, and cannot be altered at this point.
We still need to instruct the Oscillator what pitch to play the sample at, and there are also a Gate plug and a Trigger plug. The oscillator will still work without these plugs being connected, but you’ll have to re-start the audio engine to get the new patch to load.

Green: MIDI Control.

As usual we need a MIDI-CV2 module for Pitch, Trigger, Gate and Velocity signals (Aftertouch is not supported with the SF2 Oscillator).
The one important difference here is that the MIDI Patch Automator must be included for the Selection and Loading of our samples.
Note: If you are using Polyphonic mode the Allocation Mode must be set to Poly (Hard) to prevent clicking noises.

Apart from these points, you can treat the Sample Oscillator as any other SE Sound generator. The audio can be filtered, waveshaped and otherwise creatively altered. The output is Stereo, as some Soundfont patches are recorded in stereo.

The FAQ section on Soundfonts from the SynthEdit website.

Distributing Soundfonts, Wave, and MIDI Files.

Please read this section very carefully to prevent problems with “missing” soundfonts.

Often a VST will need to load one or more Soundfonts automatically. For example, your VSTs may use Soundfonts as built-in waveforms. On the end user’s PC, these Soundfonts need to be installed in the plugin VST’s folder.
Example:

VST plugin:MySynth.dll
Soundfont:Drums.sf2
VST path:C:\Program Files\Common Files\VST3\MySynth\MySynth.vst3
Soundfont path:   C:\Program Files\Common Files\VST3\MySynth\Drums.sf2

The Soundfont must be in the same folder as the VST Plugin. Under ideal circumstances, you would create an installer that copies both the VST and required Soundfont to the customer’s hard drive. Each plugin you create needs to be in it’s own folder so the plugin can correctly locate any resource file.

Relative Paths

Since you don’t know the end user’s plugin folder, store Soundfont filenames as a relative path. A relative path does not contain the full Drive or folder specification, e.g. “C:\SomeFolder\”.

 Before you hit ‘Export-as-Plugin’ check your Sample-Player module is using relative paths. Select the module. Locate any filename parameters (e.g. ‘Sample Loader2 Filename” ) on the Properties panel (at far right). Check if the ‘Value’ column contains a ‘relative’ filename like “Drums.sf2”. If it contains folder references ( like “C:\Samples\Drums.sf2) you must remove the drive and folder parts. i.e. change it to just “Drums.sf2”.

Important Note: Simplifying the filenames can prevent them from loading in the SynthEdit editor because SynthEdit no longer knows what folder they are in. You can either ignore these warnings and revert the filenames after you have exported the plugin, or put the Soundfonts in SynthEdit’s default audio file location. Look in the menu “Edit/Preferences/File Locations/Audio Files” for this folder. This is where SynthEdit looks for files with relative filenames.

To have SE automatically use relative paths – You must set your default audio folder before you load the Soundfont, not after. Otherwise, SynthEdit will use the full path. Alternately: set the default audio folder, then un-load the SoundFont, then re-load the SoundFont.

If you follow this simple guidelines you should have no issues with using SF2 soundfonts or the Sample Oscillator.