-
Notifications
You must be signed in to change notification settings - Fork 11
VAG
ABelliqueux edited this page Aug 14, 2021
·
4 revisions
https://github.com/ABelliqueux/nolibgs_hello_worlds/tree/main/hello_vag
https://github.com/ABelliqueux/nolibgs_hello_worlds/tree/main/hello_multivag
VAG is the PlayStation single waveform data format for ADPCM-encoded data of sampled sounds, such as piano sounds, explosions, and music. The typical extension in DOS is “.VAG”.
See FileFormat47.pdf, p.209
We have to convert the audio file to RAW data first :
ffmpeg -i input.mp3 -f s16le -ac 1 -ar 44100 tmp.dat
then use wav2vag
to convert the data, making sure the -freq=
parameter matches the -ar
value used above :
wav2vag tmp.dat output.vag -sraw16 -freq=44100
You can find a graphical editor in the PsyQ sdk named VAGEDIT.exe
.
Here is a structure definition to access the VAG header :
See FileFormat47.pdf, p.209 for full description.
typedef struct VAGhdr { // All the values in this header must be big endian
char id[4]; // VAGp 4 bytes -> 1 char * 4
unsigned int version; // 4 bytes
unsigned int reserved; // 4 bytes
unsigned int dataSize; // (in bytes) 4 bytes
unsigned int samplingFrequency; // 4 bytes
char reserved2[12]; // 12 bytes -> 1 char * 12
char name[16]; // 16 bytes -> 1 char * 16
// Waveform data after that
} VAGhdr;
See
-
libformat47.pdf p.209
-
libover47.pdf, p.271
-
libref47.pdf, p.980