RP-029 lets an RMI file carry one bank
of instruments in the MMA’s Downloadable Sounds format: a nested RIFF
chunk whose form type is DLS . Inside are the instruments, each a set of
regions that map keys and velocities to a wave, and the waves themselves. Levels 1 and
2 of DLS differ in a few fields noted below. The layouts here follow the structures in
Microsoft’s dls1.h and dls2.h, as carried in public headers;
the MMA’s specifications are published separately. All numbers are little-endian.
Structure
RIFF 'DLS '
colh how many instruments
vers version, optional
dlid a GUID, optional
ptbl pool table: offsets of the waves
LIST lins the instruments
LIST ins one instrument
insh header
dlid
LIST lrgn the regions: LIST rgn or rgn2
LIST lart or lar2 articulation
LIST INFO names
LIST wvpl the wave pool
LIST wave one wave: fmt, wsmp, dlid, data, LIST INFO
LIST INFO names for the collection
| Chunk | Fields |
|---|---|
colh | cInstruments, u32: how many instruments are in lins |
vers | dwVersionMS, dwVersionLS, u32 each: a four-part version |
dlid | A GUID of 16 bytes, so a device need not load the same thing twice |
ptbl | cbSize (8), cCues, u32 each; then one u32 for each wave, its offset from the first byte after wvpl’s list type |
Instruments (insh)
| Field | Type | Meaning |
|---|---|---|
cRegions | u32 | How many regions the instrument has |
ulBank | u32 | Bits 0–6: bank LSB. Bits 8–14: bank MSB. Bit 31: a drum instrument |
ulInstrument | u32 | The program, 0 to 127 |
Regions (rgn, rgn2)
A region maps a range of keys and velocities to a wave. rgn2 is the
DLS 2 form and may carry a condition.
| Chunk | Fields |
|---|---|
rgnh | Key range low and high, u16 each; velocity range low and high, u16 each; fusOptions, u16 (bit 0: self non-exclusive); usKeyGroup, u16 (regions in the same non-zero group stop each other); in DLS 2, usLayer, u16 |
wsmp | See Wave sample |
wlnk | fusOptions, u16 (bit 0: phase master; bit 1: part of a multichannel set, DLS 2); usPhaseGroup, u16; ulChannel, u32 (1 left, 2 right); ulTableIndex, u32: the wave’s cue in the pool table |
cdl | DLS 2: a condition, see below |
Wave sample (wsmp)
| Field | Type | Meaning |
|---|---|---|
cbSize | u32 | 20 |
usUnityNote | u16 | The key that plays the wave at natural pitch |
sFineTune | i16 | Fine tune, in 1/65536 of a semitone |
lAttenuation | i32 | Attenuation, in 1/65536 of a tenth of a decibel |
fulOptions | u32 | Bit 0: no truncation. Bit 1: no compression |
cSampleLoops | u32 | 0 or 1 loop records follow, each cbSize (16), ulType (0 forward, 1 release, DLS 2), ulStart, ulLength |
Articulation (art1, art2)
A lart list holds art1 chunks and a lar2 list
holds art2 chunks. Both are a connection list: cbSize (8),
cConnections, then for each connection 12 bytes:
| Field | Type | Meaning |
|---|---|---|
usSource | u16 | What drives the connection |
usControl | u16 | A second source scaling the first; 0 is none |
usDestination | u16 | What it changes |
usTransform | u16 | Bits 0–3 the output curve (0 none, 1 concave, 2 convex, 3 switch); DLS 2 adds, in higher bits, the control curve, bipolar and invert flags, and the same for the source |
lScale | i32 | How much of the source reaches the destination, a 16.16 fixed-point number |
| Source | Meaning | Destination | Meaning |
|---|---|---|---|
000 | None | 000 | None |
001 | LFO | 001 | Attenuation (gain) |
002 | Key-on velocity | 003 | Pitch |
003 | Key number | 004 | Pan |
004 | Envelope 1 | 005 | Key number (DLS 2) |
005 | Envelope 2 | 010–015 | Left, right, centre, left rear, right rear, LFE (DLS 2) |
006 | Pitch wheel | 080, 081 | Chorus send, reverb send (DLS 2) |
007 | Polyphonic pressure (DLS 2) | 104, 105 | LFO frequency, start delay |
008 | Channel pressure (DLS 2) | 114, 115 | Vibrato LFO frequency, start delay (DLS 2) |
009 | Vibrato (DLS 2) | 206–20D | Envelope 1 attack, decay, (208 reserved), release, sustain, delay, hold, shutdown |
00A | Monophonic pressure (DLS 2) | 30A–310 | Envelope 2 attack, decay, (30C reserved), release, sustain, delay, hold |
081, 087 | CC1 modulation, CC7 volume | 500 | Filter cutoff (DLS 2) |
08A, 08B | CC10 pan, CC11 expression | 501 | Filter Q (DLS 2) |
0DB, 0DD | CC91 reverb, CC93 chorus (DLS 2) |
Conditions (cdl)
A DLS 2 cdl chunk holds a small expression in reverse Polish order,
each operator a u16: 1 AND, 2 OR, 3 XOR,
4 ADD, 5 SUBTRACT, 6 MULTIPLY, 7
DIVIDE, 8 LOGICAL AND, 9 LOGICAL OR, 10 LT,
11 LE, 12 GT, 13 GE, 14 EQ,
15 NOT, 16 CONST (a 32-bit value follows), 17
QUERY and 18 QUERYSUPPORTED (a 16-byte DLSID follows). The result decides
whether the region or articulation applies.
Waves (wvpl)
Each wave list is a small WAV file without the RIFF wrapper:
fmt , the WAVE format fields (format tag, channels, sample rate, byte
rate, block align, bits a sample), wsmp, dlid,
data, the samples, and an INFO list with the wave’s name. The
explorer offers each PCM wave as a WAV file to open or play.
LIST INFO
INFO lists are the standard RIFF kind, in the collection and in each
instrument and wave. INAM names the thing; the explorer shows the
instrument and wave names in its tables.
In the explorer
Each chunk above is a node, with every field named; instruments and waves appear as tables. Only the audio is left as bytes, except that each wave can be opened as a WAV. No RMI file with a bank was among those examined for this site, so the reading is tested on files built to the layouts above.