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, 3 loop until release) |
| 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 |
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. Presets, instruments and samples appear as tables, and each sample can be opened as a WAV file, 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.