Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:GameCube DSP ADPCM

From ReverseEngineering.wiki
Format
Platforms Platform:Nintendo GameCube, Platform:Nintendo Wii
Endianness big (coefficients)
On this wiki Facts · Code · Notes · Topics

The 4-bit ADPCM codec of the GameCube and Wii audio DSP (GC ADPCM, "DSP" in tool names): 8-byte frames of one header byte (coefficient pair index and scale) and 14 samples, predicted from two history samples with eight coefficient pairs stored as 16 signed 16-bit values per channel in the container header.

Overview

The codec is used in .dsp, BRSTM (Format:BRSTM, BCSTM and BFSTM streams) and many other Nintendo and third-party containers. The decoder below is vgmstream's (ISC), src/coding/ngc_dsp_decoder.c at commit f7f764155b, function decode_ngc_dsp (lines 5-56).

Frame

  • 8 bytes per frame, 14 samples per frame (7 data bytes of two nibbles; line 16-17).
  • Byte 0: low nibble = scale exponent (scale = 1 << n), high nibble = index of the coefficient pair (0 to 7; vgmstream clamps larger values to 7 and notes the original decoder may not clamp; lines 24-29).
  • Bytes 1-7: signed 4-bit samples, high nibble first.

Decoding one sample

sample = ((nibble * scale) << 11)
sample = (sample + 1024 + coef1*hist1 + coef2*hist2) >> 11
sample = clamp16(sample)
hist2 = hist1; hist1 = sample

(lines 43-51). coef1 and coef2 are the pair selected by the frame header: adpcm_coef[index2] and adpcm_coef[index2+1].

Where the coefficients are

Each channel has 16 signed 16-bit big-endian values (8 pairs), stored in the container: in a BRSTM through the HEAD offset tables (meta/brstm.c lines 85-114: HEAD+0x1C holds an offset to a table of per-channel 8-byte entries, whose second word is the offset of the ADPCM header; the coefficients start 8 bytes into it). A stream also carries initial history samples per channel; vgmstream's BRSTM reader leaves them at 0 ("TODO read hist").

Unverified: the exact byte layout of the standalone .dsp header (coefficients at 0x1C) was not read here; check src/meta/ngc_dsp_std.c in vgmstream.

Related

Platform:Nintendo GameCube, Platform:Nintendo Wii, Format:BRSTM, BCSTM and BFSTM streams.

Code & repositories

  • https://github.com/vgmstream/vgmstream @ f7f764155b227f683adbab25402fe8f2be0b2ec2 · license: ISC (declared by the contributor; GitHub's detector did not recognize COPYING)
    src/coding/ngc_dsp_decoder.c is the DSP ADPCM decoder; src/meta/brstm.c shows the coefficient lookup
    Tested on: source read, not run · checked 2026-10-19