The SF2 RMIDI extension lets an RMI file carry a SoundFont 2 bank, a nested
RIFF chunk whose form type is sfbk. It holds a preset’s
sounds and how they are played. An SF3 bank is the same layout with the samples
compressed as Vorbis. All numbers are little-endian. The fields here are those of the
SoundFont 2.04 specification; see the
INFO entries for how the bank
offset applies.
Structure
RIFF 'sfbk'
LIST INFO names and versions
LIST sdta smpl (samples), sm24 (low bytes, optional)
LIST pdta phdr pbag pmod pgen inst ibag imod igen shdr
LIST INFO
| ID | Meaning |
|---|---|
ifil | The SoundFont version: major and minor, u16 each |
isng | The target sound engine |
INAM | The bank’s name |
irom | The sound ROM the bank uses |
iver | The ROM version: major and minor |
ICRD, IENG, IPRD, ICOP, ICMT, ISFT | Creation date, designers, product, copyright, comments, software |
Sample data (sdta)
smpl holds every sample’s data as 16-bit little-endian numbers, each
sample followed by at least 46 zero samples, so that interpolation runs off cleanly.
sm24, new in 2.04, has one low byte for each sample, making them 24-bit.
In an SF3 bank a sample’s data is Vorbis and its header’s start and end count bytes.
Tables (pdta)
Nine tables of fixed-size records. Each ends with a terminal record that only marks where the one before it stops.
| Chunk | Record | Size | Fields |
|---|---|---|---|
phdr | Preset | 38 | Name (20 chars), preset, bank (128 is drums), first zone (pbag), then library, genre, morphology, which are reserved |
pbag | Preset zone | 4 | First generator, first modulator |
pmod | Preset modulator | 10 | See below |
pgen | Preset generator | 4 | Generator number, amount |
inst | Instrument | 22 | Name (20 chars), first zone (ibag) |
ibag | Instrument zone | 4 | First generator, first modulator |
imod | Instrument modulator | 10 | See below |
igen | Instrument generator | 4 | Generator number, amount |
shdr | Sample | 46 | Name (20 chars), start, end, loop start, loop end (u32, in samples), sample rate, original key, pitch correction (cents, signed), sample link, sample type |
Sample type
1 mono, 2 right, 4 left, 8 linked; the top bit, 8000, marks a sample held in ROM. 10 is added in SF3 for a Vorbis sample.
Generators
A generator sets one sound parameter. The amount is a signed 16-bit number, except
ranges (keyRange, velRange), a low and a high byte. Units
are samples (smpls), cents, decibels × 10 (cB) and timecents
(1200 per octave of time).
| # | Generator | # | Generator | # | Generator |
|---|---|---|---|---|---|
| 0 | startAddrsOffset | 21 | delayModLFO | 42 | reserved1 |
| 1 | endAddrsOffset | 22 | freqModLFO | 43 | keyRange |
| 2 | startloopAddrsOffset | 23 | delayVibLFO | 44 | velRange |
| 3 | endloopAddrsOffset | 24 | freqVibLFO | 45 | startloopAddrsCoarseOffset |
| 4 | startAddrsCoarseOffset | 25 | delayModEnv | 46 | keynum |
| 5 | modLfoToPitch | 26 | attackModEnv | 47 | velocity |
| 6 | vibLfoToPitch | 27 | holdModEnv | 48 | initialAttenuation |
| 7 | modEnvToPitch | 28 | decayModEnv | 49 | reserved2 |
| 8 | initialFilterFc | 29 | sustainModEnv | 50 | endloopAddrsCoarseOffset |
| 9 | initialFilterQ | 30 | releaseModEnv | 51 | coarseTune |
| 10 | modLfoToFilterFc | 31 | keynumToModEnvHold | 52 | fineTune |
| 11 | modEnvToFilterFc | 32 | keynumToModEnvDecay | 53 | sampleID |
| 12 | endAddrsCoarseOffset | 33 | delayVolEnv | 54 | sampleModes (0 no loop, 1 loop continuously, 2 unused and read as no loop, 3 loop while the key is down, then play to the end) |
| 13 | modLfoToVolume | 34 | attackVolEnv | 55 | reserved3 |
| 14 | unused1 | 35 | holdVolEnv | 56 | scaleTuning |
| 15 | chorusEffectsSend | 36 | decayVolEnv | 57 | exclusiveClass |
| 16 | reverbEffectsSend | 37 | sustainVolEnv | 58 | overridingRootKey |
| 17 | pan | 38 | releaseVolEnv | 59 | unused5 |
| 18 | unused2 | 39 | keynumToVolEnvHold | 60 | endOper |
| 19 | unused3 | 40 | keynumToVolEnvDecay | ||
| 20 | unused4 | 41 | instrument |
Units and rules
| Unit | Generators | Real value |
|---|---|---|
| Time cents | LFO and envelope delays, attack, hold, decay, release | seconds = 2^(v ÷ 1200); −32768 conventionally means none |
| Absolute cents | initialFilterFc, freqModLFO, freqVibLFO | hertz = 8.176 × 2^(v ÷ 1200) |
| Cents | The …ToPitch and …ToFilterFc amounts, fineTune, scaleTuning (per key) | As they are; 100 is a semitone |
| Centibels | initialAttenuation, sustainVolEnv, modLfoToVolume, initialFilterQ | decibels = v ÷ 10 |
| 0.1 % | chorusEffectsSend, reverbEffectsSend, sustainModEnv, pan | percent = v ÷ 10; pan −500 is full left, 500 full right |
| Samples | The address offsets; the coarse ones count 32,768 samples | As they are |
The rules below are those of the SoundFont 2.04 specification (E-mu Systems, sections 7, 8.1, 8.4, 8.5 and 9.4).
- Zones. A preset zone’s generator list ends with an instrument generator and an instrument zone’s with sampleID; generators after it are ignored. If keyRange is present it is the first generator, and velRange may only follow it; otherwise they are ignored. Each generator appears at most once in a zone; of two with the same number the first is ignored. Unknown generators are ignored.
- Global zones. If a preset or instrument has more than one zone, the first may be a global zone: one whose list does not end with instrument or sampleID, or that has only modulators. Its generators and modulators apply to every other zone. Any later zone without its instrument or sampleID is ignored, and so is a global zone with neither generators nor modulators. Bag indices that do not increase, or that do not match the sizes of the generator and modulator tables, make the file structurally unsound, as does an instrument or sample index at or past the terminal record.
- Levels. sampleID is legal only in instruments and instrument only in presets. The address offsets (0–4, 12, 45, 50), keynum, velocity, sampleModes, exclusiveClass and overridingRootKey are instrument-only and are ignored in a preset.
- Instrument level is absolute. A generator in a global instrument zone replaces the default; one in a local zone replaces the default and the global zone’s.
- Preset level is relative. A preset’s value generators are added to the instrument’s values (a local preset generator replaces a global preset one, and the result is added). Key and velocity ranges are intersected instead.
Default modulators
Every instrument has these ten modulators without their being in the file; at the preset level there are none. Two modulators are identical when their source, destination, amount source and transform are all the same, and a modulator in the file identical to a default one supersedes it.
| Source | Destination | Amount | Curve |
|---|---|---|---|
| Note-on velocity (0502) | initialAttenuation | 960 cB | Concave, negative unipolar |
| Note-on velocity (0102) | initialFilterFc | −2400 cents | Linear, negative unipolar |
| Channel pressure (000D) | vibLfoToPitch | 50 cents | Linear, positive unipolar |
| CC1 modulation (0081) | vibLfoToPitch | 50 cents | Linear, positive unipolar |
| CC7 volume (0582) | initialAttenuation | 960 cB | Concave, negative unipolar |
| CC10 pan (028A) | pan | 1000 (0.1 %) | Linear, positive bipolar |
| CC11 expression (058B) | initialAttenuation | 960 cB | Concave, negative unipolar |
| CC91 (00DB) | reverbEffectsSend | 200 (0.1 %) | Linear, positive unipolar |
| CC93 (00DD) | chorusEffectsSend | 200 (0.1 %) | Linear, positive unipolar |
| Pitch wheel (020E), amount source pitch wheel sensitivity (0010) | Initial pitch | 12700 cents | Linear, positive bipolar |
The specification’s list gives initial attenuation as the CC10 modulator’s destination, but its description says the result is added to pan.
Modulators
A modulator record is five 16-bit fields: source, destination generator (top bit set for another modulator), amount (signed), amount source, transform (0 linear, 2 absolute value). A source is a controller and how it is read:
| Bits | Meaning |
|---|---|
| 0–6 | The index: a MIDI controller number when bit 7 is set, otherwise a general controller: 0 none, 2 note-on velocity, 3 note-on key number, 10 poly pressure, 13 channel pressure, 14 pitch wheel, 16 pitch wheel sensitivity, 127 link |
| 7 | Set for a MIDI controller |
| 8 | Direction: 0 min to max, 1 max to min |
| 9 | Polarity: 0 unipolar, 1 bipolar |
| 10–15 | Curve: 0 linear, 1 concave, 2 convex, 3 switch |
In the explorer
The bank’s lists and tables are nodes, with every field named and every generator amount shown in real units, with the instrument or sample it points to named. Presets, instruments and samples appear as tables, and each sample can be opened as a WAV file (24-bit when an sm24 chunk is present), or an Ogg Vorbis file in an SF3 bank. No RMI file with a bank was among those examined for this site, so the reading is tested on files built to this layout.