Creating SoundFonts

At present, the project Java Program generates an intermediate Input Specification File, which is used by the utility program SF2Comp to actually create SoundFont files.

Input Specification (Text) File

The Input Specification File for the SF2Comp program is essentially an ASCII, human-readable mapping of a SoundFont (.SF2) binary file. However, default values are not listed. I have provided two files, dumps of Early Patches SoundFonts, for illustration in the following discussion. You can switch back and forth by clicking here after choosing a layer:

  1. Davul.txt (36 KB) is a relatively simple drum SoundFont, with a tediously repetitive specification of velocity blocks. Note that only f samples are used.
  2. Temple Bells 1.txt (4 KB), provided for contrast, is a melodic SoundFont.

SoundFont Internal Structure

SoundFonts consist of 3 layers plus a short information section. Key (MIDI Note Number) range and Velocity range are specified in both the Instrument and Preset layers, whichever is most convenient; the final range is the logical intersection of the two. This is also true for other parameter ranges.

[Samples]

(See the [Samples] section of the Input Specification File.)

The lowest layer. It maps directly to a WAVE (.WAV) file. SampleName specifies the internal name of the sample in the generated .SF2 file; it is also used by SF2Comp to name the .WAV file to be imported. Key is ignored for drum samples; it is used for melodic samples to identify the equivalent MIDI Note Number of the sample.

[Instruments]

(See the[Instruments] section of the Input Specification File.)

This intermediate layer allows grouping and common processing of samples. InstrumentName specifies the internal name of the instrument, which controls a number of the Sample names described above. GlobalZone parameters apply to all the Samples in an Instrument. For drums, this allows variable high frequency cutoff filters (GZ_initialFilterFc) to be mapped to MIDI Velocity values.

[Presets]

(See the[Presets] section of the Input Specification File.)

The highest layer, allowing further grouping and common processing, e.g. a gated patch for drums. Each Preset controls a number of the Instrument names described above. GlobalLayer parameters apply to all the Instruments in a Preset. As the equivalent of a MIDI patch, each Preset specifies a Bank and a Program (MIDI Patch Number).

[Info]

(See the[Info] section of the Input Specification File.)

An area for comments, version numbers, and miscellaneous global information. This description provided for completeness. My Java program generates a hard-coded [Info] section.

The SF2Comp Program

SF2Comp is an MS-DOS (not a Windows) program, so it is run in an MS-DOS window (“Makes sense to me!”). Assume that there is a folder C (for Compile) with sub-folders for each drum, including the Davul. In folder C\Davul is the Input Specification File Davul.txt, along with all the WAVE sample files it specifies. In order to create the SoundFont file Davul.sf2 in folder C, type the following on the command line:

	sf2comp c C\Davul\Davul C\Davul

In addition to the output file, a running commentary is generated that overflows the screen, so it should be redirected to a file.

Documentation File

I have included a link to SF2CompV1.doc, the SF2Comp Help File (75 KB). It is readable with any Microsoft Word compatible editor or with Internet Explorer. This document lists everything you ever wanted to know about SF2Comp, as well as useful information about SoundFont files.

Batch Processing

In order to save typing, I use an MS-DOS batch file, c.bat, containing the following command line:

	sf2comp c C\%1\%1 C\%1 ›C\%1\out.txt

The %1 is replaced by the first argument. So by typing “c Davul”, as shown below, some typing is saved, and the commentary is diverted to C\Davul\out.txt.

c Davul