AdLib music and sounds (ADL)
File formats · Field reference · Schema
In brief
The ten .ADL files hold the music and sound effects played with the
AdLib sound driver, driver 1 of the sound setting. Each level names one of
them; INTRO.ADL serves the introduction, FINALE1.ADL the story of the
ending and FINALE2.ADL its credits. Only one file is loaded at a time. What
the original files hold is described below.
A file is a small library of programs, each a list of commands for one
of ten channels: notes with durations, instrument changes, tempo, volume,
loops. A sound is played by starting a program. A tune is a program that
starts several others, one per voice. The PC speaker and the Tandy sound
chip play the .SND files of the same names instead.
Organization
| Part | Size | Contents |
|---|---|---|
| Sound-effect table | 120 bytes | The program played for each game sound number, 255 for none. |
| Program pointers | 250 × 2 | Where each program starts, counted from byte 120; 0 when absent. |
| Instrument pointers | 250 × 2 | Where each instrument starts, counted the same way. |
| Programs | variable | Two header bytes (channel, priority), then commands up to a stop. |
| Instruments | 11 bytes each | The values of eleven AdLib registers for the two operators of a voice. |
Reading the file
When it loads a level, the game keeps the first 120 bytes as the sound-effect table and copies the rest of the file into the driver's own memory, at most 15,120 bytes; every pointer is relative to that copy, hence to byte 120 of the file.1 In all ten files the programs start right after the pointer tables, at byte 1,120, and the last instrument ends on the last byte.
What it becomes in memory
The sound-effect table stays in the game, which reads it each time a sound is requested; the programs and instruments live in the driver's memory, where the driver plays them. Playing AdLib programs follows a program from its start, and how an AdLib note sounds to the registers of the card.1
In the original files
The size, programs, instruments and tunes of each of the ten files are listed under sound and music.
The programs in these files
- Program 0 silences every voice. The game plays sound 0 before it loads another file.
- Tunes are channel-9 programs that set the tempo and start two to eight
voice programs. Sounds 52 to 55 are tunes of different lengths from file to
file: 27.5, 0.8, 5.0 and 1.7 s in
FOREST; 17.1, 16.1, 1.7 and 0.8 s inMEZANINE.2 Sound 79, the spell warning, is a single note of 0.9 s in both. The long tunes are listed below. - Sound effects are voice programs whose first command,
0xab, sets a level offset. Of the 661 entries of the ten tables that select a voice program, 657 select such a program; the other four, sound 72 ofAZURE,CRIMSON1,CRIMSON2andSILVER, select one that starts with0x82. In the level files the operands of the0xabcommands run from 0 to 28, which gives 60 or 61 for a sound played 14 blocks away. Every sound that the game and the level scripts play from a block selects, in the level's file, a program that starts with0xab, so only the level offset ever changes. - Fades are channel-9 programs that raise the level offset of every voice in steps, then silence them.
The effects are unevenly used. Slides and vibratos are common in the level sounds. The register cycle appears twice in each level file, on register 32 (tremolo, vibrato, envelope type and frequency multiplier), with a table address that points into the bytes of a program.
Music
| Tune | Voices | Length | Played |
|---|---|---|---|
Sound 12 of INTRO.ADL | 7 | 14,219 driver ticks, 195.2 s | The introduction. |
Sound 13 of INTRO.ADL | 8 | 5,047 ticks, 69.3 s | Party creation. |
Sound 1 of FINALE1.ADL | 6 | 11,469 ticks, 157.4 s | The story of the ending. |
Sound 1 of FINALE2.ADL | 8 | 13,745 ticks, 188.7 s | The credits and the last picture of the ending. |
A driver tick lasts 1/72.8 second.2
Markers in these files
Only two files use the marker command, each in
the first voice of its tune: INTRO.ADL sets the markers 1 to 8 that the
introduction waits for, and FINALE1.ADL
the markers 1 to 5 of the ending, whose
pages give their times.
Example
The start of INTRO.ADL, as an example:
0000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 14 1e 1d sounds 0–15 → programs 0–12, 20, 30, 29
0010 ff ff ff … sounds 16–119: none
0078 e8 03 02 04 15 04 … program 0 at 0x3e8 (byte 0x460), program 1 at 0x402, …
Sources
Locations refer to the game executable
reference; the comparative sources are listed in the
technical references
(REF-MW-015,
REF-SCUMM-012). The statements about the
original files come from decoding every program of the ten files of the
file inventory with the schema.