The sdta list of an SF3 file holds the smpl chunk, and optionally sm24, as in SF2; what changes is what smpl may contain (FluidSynth RFC, “Individually compressed samples” and “24-bit PCM samples”).
The smpl chunk
- Mixed compression is supported: the chunk may hold ordinary SF2 PCM samples and any number of individually encoded samples.
- If there are PCM samples they must be at the beginning of
smpl, before the compressed byte streams. The PCM samples are 16-bit little-endian words, as in SF2. - Each sample is compressed on its own, for example by the Ogg Vorbis encoder, and the byte streams of all encoded samples are written to
smplone after another. In MuseScore’s converter the first byte of a stream is the end of the one before it: each stream’sdwStartis the previous stream’sdwEnd(sftoolswriteSmpl, and the files of the corpus). - For a compressed byte stream the 46 zero-valued data points that SF2 requires after each sample are not needed.
- The size of the chunk need not be a multiple of two, and its LIST is not padded (see file structure).
MuseScore’s converter sets the compressed flag on every sample of the SF2 it reads and writes each as a stream, so its output has no PCM samples (sftools writeSmpl: s->sampletype |= 0x10 for each sample). VintageDreamsWaves-v2.sf3 has 123 Ogg Vorbis samples and a first sample whose type is 0x8011, both ROM and compressed.
The sm24 chunk
“The basic logic of the 24-bit support brought by the 2.04 spec remains unchanged”: sm24 may hold the least significant byte of each PCM data point, one byte for every two bytes of PCM in smpl. Compressed samples make no use of it; the bytes of sm24 that would correspond to the compressed streams stay unused, and because all PCM samples come first, sm24 can be kept as short as the PCM samples need. The RFC adds that the SF2 size constraint of sm24 “no longer applies”, with four question marks, and does not say what rule replaces it. In SF2 the chunk is half the size of smpl, plus a byte if that is odd, and is ignored when its version is below 2.04 (SF2 spec 6.2).
What FluidSynth does (fluid_sffile.c, the code that reads the sdta list): it looks for sm24 after smpl only when its test version.major >= 2 && version.minor >= 4 holds, which a file of version 3.00 fails, and it ignores the chunk unless its size is exactly half of the whole smpl chunk (the compressed streams included), plus one if odd: the SF2 rule, kept. So the RFC and FluidSynth disagree about the size, and FluidSynth’s version test reads 3.00 as below 2.04.
The explorer uses sm24 for a PCM sample whenever ifil is 2.04 or later (3.00 included) and the chunk covers the sample’s data points, whatever its length (the RFC), and reports, as a problem on the chunk, when its size is not what the SF2 rule gives for the whole smpl chunk or its version has a minor number below 4, saying that FluidSynth would ignore it.
Loop rules
For PCM samples the SF2 looping rules apply: a loop is a pair of equivalent points, the end point is never played, and data around both points must be continuous, with eight valid points before the loop start and after the loop end, forced identical for a portable loop (SF2 spec 6.3). For compressed samples the loop points are in decoded data points, counted from the start of the sample (see sample headers).
In the explorer
The Overview says how many samples are compressed and how large smpl is. The explorer reports a compressed sample that lies before PCM data, a SoundFont 3 file with no compressed sample, and every problem of a PCM sample as for SF2.
Source: FluidSynth’s SoundFont3 RFC (Individually compressed samples; 24-bit PCM samples); sftools sfont.cpp (writeSmpl); SoundFont Technical Specification 2.04, sections 6.1 to 6.3; the corpus files VintageDreamsWaves-v2.sf3 and FluidR3Mono_GM.sf3.