WP-004: Audio archive index + codec identification

Status: ✅ Done (2026-11-13) Phase: 1 — Format Research Depends on: — Companion EC: — (single afternoon’s work; no checklist needed) Estimated effort: Half-day to 1 day. Actual: one session, after WP-001 had already found the index. Pre-flight: pre-flight-WP-004-2026-11-13


Result (2026-11-13)

All three files are a name-indexed set of uncompressed PCM clips. The full spec is in audio-archives.md.

Exit criterion Result
1. Codec named ✅ Uncompressed PCM (wFormatTag 1) in all three files: 22050 Hz 16-bit signed LE, mono or stereo; 4 clips at 44100 Hz; one 8-bit unsigned clip
2. A clip extracted and plays externally ✅ --extract writes WAVs. Four clips (voice, two sfx, music) decode in ffmpeg as pcm_s16le with normal levels. I measured them rather than listened; Jeff to confirm by ear.
3. Index location and record format documented ✅
4. Third header field resolved ✅ Index offset
5. ScummVM codec coverage ✅ Audio::makeRawStream (audio/decoders/raw.h); no new decoder; Miles not involved

Also found: voice clips carry a lip-sync track, one mouth shape (0–6) per frame at 12 or 30 fps. The high bits on some shape bytes are not traced. No dialogue text was found alongside the clips.

Deliverable note: the WP lists tools/samples/audio-clip-0.<ext>. Extracted clips are copyrighted derivatives, so they stay local (tools/samples/ is gitignored), named <clip name>.wav.


Goal

Locate the index table inside Music.dat, Sfx.dat, and Voice.dat; identify the codec used for individual audio clips; extract at least one clip and verify it plays in an external player (ffmpeg / VLC). Satisfies Phase 1 exit criterion #3.

Background

Shared 12-byte header structure is understood (version=1, entry_count, data_size — see docs/formats/audio-archives.md). Bytes 0x0C–0x4F are zero in all three files. The actual index table has not been located.

Open questions about the third header field:

File File size Field value Δ (field − file)
Music 96,182,128 96,180,224 −1,904
Sfx 32,197,616 32,178,176 −19,440
Voice 108,814,868 108,822,528 +7,660

Voice.dat’s field exceeds file size, ruling out “payload bytes.” All three end in 0x800 (= 2048, CD-ROM sector size), suggesting some sector-aligned quantity rather than a byte count of contents.

Scope

In scope:

Out of scope:

Dependencies

Exit criteria

  1. The codec used by Music.dat, Sfx.dat, and Voice.dat is identified by name (IMA ADPCM, Miles MSS, raw PCM, Vorbis, MP3 frames, etc.). Single name acceptable if all three share a codec; otherwise per-file names.
  2. At least one clip from one archive is extracted and plays in an external player.
  3. Index table location and per-entry record format documented in docs/formats/audio-archives.md Findings.
  4. The third header field’s meaning is either resolved (with a confirmed interpretation) or explicitly listed in docs/formats/audio-archives.md as “remains unknown, candidate hypotheses tested were …”.
  5. ScummVM codec coverage assessed: if the codec is already supported by ScummVM’s audio/decoders/, note which decoder. If not, this becomes a known item for Phase 3 (WP-021 will need a new decoder or wrap an existing library).

Deliverables

Notes