SoundFont 3 keeps the whole RIFF structure of SoundFont 2 and extends it. The FluidSynth RFC says it explains only the differences from the SF2 specification and assumes the reader knows the SF2 file structure; the structure itself is therefore the one in SoundFont Technical Specification 2.04, sections 3 and 4.
Identification
An SF3 file is a RIFF chunk with the form type sfbk, and it uses major version 3 in the ifil sub-chunk: sfVersionTag.wMajor = 3 (FluidSynth RFC, “File identification”). MuseScore’s converter keeps the minor version of the SF2 it converts and sets the major version to 3 when it writes compressed samples (sftools sfont.cpp, writeIfil). A file with major version 2 and compressed samples, or major version 3 and none, is not told apart by anything but this field; the explorer reads the version to choose between SF2 and SF3.
The chunk and the levels
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | ckID | The chunk ID, four ASCII characters |
| 4 | 4 | ckSize | The size of the data in bytes, without the pad byte (DWORD, little-endian) |
| 8 | ckSize | ckDATA | The data, with a pad byte if needed to align the next chunk to a word |
| Level | Chunk | Holds |
|---|---|---|
| 0 | RIFF form sfbk | LIST INFO, LIST sdta, LIST pdta, in this order |
| 1 | LIST INFO | ifil, isng, INAM required; irom, iver, ICRD, IENG, IPRD, ICOP, ICMT, ISFT optional |
| 1 | LIST sdta | smpl (PCM samples, then compressed streams) and optionally sm24 |
| 1 | LIST pdta | phdr, pbag, pmod, pgen, inst, ibag, imod, igen, shdr, in this order |
The order of the three lists and of the pdta sub-chunks is fixed; INFO sub-chunks may be in any order; unknown INFO sub-chunks are ignored and unknown chunks elsewhere are illegal (SF2 spec 3.2, 4.1 to 4.3, 10.2). The data types are those of SF2: BYTE, CHAR, WORD, SHORT, DWORD, FOURCC, zero-terminated ASCII strings, the enumerations SFModulator, SFGenerator and SFTransform of two bytes, and the genAmountType union (spec 2.1, 4.4, 4.5).
Odd sizes and padding
RIFF chunks are padded to an even size. SF3 changes this for the sample data: “The length of the SMPL sub-chunk is no longer required to be a multiple of two. Its surrounding LIST chunk is also not padded to a multiple of two as a consequence” (FluidSynth RFC). The explorer therefore accepts an odd-sized smpl chunk and an odd-sized sdta list with no pad byte after it, and reads the next list from the byte right after them; any other chunk with an odd size and no pad byte is reported.
In the explorer
The Structure tab shows every byte of the file as chunks, sub-chunks, tables and records. The explorer reports a RIFF size that is wrong, a missing, repeated or misordered list, an unknown chunk, a missing table, and the sizes of tables that are not whole records, as for SF2.
Source: FluidSynth’s SoundFont3 RFC (File identification, Individually compressed samples); sftools sfont.cpp (SoundFont::write); SoundFont Technical Specification 2.04, sections 2.1, 3, 4 and 10.2.