-
Notifications
You must be signed in to change notification settings - Fork 0
File Format: VAG
vag
is a proprietary format developed by Sony. It is designed to store audio streams, specifically SONY_4BIT_ADPCM
streams using a similar concept to traditional wav
files but with a much simpler header. This one in particular is the simple mono variant, other variants exist, but this is the most common.
It was used on many PlayStation 1 and PlayStation 2 games.
The magic number should always be "VAGp", and the header size is typically 48 bytes, but sometimes there might be extra padding of 16 zeros making the header 64 bytes long. The sample rate and body size must be greater than zero.
Name | Type | Endianness |
---|---|---|
Magic number | ASCII character x4 | N/A |
Version | Unsigned 32 bit integer | Big |
Reserved | Unsigned 32 bit integer | Big |
Body size | Unsigned 32 bit integer | Big |
Sample rate | Unsigned 32 bit integer | Big |
Reserved | Unsigned 32 bit integer x3 | Big |
Name | ASCII name x16 | N/A |
(OPTIONAL) Padding | Zeroed out 8 bit integer x16 | N/A |
The body continues until the end of the file.
Audio data is split up into chunks that are each 16 bytes wide.
Bytes | Name | Description |
---|---|---|
0 | Shift / Filter | |
1 | Flag |
0: No operation 1: End 2: Loop 3: Loop end 4: Start 6: Loop start 7: Stop |
2-15 | ADPCM | Data of 28 PCM samples in total (after decoding) |
If a flag of 7 (stop) is encountered, that chunk will not be read and the program will stop playing after reading the previous one.