Skip to content

File Format: VAB

SalsaGal edited this page Sep 8, 2024 · 5 revisions

A proprietary format developed by Sony. Its purpose is to store custom samples, instrument attributes, etc.. Very similar concept to SoundFonts or DownLoadable Sounds (sf2/dls files). Developed solely for use on the PlayStation to better integrate with its sound hardware capabilities. It was used on many PlayStation games. Even though the standard extension is vab, it is more common to find it split into two pieces, a vh file (VAB header) and a vb file (VAB body). To get a full vab file out of the two, simply concatenate them.

The reason the files are commonly split in half, is so that the entire body can be loaded into the SPU buffer directly. The body file cannot be bigger than 512 kilobytes, as the buffer only has that much space. The maximum header size is 68128 bytes, meaning a full vab file has a maximum size of 592416 bytes, but it very rarely uses that much.

Header

The magic number should be "pBAV".

Name Type Endianness Range Default
Magic number ASCII character x4 N/A
Version Unsigned 32 bit integer Little
VAB ID Unsigned 32 bit integer Little
Total file size Unsigned 32 bit integer Little
Reserved Unsigned 16 bit integer Little
Number of programs Unsigned 16 bit integer Little 0-128
Number of zones Unsigned 16 bit integer Little 0-255
Number of waves Unsigned 16 bit integer Little
Master volume Signed 8 bit integer N/A 0-127 127
Master panning Signed 8 bit integer N/A 0-127 64
Bank attributes 1 Unsigned 8 bit integer N/A
Bank attributes 2 Unsigned 8 bit integer N/A
Reserved Unsigned 32 bit integer Little

Program

The entire program section has a fixed size of 2048 bytes, each program using 16 bytes. This means there can be no more than 128 programs. If there are less then the remaining space is padded with zeros.

There is, however, an exception. If a program has 0 zones associated to it, then the program entry is empty. This means it reserves no zones when the structures get loaded. An empty program doesn't get counted in the total count of programs found in the main header, but it still exists and should be considered valid. It still occupies a slot of 16 bytes and must be accounted for.

For example:

  1. 7 zones
  2. 11 zones
  3. 4 zones
  4. 0 zones
  5. 5 zones

While there are 5 programs in total, program number three has zero zones so the header will say there are only 4 in total.

Name Type Endianness Range Default
Number of program zones Unsigned 8 bit integer N/A 0-16
Program volume Signed 8 bit integer N/A 0-127 127
Program priority Unsigned 8 bit integer N/A
Program mode Unsigned 8 bit integer N/A
Program panning Signed 8 bit integer N/A 0-127 64
Reserved Unsigned 8 bit integer N/A
Program attribute Unsigned 16 bit integer Little
Reserved Unsigned 32 bit integer Little
Reserved Unsigned 32 bit integer Little

We used the "Program attribute" field as a way to support the multi-bank system used in SND files.

Zone

Each program is going to reserve an area of 512 bytes for its zones. Each zone occupies 32 bytes, leaving 16 zones per program. If less than 16 are used, the bytes must be padded with zeros.

Name Type Endianness Range Default
Zone priority Unsigned 8 bit integer N/A
Zone reverb volume Unsigned 8 bit integer N/A
Zone volume Signed 8 bit integer N/A 0-127 127
Zone panning Signed 8 bit integer N/A 0-127 64
Root key Signed 8 bit integer N/A 0-127 60
Pitch finetune Signed 8 bit integer N/A 0-127 0
Lowest key Signed 8 bit integer N/A 0-127
Highest key Signed 8 bit integer N/A Lowest key-127
Vibrato width Unsigned 8 bit integer N/A
Vibrato time Unsigned 8 bit integer N/A
Portamento width Unsigned 8 bit integer N/A
Portamento holding time Unsigned 8 bit integer N/A
Pitch bending range minimum Signed 8 bit integer N/A
Pitch bending range maximum Signed 8 bit integer N/A
Reserved Unsigned 8 bit integer N/A
Reserved Unsigned 8 bit integer N/A
ADSR 1 Unsigned 16 bit integer Little
ADSR 2 Unsigned 16 bit integer Little
Parent program Unsigned 16 bit integer Little
Wave index Unsigned 16 bit integer Little 1-256
Reserved Unsigned 16 bit integer Little
Reserved Unsigned 16 bit integer Little
Reserved Unsigned 16 bit integer Little
Reserved Unsigned 16 bit integer Little

Waves Sizes

The entire wave sizes table has a fixed size of 512 bytes, each entry taking 2 bytes, allowing 256 waves.

The first entry is always 0, it is a dummy value that needs to be skipped. If there are 17 waves in the file, there will 18 entries in the list. The rest of the 512 byte chunk will be padded with zeros.

Offsets are not provided and must be calculated manually. The entries need to be multiplied by eight to get their true size in bytes.

Name Type Endianness
Wave sizes Unsigned 16 bit integer array Little

After the wave sizes, the body starts and continues until the end of the file. Waves are stored in Sony's proprietary ADPCM codec, also known as VAG.

Clone this wiki locally