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:SPU-ADPCM (PlayStation)

From ReverseEngineering.wiki
Format
Platforms Platform:PlayStation
Endianness little
On this wiki Facts · Code · Notes · Topics

The 4-bit ADPCM (BRR) coding of the PlayStation sound chip: 16-byte blocks of 28 samples with a shift/filter byte and a flags byte (loop end, repeat, loop start); the payload of VAG, VAB/VB and many streamed audio files.

Overview

The SPU plays samples stored in its 512 KB sound RAM as a sequence of 16-byte blocks, each decoding to 28 16-bit samples. The same coding (with the same prediction filters) is used on the PlayStation 2; the PS4/Vita HEVAG variant differs. CD-XA ADPCM (see Format:CD-ROM XA) uses the same algorithm with different nibble arrangement.

Block layout

Offset Meaning
0x00 shift (low nibble) and filter (high nibble)
0x01 flag bits
0x02-0x0F 28 four-bit samples, the low nibble of each byte first

Flag bits: bit 0 loop end (set ENDX and jump to the loop address), bit 1 loop repeat (clear: force release and zero level, only meaningful with bit 0), bit 2 loop start (remember this address as the loop address). Combinations of bits 0-1: 0 normal, 1 end and mute, 2 ignored, 3 end and repeat.

A one-shot sample is normally followed by a dummy block with start and end flags set and zero data, because the voice cannot be stopped otherwise. The first 16-byte block of a sample is usually all zero.

Where it appears

  • Format:VAG files (header plus this data), the raw data of VB bodies in Format:VAB (no header around each sample), and the sound RAM image of games that upload samples directly.
  • Streamed audio chunks inside STR-like containers (see Format:STR (PlayStation video)).

Evidence & references

  • psx-spx, "SPU ADPCM Samples" (docs/soundprocessingunitspu.md in the psx-spx mirror).